|
@@ -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.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+b,0,1);g.v=THREE.ColorUtils.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},
|
|
|
-clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,c){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],h=h.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var o=0,p=k.length;o<p;o++){var u=new THREE.Vertex(k[o].position.clone());b&&b.multiplyVector3(u.position);f.push(u)}o=0;for(p=m.length;o<p;o++){var u=m[o],v,y,t=u.vertexNormals,
|
|
|
-z=u.vertexColors;u instanceof THREE.Face3?v=new THREE.Face3(u.a+g,u.b+g,u.c+g):u instanceof THREE.Face4&&(v=new THREE.Face4(u.a+g,u.b+g,u.c+g,u.d+g));v.normal.copy(u.normal);e&&e.multiplyVector3(v.normal);f=0;for(k=t.length;f<k;f++)y=t[f].clone(),e&&e.multiplyVector3(y),v.vertexNormals.push(y);v.color.copy(u.color);f=0;for(k=z.length;f<k;f++)y=z[f],v.vertexColors.push(y.clone());v.materials=u.materials.slice();v.centroid.copy(u.centroid);b&&b.multiplyVector3(v.centroid);l.push(v)}o=0;for(p=h.length;o<
|
|
|
-p;o++){b=h[o];e=[];f=0;for(k=b.length;f<k;f++)e.push(new THREE.UV(b[f].u,b[f].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0],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.materials=k.materials.slice();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(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return m[f]>
|
|
|
-a?b(c,f-1):m[f]<a?b(f+1,e):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,p,u;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,p=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,p);else if(e instanceof THREE.Face4)n=f[e.a].position,o=f[e.b].position,p=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,p,u),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))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},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.GeometryUtils.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 p=o-1<0?g-1:o-1,u=(o+1)%g,v=n-1<0?e-1:n-1,y=(n+1)%e,t=[],z=[0,0,k[(o*e+n)*4]/255*c];t.push([-1,0,k[(o*e+v)*4]/255*c]);t.push([-1,-1,k[(p*e+v)*4]/255*c]);t.push([0,-1,k[(p*e+n)*4]/255*c]);t.push([1,-1,k[(p*e+y)*4]/255*c]);
|
|
|
-t.push([1,0,k[(o*e+y)*4]/255*c]);t.push([1,1,k[(u*e+y)*4]/255*c]);t.push([0,1,k[(u*e+n)*4]/255*c]);t.push([-1,1,k[(u*e+v)*4]/255*c]);p=[];v=t.length;for(u=0;u<v;u++){var y=t[u],x=t[(u+1)%v],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]];p.push(b([y[1]*x[2]-y[2]*x[1],y[2]*x[0]-y[0]*x[2],y[0]*x[1]-y[1]*x[0]]))}t=[0,0,0];for(u=0;u<p.length;u++)t[0]+=p[u][0],t[1]+=p[u][1],t[2]+=p[u][2];t[0]/=p.length;t[1]/=p.length;t[2]/=p.length;z=(o*e+n)*4;m[z]=(t[0]+1)/2*255|0;m[z+1]=(t[1]+0.5)*
|
|
|
-255|0;m[z+2]=t[2]*255|0;m[z+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)}};
|
|
|
+THREE.ColorUtils={adjustHSV:function(a,c,b,e){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+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,f=a.b,h=Math.max(Math.max(b,e),f),g=Math.min(Math.min(b,e),f);if(g===h)g=b=0;else{var k=h-g,g=k/h,b=b===h?(e-f)/k:e===h?2+(f-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=g;c.v=h;return c}};
|
|
|
+THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,f=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},t=0;t<a.materials.length;t++)u[a.materials[t].id]=t;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var t=0,z=k.length;t<z;t++){var v=new THREE.Vertex(k[t].position.clone());b&&b.multiplyVector3(v.position);g.push(v)}t=
|
|
|
+0;for(z=m.length;t<z;t++){var g=m[t],p,y,x=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(g.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(g.materialIndex!==void 0){k=h.materials[g.materialIndex];
|
|
|
+v=u[k.id];if(v===void 0)v=a.materials.length,a.materials.push(k);p.materialIndex=v}p.centroid.copy(g.centroid);b&&b.multiplyVector3(p.centroid);l.push(p)}t=0;for(z=o.length;t<z;t++){b=o[t];e=[];k=0;for(v=b.length;k<v;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,f=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var g=new THREE.Vertex(e[a].position.clone());c.vertices.push(g)}a=0;
|
|
|
+for(b=f.length;a<b;a++){var k=f[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(g=n.length;e<g;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(g=o.length;e<g;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++){f=h[a];l=[];e=0;for(g=f.length;e<
|
|
|
+g;e++)l.push(new THREE.UV(f[e].u,f[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,f,h,g=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);k.copy(c);k.multiplyScalar(f);g.addSelf(k);k.copy(b);k.multiplyScalar(h);g.addSelf(k);return g},randomPointInFace:function(a,c,b){var e,f,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,f=c.vertices[a.b].position,
|
|
|
+h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;f=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,g;b?a._area1&&a._area2?(b=a._area1,g=a._area2):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c),a._area1=b,a._area2=g):(b=THREE.GeometryUtils.triangleArea(e,f,c),g=THREE.GeometryUtils.triangleArea(f,h,c));return THREE.GeometryUtils.random()*(b+
|
|
|
+g)<b?THREE.GeometryUtils.randomPointInTriangle(e,f,c):THREE.GeometryUtils.randomPointInTriangle(f,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var g=e+Math.floor((c-e)/2);return m[g]>a?b(e,g-1):m[g]<a?b(g+1,c):g}return b(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,u,t;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
|
|
|
+THREE.Face4)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,t=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,t),e._area2=THREE.GeometryUtils.triangleArea(o,u,t),e._area=e._area1+e._area2;l+=e._area;m[f]=l}e=[];g={};for(f=0;f<c;f++)k=THREE.GeometryUtils.random()*l,k=b(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,c,b){var e,f=THREE.GeometryUtils.__v1;f.sub(a,c);e=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.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,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(e=a.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount===6)h.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[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,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var u=o-1<0?f-1:o-1,t=(o+1)%f,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(u*e+z)*4]/255*c]);p.push([0,-1,k[(u*e+n)*4]/255*c]);p.push([1,-1,k[(u*e+v)*4]/255*c]);
|
|
|
+p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(t*e+v)*4]/255*c]);p.push([0,1,k[(t*e+n)*4]/255*c]);p.push([-1,1,k[(t*e+z)*4]/255*c]);u=[];z=p.length;for(t=0;t<z;t++){var v=p[t],x=p[(t+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];u.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(t=0;t<u.length;t++)p[0]+=u[t][0],p[1]+=u[t][1],p[2]+=u[t][2];p[0]/=u.length;p[1]/=u.length;p[2]/=u.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
|
|
|
+255|0;m[y+2]=p[2]*255|0;m[y+3]=255}g.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,f=a.children.length;for(e=0;e<f;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,f=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);f.add(h)}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,296 +23,296 @@ 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.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),f,h=0;c.push(0);for(f=1;f<=a;f++)b=this.getPoint(f/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,f=b.length,h;h=c?c:a*b[f-1];time=Date.now();for(var g=0,k=f-1,l;g<=k;)if(e=Math.floor(g+(k-g)/2),l=b[e]-h,l<0)g=e+1;else if(l>0)k=e-1;else{k=e;break}e=k;if(b[e]==h)return e/(f-1);g=b[e];return b=(e+(h-g)/(b[e+1]-g))/(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,e){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,e))};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.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,e){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]),e=new THREE.Vector2(f[6],f[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.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=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=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,f);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,f);return c};THREE.ArcCurve=function(a,c,b,e,f,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};
|
|
|
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.Utils={tangentQuadraticBezier:function(a,c,b,e){return 2*(1-a)*(b-c)+2*a*(e-b)},tangentCubicBezier:function(a,c,b,e,f){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*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,e,f){var a=(b-a)*0.5,e=(e-c)*0.5,h=f*f;return(2*c-2*b+a+e)*f*h+(-3*c+3*b-2*a-e)*h+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(v2,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.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var c=new THREE.Vector3,b=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=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,f);c.y=THREE.Curve.Utils.interpolate(e[b[0]].y,e[b[1]].y,e[b[2]].y,e[b[3]].y,f);c.z=THREE.Curve.Utils.interpolate(e[b[0]].z,e[b[1]].z,e[b[2]].z,e[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.getBoundingBox=function(){var a=this.getPoints(),c,b,e,f;c=b=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,g,k,l;l=new THREE.Vector2;g=0;for(k=a.length;g<k;g++){h=a[g];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)f=h.y;l.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:c,maxY:b,centroid:l.divideScalar(k)}};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),e,f;if(!c)c=this.bends;e=0;for(f=c.length;e<f;e++)b=this.getWrapPoints(b,c[e]);return b};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,c){var b=this.getSpacedPoints(a),e,f;if(!c)c=this.bends;e=0;for(f=c.length;e<f;e++)b=this.getWrapPoints(b,c[e]);return b};
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,c){var b=this.getBoundingBox(),e,f,h,g,k,l;e=0;for(f=a.length;e<f;e++)h=a[e],g=h.x,k=h.y,l=g/b.maxX,l=c.getUtoTmapping(l,g),g=c.getPoint(l),k=c.getNormalVector(l).multiplyScalar(k),h.x=g.x+k.x,h.y=g.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.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.quadraticCurveTo=function(a,c,b,e){var f=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:f})};
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,f,h){var g=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(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
|
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,p,u,v,y;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];p=h[1];b.length>0?(f=b[b.length-1],u=f.x,v=f.y):(f=this.actions[e-1].args,u=f[f.length-2],v=f[f.length-1]);for(f=1;f<=a;f++)y=f/a,h=THREE.Shape.Utils.b2(y,u,o,k),y=THREE.Shape.Utils.b2(y,v,p,
|
|
|
-l),b.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];p=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],u=f.x,v=f.y):(f=this.actions[e-1].args,u=f[f.length-2],v=f[f.length-1]);for(f=1;f<=a;f++)y=f/a,h=THREE.Shape.Utils.b3(y,u,o,m,k),y=THREE.Shape.Utils.b3(y,v,p,n,l),b.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];y=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
|
|
|
-for(f=1;f<=y;f++)b.push(h.getPointAt(f/y));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];y=h[4];p=!!h[5];n=f[f.length-2];u=f[f.length-1];f.length==0&&(n=u=0);v=y-o;var t=a*2;for(f=1;f<=t;f++)y=f/t,p||(y=1-y),y=o+y*v,h=n+k+m*Math.cos(y),y=u+l+m*Math.sin(y),b.push(new THREE.Vector2(h,y))}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.Path.prototype.arc=function(a,c,b,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};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,f,h,g,k,l,m,n,o,u,t,z,v;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){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?(g=b[b.length-1],t=g.x,z=g.y):(g=this.actions[e-1].args,t=g[g.length-2],z=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,h=THREE.Shape.Utils.b2(v,t,o,k),v=THREE.Shape.Utils.b2(v,z,u,
|
|
|
+l),b.push(new THREE.Vector2(h,v));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?(g=b[b.length-1],t=g.x,z=g.y):(g=this.actions[e-1].args,t=g[g.length-2],z=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,h=THREE.Shape.Utils.b3(v,t,o,m,k),v=THREE.Shape.Utils.b3(v,z,u,n,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];v=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
|
|
|
+for(g=1;g<=v;g++)b.push(h.getPointAt(g/v));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];u=!!h[5];n=g[g.length-2];t=g[g.length-1];g.length==0&&(n=t=0);z=v-o;var p=a*2;for(g=1;g<=p;g++)v=g/p,u||(v=1-v),v=o+v*z,h=n+k+m*Math.cos(v),v=t+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}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,f,h){var g=this.getPoints(),k,l,m,n,o;k=0;for(l=g.length;k<l;k++)m=g[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+f*n+h;return g};
|
|
|
+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,f,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
|
+this.getPoints();a=0;for(b=e.length;a<b;a++)f=e[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,e,f=[],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&&(f.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var g,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(c=f.length;a<c;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g&&h.push(g),g=new THREE.Shape,g.actions=e.actions,g.curves=
|
|
|
+e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(c=f.length;a<c;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.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.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,p,u,v=[];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++){p=m[g];u=[];for(o=0;o<b.length;o++)n=b[o],n=p.distanceToSquared(n),u.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 y=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(y);var t=[m[f],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(t);u=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;y=[m[f],b[k],b[g]];y=THREE.FontUtils.Triangulate.area(y);t=[m[f],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(t);o+p>y+t&&(k=u,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);p=b.slice(k);u=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];v.push([m[f],b[k],b[g]]);v.push(h);b=o.concat(u).concat(n).concat(p)}return{shape:b,
|
|
|
-isolatedPts:v,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.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),f,h,g,k,l,m,n,o,u,t,z=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(f=0;f<m.length;f++){u=m[f];t=[];for(o=0;o<b.length;o++)n=b[o],n=u.distanceToSquared(n),t.push(n),n<h&&(h=n,g=f,k=o)}f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;var v=[m[g],b[k],b[f]];o=THREE.FontUtils.Triangulate.area(v);var p=[m[g],m[h],b[k]];u=THREE.FontUtils.Triangulate.area(p);t=k;n=g;k+=1;g+=-1;k<
|
|
|
+0&&(k+=b.length);k%=b.length;g<0&&(g+=m.length);g%=m.length;f=k-1>=0?k-1:b.length-1;h=g-1>=0?g-1:m.length-1;v=[m[g],b[k],b[f]];v=THREE.FontUtils.Triangulate.area(v);p=[m[g],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+u>v+p&&(k=t,g=n,k<0&&(k+=b.length),k%=b.length,g<0&&(g+=m.length),g%=m.length,f=k-1>=0?k-1:b.length-1,h=g-1>=0?g-1:m.length-1);o=b.slice(0,k);u=b.slice(k);t=m.slice(g);n=m.slice(0,g);h=[m[g],m[h],b[k]];z.push([m[g],b[k],b[f]]);z.push(h);b=o.concat(t).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,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,g,k,l,m={};h=0;for(g=e.length;h<g;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(g=b.length;h<g;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(g=f.length;h<g;h++){k=f[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(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,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,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
|
+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,e=c.font!==void 0?c.font:"helvetiker",f=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=f;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 c=0;c<a.length;c++)a[c].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<
|
|
|
+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.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,f;for(b=0;b<e;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 h=f.animationCache.prevKey;f=f.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];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,p;this.currentTime+=a*this.timeScale;p=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 u=0,v=this.hierarchy.length;u<v;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=n[u][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 y=0;y<3;y++){b=c[y];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<o;)f=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,u,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 "+u),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",u,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,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(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].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.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,h,g,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 t=0,z=this.hierarchy.length;t<z;t++)if(a=this.hierarchy[t],l=a.animationCache,this.JITCompile&&n[t][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[t][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=n[t][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 v=0;v<3;v++){b=c[v];g=l.prevKey[b];k=l.nextKey[b];if(k.time<=u){if(o<u)if(this.loop){g=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(b,t,1);k.time<o;)g=k,k=this.getNextKeyWith(b,t,k.index+1)}else{this.stop();return}else{do g=k,k=this.getNextKeyWith(b,t,k.index+1);while(k.time<
|
|
|
+o)}l.prevKey[b]=g;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),b.x=f[0],b.y=f[1],b.z=f[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(f,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)n[t][m]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,h,g,k,l,m;f=(a.length-1)*c;h=Math.floor(f);f-=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=f*f;g=f*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],f,b,g);e[1]=this.interpolate(h[1],k[1],l[1],m[1],f,b,g);e[2]=this.interpolate(h[2],k[2],l[2],m[2],f,b,g);return e};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,b,e,f,h,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*h+a*f+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=
|
|
|
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.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.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
+THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,f,h,g){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,g);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,f);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.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
|
|
|
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.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
|
|
|
-this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;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));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();
|
|
|
-if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};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.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
|
|
|
-!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.object.position.y<this.heightMin?this.heightMin:this.object.position.y>this.heightMax?this.heightMax:this.object.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&
|
|
|
-!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=this.tdiff*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=(this.phi-0)*(this.verticalMax-
|
|
|
-this.verticalMin)/(Math.PI-0)+this.verticalMin;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,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),t=g.length,z=0;h=t-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:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<t-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:g[h]};f.hierarchy[0]=
|
|
|
-b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.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.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
+0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;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));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
|
|
|
+!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};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.onKeyDown=
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
|
+!1;break;case 70:this.moveDown=!1}};this.update=function(a){if(!this.freeze){if(this.heightSpeed){var b=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*b*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&this.object.translateX(b);
|
|
|
+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 f(a,b,e,c){var g={name:e,fps:0.6,length:c,hierarchy:[]},h,f=b.getControlPointsArray(),k=b.getLength(),p=f.length,y=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)y=c*k.chunks[h]/k.total,b.keys[h]={time:y,pos:f[h]};g.hierarchy[0]=
|
|
|
+b;THREE.AnimationHandler.add(g);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,g=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return g}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(){var a,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);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;a=this.verticalAngleMap.srcRange;
|
|
|
-c=this.verticalAngleMap.dstRange;var e=c[1]-c[0];this.phi=b(((this.phi-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;e=c[1]-c[0];this.theta=b(((this.theta-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[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",
|
|
|
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=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%g;this.phi=a>=0?a:a+g;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=
|
|
|
+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),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,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,c=h(b,10),g=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(g,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);g=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(g,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
|
|
|
e(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.lastUpdate=-1;this.tdiff=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=
|
|
|
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff*this.rollSpeed;this.object.translateX(this.moveVector.x*a);this.object.translateY(this.moveVector.y*a);this.object.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,
|
|
|
-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;this.lastUpdate=-1;this.delta=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,p=0,u=window.innerWidth/2,v=window.innerHeight/2;this.update=function(){var a=
|
|
|
-(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*o),this.rotateVertically(a*p));a=this.delta*this.movementSpeed;this.object.translateZ(-a*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(a*m);this.object.translateY(a*n);f&&(this.roll+=this.rollSpeed*this.delta*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;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-u)/window.innerWidth;p=(a.clientY-v)/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,p=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=p.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=p:o.addSelf(a.sub(p,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=p=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&&(p=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=p=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,o,n){var u,p,v=e||1,K=g||1,C=k/2,F=l/2,J=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")u="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")u="y",K=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")u="x",v=h||1;var M=v+1,N=K+1;k/=v;var L=l/K;for(p=0;p<N;p++)for(l=0;l<M;l++){var O=new THREE.Vector3;O[a]=(l*k-C)*c;O[b]=(p*L-F)*f;O[u]=o;m.vertices.push(new THREE.Vertex(O))}for(p=0;p<K;p++)for(l=0;l<v;l++)m.faces.push(new THREE.Face4(l+M*p+J,
|
|
|
-l+M*(p+1)+J,l+1+M*(p+1)+J,l+1+M*p+J,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/v,p/K),new THREE.UV(l/v,(p+1)/K),new THREE.UV((l+1)/v,(p+1)/K),new THREE.UV((l+1)/v,p/K)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,p=b/2;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var v in k)this.sides[v]!=void 0&&(this.sides[v]=k[v]);
|
|
|
-this.sides.px&&l("z","y",-1,-1,b,c,n,this.materials[0]);this.sides.nx&&l("z","y",1,-1,b,c,-n,this.materials[1]);this.sides.py&&l("x","z",1,1,a,b,o,this.materials[2]);this.sides.ny&&l("x","z",1,-1,a,b,-o,this.materials[3]);this.sides.pz&&l("x","y",1,-1,a,c,p,this.materials[4]);this.sides.nz&&l("x","y",-1,-1,a,c,-p,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,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=[],p=[],u=l/g,v=u*(c-a)+a;for(k=0;k<=e;k++){var y=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(v*Math.sin(y*Math.PI*2),-u*b+f,v*Math.cos(y*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(y,u))}m.push(o);n.push(p)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],p=m[l+1][k+1],u=m[l][k+1],v=
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),t=this.vertices[p].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,p,u,[v,y,t,z]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
|
|
|
-1],p=this.vertices.length-1,v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,p,[v,y,t])),this.faceVertexUvs[0].push([x,w,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],p=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
|
|
|
-A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,p,[v,y,t])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
-THREE.ExtrudeGeometry=function(a,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(C=a.length;--C>=0;){R=C;S=C-1;S<0&&(S=a.length-
|
|
|
-1);for(var b=0,c=u+n*2,b=0;b<c;b++){var e=O*b,f=O*(b+1),h=W+R+e,g=W+R+f,m=h,e=W+S+e,f=W+S+f,o=g;m+=K;e+=K;f+=K;o+=K;G.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=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,w));if(w){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,p=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,v=c.bendPath,y=c.extrudePath,t,z=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(y)t=y.getPoints(p),u=t.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,K=this.vertices.length;v&&a.addWrapPath(v);p=x?a.extractAllSpacedPoints(p):a.extractAllPoints(p);v=p.shape;p=p.holes;if(y=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(I=p.length;E<I;E++)B=p[E],THREE.Shape.Utils.isClockWise(B)&&
|
|
|
-(p[E]=B.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(v,p);x=v;E=0;for(I=p.length;E<I;E++)B=p[E],v=v.concat(B);var C,F,J,M,N,L,O=v.length,H=y.length,Q=[];C=0;F=x.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),Q[C]=e(x[C],x[R],x[S]);var P=[],T,X=Q.concat();E=0;for(I=p.length;E<I;E++){B=p[E];T=[];C=0;F=B.length;R=F-1;for(S=C+1;C<F;C++,R++,S++)R==F&&(R=0),S==F&&(S=0),T[C]=e(B[C],B[R],B[S]);P.push(T);X=X.concat(T)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
|
|
|
-x.length;C<F;C++)L=b(x[C],Q[C],M),h(L.x,L.y,-N);E=0;for(I=p.length;E<I;E++){B=p[E];T=P[E];C=0;for(F=B.length;C<F;C++)L=b(B[C],T[C],M),h(L.x,L.y,-N)}}M=m;for(C=0;C<O;C++)L=o?b(v[C],X[C],M):v[C],z?h(L.x,L.y+t[0].y,t[0].x):h(L.x,L.y,0);for(J=1;J<=u;J++)for(C=0;C<O;C++)L=o?b(v[C],X[C],M):v[C],z?h(L.x,L.y+t[J-1].y,t[J-1].x):h(L.x,L.y,k/u*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)L=b(x[C],Q[C],M),h(L.x,L.y,k+N);E=0;for(I=p.length;E<I;E++){B=p[E];T=P[E];
|
|
|
-C=0;for(F=B.length;C<F;C++)L=b(B[C],T[C],M),z?h(L.x,L.y+t[u-1].y,t[u-1].x+N):h(L.x,L.y,k+N)}}if(o){o=O*0;for(C=0;C<H;C++)m=y[C],f(m[2]+o,m[1]+o,m[0]+o);o=O*(u+n*2);for(C=0;C<H;C++)m=y[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=y[C],f(m[2],m[1],m[0]);for(C=0;C<H;C++)m=y[C],f(m[0]+O*u,m[1]+O*u,m[2]+O*u)}var R,S,W=0;g(x);W+=x.length;E=0;for(I=p.length;E<I;E++)B=p[E],g(B),W+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+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,g=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-g)/g;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,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,u=0,t=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);g&&(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();f.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
+f).normalize();e.cross(f,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.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;
|
|
|
+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-t)/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:g=!0;k=1;break;case 69:g=!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:g=!1;break;case 69:g=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
|
|
|
+THREE.TrackballControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;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 e=!1,f=this.STATE.NONE,h=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector2,m=new THREE.Vector2,n=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,b){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
|
|
|
+this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(c.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(c.x));e.addSelf(h.setLength(c.z));return e};this.rotateCamera=function(){var a=Math.acos(g.dot(k)/g.length()/k.length());if(a){var b=(new THREE.Vector3).cross(g,k).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,
|
|
|
+-a);c.multiplyVector3(h);c.multiplyVector3(this.object.up);c.multiplyVector3(k);this.staticMoving?g=k:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(m.y-l.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?l=m:l.y+=(m.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var b=h.clone().crossSelf(this.object.up).setLength(a.x);
|
|
|
+b.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(b);this.target.addSelf(b);this.staticMoving?n=o:n.addSelf(a.sub(o,n).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
|
|
|
+this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,function(a){e&&(g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),n=o=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);f!==this.STATE.NONE&&
|
|
|
+(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==
|
|
|
+this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
|
+THREE.CubeGeometry=function(a,c,b,e,f,h,g,k){function l(a,b,c,g,k,l,o,n){var p,t,u=e||1,v=f||1,z=k/2,x=l/2,w=m.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")p="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")p="y",v=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")p="x",u=h||1;var y=u+1,O=v+1;k/=u;var R=l/v;for(t=0;t<O;t++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(t*R-x)*g;U[p]=o;m.vertices.push(new THREE.Vertex(U))}for(t=0;t<v;t++)for(l=0;l<u;l++)m.faces.push(new THREE.Face4(l+
|
|
|
+y*t+w,l+y*(t+1)+w,l+1+y*(t+1)+w,l+1+y*t+w,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/u,t/v),new THREE.UV(l/u,(t+1)/v),new THREE.UV((l+1)/u,(t+1)/v),new THREE.UV((l+1)/u,t/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,t,z,v,p,y,x;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(t=0;t<6;t++)this.materials.push(g)}t=0;p=1;z=2;y=3;v=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=
|
|
|
+void 0&&(this.sides[w]=k[w]);this.sides.px&&l("z","y",-1,-1,b,c,n,t);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,u,v);this.sides.nz&&l("x","y",-1,-1,a,c,-u,x);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,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,g=b/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],u=[],t=l/f,z=t*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-t*b+g,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(v,t))}m.push(o);n.push(u)}for(l=0;l<f;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],t=m[l][k+1],z=
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,t,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,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),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,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),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
|
|
|
+A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;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 e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);k.copy(a).addSelf(h);l.copy(a).addSelf(f);if(k.equals(l))return f.clone();
|
|
|
+k.copy(b).addSelf(h);l.copy(c).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;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),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
|
|
|
+1);for(var b=0,c=t+n*2,b=0;b<c;b++){var e=P*b,g=P*(b+1),h=X+S+e,f=X+S+g,m=h,e=X+T+e,g=X+T+g,o=f;m+=L;e+=L;g+=L;o+=L;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=b/c,e=(b+1)/c,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
|
|
|
+b,c,null,null,w));if(w){var e=D.maxY,g=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,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,t=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(u),t=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);u=x?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)B=u[E],THREE.Shape.Utils.isClockWise(B)&&
|
|
|
+(u[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,u);x=z;E=0;for(I=u.length;E<I;E++)B=u[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){B=u[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[C]=e(B[C],B[S],B[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);C=
|
|
|
+0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=t;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/t*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=u.length;E<I;E++){B=u[E];
|
|
|
+R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[t-1].y,p[t-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],g(m[2]+o,m[1]+o,m[0]+o);o=P*(t+n*2);for(C=0;C<H;C++)m=v[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],g(m[0]+P*t,m[1]+P*t,m[2]+P*t)}var S,T,X=0;f(x);X+=x.length;E=0;for(I=u.length;E<I;E++)B=u[E],f(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
-THREE.IcosahedronGeometry=function(a){function 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=
|
|
|
-{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.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.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=f.vertices[a].position,g=f.vertices[b].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=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 g=0;g<this.subdivisions;g++){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}f.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=[],f=[],h=[],g=(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]=g.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),f[k]=this.vertices.length-1):f=h;l==0&&(h=e);
|
|
|
+for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[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=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=g.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(),
|
|
|
+g.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),g.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,f(a,b),f(a,c),k),e(f(a,b),b,f(b,c),k),e(f(a,c),f(b,c),c,k),e(f(a,b),f(b,c),f(a,c),k))}function f(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=isFinite(c)?c:3,g=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={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 f,h=a/2,g=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(f=0;f<l;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(f*m-g),0)));for(f=0;f<e;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)]);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,p=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,p)))-1);m.push(n)}c.push(m)}for(var u,v,y,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];p=b/(g-1);u=(b-1)/(g-1);v=(e+1)/h;var o=e/h,n=new THREE.UV(1-v,p),p=new THREE.UV(1-o,p),o=new THREE.UV(1-o,u),t=new THREE.UV(1-v,u);b<c.length-1&&(u=this.vertices[f].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,p,o]));b>1&&(u=
|
|
|
-this.vertices[f].position.clone(),v=this.vertices[l].position.clone(),y=this.vertices[m].position.clone(),u.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,o,t]))}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,e,f=Math.PI,h=Math.max(3,c||8),g=Math.max(2,b||6),c=[],b=0;b<g+1;b++){e=b/g;var k=a*Math.cos(e*f),l=a*Math.sin(e*f),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,u=l*Math.sin(o*f),o=l*Math.cos(o*f);(b==0||b==g)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);m.push(n)}c.push(m)}for(var t,z,v,f=c.length,b=0;b<f;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;g=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/(f-1);t=(b-1)/(f-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,t),p=new THREE.UV(1-z,t);b<c.length-1&&(t=this.vertices[g].position.clone(),z=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),t.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,u,o]));b>1&&(t=
|
|
|
+this.vertices[g].position.clone(),z=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),t.normalize(),z.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,l,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,p]))}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.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,p,u,v,y,t=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(t){if(t.o){c=t._cachedOutline||(t._cachedOutline=t.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;p=c[a++]*b+e;u=c[a++]*b;g.quadraticCurveTo(p,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,x=THREE.Shape.Utils.b2(z,n,p,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(x,z))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,p=c[a++]*b+e,u=c[a++]*-b,v=c[a++]*b+e,y=c[a++]*-b,g.bezierCurveTo(k,m,
|
|
|
-p,u,v,y),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,x=THREE.Shape.Utils.b3(z,n,p,v,k),z=THREE.Shape.Utils.b3(z,o,u,y,m),h.push(new THREE.Vector2(x,z))}}}return{offset:t.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 p;a:{p=a;var u=l,v=m,y=n,t=g,z=f,x=void 0,w=void 0,A=void 0,
|
|
|
-D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,K=void 0,w=p[z[u]].x,A=p[z[u]].y,D=p[z[v]].x,B=p[z[v]].y,E=p[z[y]].x,I=p[z[y]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))p=!1;else{for(x=0;x<t;x++)if(!(x==u||x==v||x==y)){var G=p[z[x]].x,K=p[z[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,L=void 0,O=void 0,H=void 0,Q=void 0,P=void 0,T=void 0,X=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,L=B-A,O=G-w,H=K-A,Q=G-D,P=K-B,T=G-E,X=K-I,C=C*P-F*Q,N=N*H-L*O,J=J*X-M*T;if(C>=0&&J>=0&&N>=0){p=!1;break a}}p=!0}}if(p){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();
|
|
|
+this.getFace(),b=this.size/c.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(f[a],c,b,e,k);e+=k.offset;g.push(k.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,c,b,e,f){var h=[],g,k,l,m,n,o,u,t,z,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.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));f.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));f.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;u=c[a++]*b+e;t=c[a++]*b;f.quadraticCurveTo(u,t,k,m);if(g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,x=THREE.Shape.Utils.b2(y,n,u,k),y=THREE.Shape.Utils.b2(y,o,t,m);h.push(new THREE.Vector2(x,y))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,u=c[a++]*b+e,t=c[a++]*-b,z=c[a++]*b+e,v=c[a++]*-b,f.bezierCurveTo(k,m,
|
|
|
+u,t,z,v),g=h[h.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,x=THREE.Shape.Utils.b3(y,n,u,z,k),y=THREE.Shape.Utils.b3(y,o,t,v,m),h.push(new THREE.Vector2(x,y))}}}return{offset:p.ha*b,points:h,path:f}}}};
|
|
|
+(function(a){var c=function(a){for(var c=a.length,f=0,h=c-1,g=0;g<c;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<f;m++)g[m]=m;else for(m=0;m<f;m++)g[m]=f-1-m;var o=2*f;for(m=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;f<=l&&(l=0);m=l+1;f<=m&&(m=0);n=m+1;f<=n&&(n=0);var u;a:{u=a;var t=l,z=m,v=n,p=f,y=g,x=void 0,w=void 0,A=void 0,
|
|
|
+D=void 0,B=void 0,E=void 0,I=void 0,G=void 0,L=void 0,w=u[y[t]].x,A=u[y[t]].y,D=u[y[z]].x,B=u[y[z]].y,E=u[y[v]].x,I=u[y[v]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))u=!1;else{for(x=0;x<p;x++)if(!(x==t||x==z||x==v)){var G=u[y[x]].x,L=u[y[x]].y,C=void 0,F=void 0,J=void 0,M=void 0,N=void 0,K=void 0,P=void 0,H=void 0,Q=void 0,O=void 0,R=void 0,U=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,M=A-I,N=D-w,K=B-A,P=G-w,H=L-A,Q=G-D,O=L-B,R=G-E,U=L-I,C=C*O-F*Q,N=N*H-K*P,J=J*U-M*R;if(C>=0&&J>=0&&N>=0){u=!1;break a}}u=!0}}if(u){h.push([a[g[l]],
|
|
|
+a[g[m]],a[g[n]]]);k.push([g[l],g[m],g[n]]);l=m;for(n=m+1;n<f;l++,n++)g[l]=g[n];f--;o=2*f}}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,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=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,g=b/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(g))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(g))*Math.sin(h);k.z=
|
|
|
+this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(f).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,g=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(f,h,g,k,[c[f],c[h],c[g],c[k]]);l.normal.addSelf(c[f]);l.normal.addSelf(c[h]);l.normal.addSelf(c[g]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
|
|
|
+this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].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,f,h,g){function k(a,b,c,e,g,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(g*(2+c)*0.5*Math.cos(a),g*(2+c)*Math.sin(a)*0.5,h*g*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=f||2;this.q=h||3;this.heightScale=g||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,g=c/this.segmentsT*2*Math.PI,f=k(l,g,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=l.x-f.x;b.y=l.y-f.y;b.z=l.z-f.z;e.x=l.x+f.x;e.y=l.y+f.y;e.z=l.z+f.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=l*e.x+g*h.x;f.y+=l*e.y+g*h.y;f.z+=l*e.z+g*h.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 e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],g=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(f,b,e,h));this.faceVertexUvs[0].push([g,l,m,n])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var 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 n,t,u,p=0;p<4;p++){u=l[p];n=new THREE.Color;n.setRGB(0,0,0);for(var v=0;v<u.length;v++)t=k.vertexColors[u[v]-1],n.r+=t.r,n.g+=t.g,n.b+=t.b;n.r/=u.length;n.g/=u.length;n.b/=u.length;m.vertexColors[p]=n}}g.push(m);(!f.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[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=[],p,u,v,y,t,z=a.faceVertexUvs[0];p=0;for(u=z.length;p<u;p++){v=0;for(y=z[p].length;v<y;v++)t=e[p]["abcd".charAt(v)],o[t]||(o[t]=z[p][v])}var x;p=0;for(u=e.length;p<u;p++)if(t=e[p],m.push(t.centroid),l.push(new THREE.Vertex(t.centroid)),f.supportUVs&&o.length!=0){x=new THREE.UV;if(t instanceof THREE.Face3)x.u=o[t.a].u+o[t.b].u+o[t.c].u,x.v=o[t.a].v+o[t.b].v+o[t.c].v,x.u/=3,x.v/=3;else if(t instanceof THREE.Face4)x.u=o[t.a].u+
|
|
|
-o[t.b].u+o[t.c].u+o[t.d].u,x.v=o[t.a].v+o[t.b].v+o[t.c].v+o[t.d].v,x.u/=4,x.v/=4;o.push(x)}y=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 w,A,D=0,z=k.length,B;for(p in y)if(t=y[p],x=t[0],w=
|
|
|
-t[1],B=p.split("_"),u=B[0],B=B[1],A=new THREE.Vector3,t.length!=2?(A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[p]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[u].u+o[B].u,x.v=o[u].v+o[B].v,x.u/=2,x.v/=2,o.push(x);p=0;for(u=m.length;p<u;p++)t=e[p],x=z+p,t instanceof THREE.Face3?(w=b(t.a,t.b),B=b(t.b,t.c),D=b(t.c,t.a),
|
|
|
-c(x,n[w],t.b,n[B],t,["123","12","2","23"]),c(x,n[B],t.c,n[D],t,["123","23","3","31"]),c(x,n[D],t.a,n[w],t,["123","31","1","12"])):t instanceof THREE.Face4?(w=b(t.a,t.b),B=b(t.b,t.c),D=b(t.c,t.d),A=b(t.d,t.a),c(x,n[w],t.b,n[B],t,["1234","12","2","23"]),c(x,n[B],t.c,n[D],t,["1234","23","3","34"]),c(x,n[D],t.d,n[A],t,["1234","34","4","41"]),c(x,n[A],t.a,n[w],t,["1234","41","1","12"])):console.log("face should be a face!",t);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,
|
|
|
-b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(p in y)t=y[p],B=p.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=t[0],w=t[1],n(u,x),w?n(u,w):n(u,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;p=0;for(u=k.length;p<u;p++)if(E[p]!==void 0){l.set(0,0,0);n.set(0,0,0);y=new THREE.Vector3(0,0,0);z=0;for(v in I[p])l.addSelf(m[v]),z++;l.divideScalar(z);z=E[p].length;for(v=0;v<z;v++)t=E[p][v],t=k[t[0]].position.clone().addSelf(k[t[1]].position).divideScalar(2),n.addSelf(t);n.divideScalar(z);
|
|
|
-y.addSelf(k[p].position);y.multiplyScalar(z-3);y.addSelf(l);y.addSelf(n.multiplyScalar(2));y.divideScalar(z);e[p].position=y}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
+THREE.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(g.useOldVertexColors){m.vertexColors=[];for(var p,n,t,u=0;u<4;u++){t=l[u];p=new THREE.Color;p.setRGB(0,0,0);for(var v=0;v<t.length;v++)n=k.vertexColors[t[v]-1],p.r+=n.r,p.g+=n.g,p.b+=n.b;p.r/=t.length;p.g/=t.length;p.b/=t.length;m.vertexColors[u]=p}}f.push(m);(!g.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var e=[],f=[],h=[],g=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],u,t,z,v,p,y=a.faceVertexUvs[0];u=0;for(t=y.length;u<t;u++){z=0;for(v=y[u].length;z<v;z++)p=e[u]["abcd".charAt(z)],o[p]||(o[p]=y[u][z])}var x;u=0;for(t=e.length;u<t;u++)if(p=e[u],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),g.supportUVs&&o.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=o[p.a].u+o[p.b].u+o[p.c].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=o[p.a].u+
|
|
|
+o[p.b].u+o[p.c].u+o[p.d].u,x.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,x.u/=4,x.v/=4;o.push(x)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,g,h,f,k={};e=0;for(g=a.faces.length;e<g;e++)h=a.faces[e],h instanceof THREE.Face3?(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.a),c(k,f,e)):h instanceof THREE.Face4&&(f=b(h.a,h.b),c(k,f,e),f=b(h.b,h.c),c(k,f,e),f=b(h.c,h.d),c(k,f,e),f=b(h.d,h.a),c(k,f,e));return k}(a);var w,A,D=0,y=k.length,B;for(u in v)if(p=v[u],x=p[0],w=
|
|
|
+p[1],B=u.split("_"),t=B[0],B=B[1],A=new THREE.Vector3,p.length!=2?(A.addSelf(k[t].position),A.addSelf(k[B].position),A.multiplyScalar(0.5)):(A.addSelf(m[x]),A.addSelf(m[w]),A.addSelf(k[t].position),A.addSelf(k[B].position),A.multiplyScalar(0.25)),n[u]=y+e.length+D,l.push(new THREE.Vertex(A)),D++,g.supportUVs&&o.length!=0)x=new THREE.UV,x.u=o[t].u+o[B].u,x.v=o[t].v+o[B].v,x.u/=2,x.v/=2,o.push(x);u=0;for(t=m.length;u<t;u++)p=e[u],x=y+u,p instanceof THREE.Face3?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.a),
|
|
|
+c(x,n[w],p.b,n[B],p,["123","12","2","23"]),c(x,n[B],p.c,n[D],p,["123","23","3","31"]),c(x,n[D],p.a,n[w],p,["123","31","1","12"])):p instanceof THREE.Face4?(w=b(p.a,p.b),B=b(p.b,p.c),D=b(p.c,p.d),A=b(p.d,p.a),c(x,n[w],p.b,n[B],p,["1234","12","2","23"]),c(x,n[B],p.c,n[D],p,["1234","23","3","34"]),c(x,n[D],p.d,n[A],p,["1234","34","4","41"]),c(x,n[A],p.a,n[w],p,["1234","41","1","12"])):console.log("face should be a face!",p);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,
|
|
|
+b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(u in v)p=v[u],B=u.split("_"),t=B[0],B=B[1],l(t,[t,B]),l(B,[t,B]),x=p[0],w=p[1],n(t,x),w?n(t,w):n(t,x),n(B,x),w?n(B,w):n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;u=0;for(t=k.length;u<t;u++)if(E[u]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);y=0;for(z in I[u])l.addSelf(m[z]),y++;l.divideScalar(y);y=E[u].length;for(z=0;z<y;z++)p=E[u][z],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),n.addSelf(p);n.divideScalar(y);
|
|
|
+v.addSelf(k[u].position);v.multiplyScalar(y-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(y);e[u].position=v}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var 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("/")+"/"},init_materials: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][0],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 p=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=p;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 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 f(a,b,g,h,f,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=g;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}f&&a[b].offset.set(f[0],f[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+"/"+g)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g,k,l;k="MeshLambertMaterial";g={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")g.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")g.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)g.transparent=a.transparent;if(a.depthTest!==void 0)g.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(a.vertexColors)g.vertexColors=THREE.VertexColors;if(a.colorDiffuse)g.color=h(a.colorDiffuse);
|
|
|
+else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpecular);if(a.colorAmbient)g.ambient=h(a.colorAmbient);if(a.transparency)g.opacity=a.transparency;if(a.specularCoef)g.shininess=a.specularCoef;a.mapDiffuse&&c&&f(g,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(g,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(g,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
+a.mapSpecular&&c&&f(g,"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=g.color;k=g.specular;l=g.ambient;var u=g.shininess;n.tNormal.texture=g.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(g.map)n.tDiffuse.texture=g.map,n.enableDiffuse.value=!0;if(g.specularMap)n.tSpecular.texture=g.specularMap,n.enableSpecular.value=!0;if(g.lightMap)n.tAO.texture=
|
|
|
+g.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(g.opacity)n.uOpacity.value=g.opacity;g=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else g=new THREE[k](g);return g}};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){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,g,e,h)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
|
|
|
-c.postMessage(a)};
|
|
|
-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+B);f=g(a,b+E);b=l(a,b+I);z.faces.push(new THREE.Face3(c,e,f,null,null,z.materials[b]))}function p(b){var c,e,f,h,m,o;c=g(a,b);e=g(a,b+B);f=g(a,b+E);h=l(a,b+I);m=g(a,b+G);o=g(a,b+K);b=g(a,b+C);h=z.materials[h];var n=A[o*3],p=A[o*3+1];o=A[o*3+2];var t=A[b*3],u=A[b*3+1],b=A[b*3+2];z.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(n,p,o),new THREE.Vector3(t,u,b)],null,h))}function u(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);z.faces.push(new THREE.Face4(c,e,f,h,null,null,z.materials[b]))}function v(b){var c,e,f,h,m,o,n,p;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+M);m=l(a,b+N);o=g(a,b+L);n=g(a,b+O);p=g(a,b+H);b=g(a,b+Q);m=z.materials[m];var t=A[n*3],u=A[n*3+1];n=A[n*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var na=A[b*3],v=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[o*3],A[o*3+1],A[o*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,b)],null,
|
|
|
-m))}function y(b){var c,e,f,h;c=g(a,b);e=g(a,b+P);f=g(a,b+T);b=D[c*2];h=D[c*2+1];c=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(m,f));l.push(o)}function t(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+X);f=g(a,b+R);h=g(a,b+S);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var o=z.faceVertexUvs[0];f=D[f*2+1];var n=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,
|
|
|
-f));p.push(new THREE.UV(n,h));o.push(p)}var z=this,x=0,w,A=[],D=[],B,E,I,G,K,C,F,J,M,N,L,O,H,Q,P,T,X,R,S,W,U,Z,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+
|
|
|
-8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;K=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;
|
|
|
-J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;L=w.vertex_index_bytes*4+w.material_index_bytes;O=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;P=w.uv_index_bytes;T=w.uv_index_bytes*2;X=w.uv_index_bytes;R=w.uv_index_bytes*2;S=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes*
|
|
|
-4+w.material_index_bytes;W=w.ntri_flat*b;U=w.ntri_smooth*(b+w.normal_index_bytes*3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;b=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);x+=function(b){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+w.vertex_coordinate_bytes),g=c(a,b+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
|
|
|
-h,g)));return w.nvertices*k}(x);x+=function(b){for(var c,e,f,h=w.normal_coordinate_bytes*3,g=b+w.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),f=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return w.nnormals*h}(x);x+=function(b){for(var e,h,g=w.uv_coordinate_bytes*2,k=b+w.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*g}(x);W=x+W;U=W+U;Z=U+Z;Y=Z+Y;$=Y+$;b=$+b;V=b+V;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,
|
|
|
-e=c+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),y(b+c);return f-a})(U);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(b=a;b<f;b+=e)p(b),y(b+c);return f-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),t(b+c);return f-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
|
|
|
-4,e=c+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),t(b+c);return f-a})(V);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)p(b);return e-a})(W);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(Y);(function(a){var b,
|
|
|
-c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)v(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){U=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",t,"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=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ia[a]):Y=null;Z=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)Z.add(h(Y.nodes[a]));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=U.evaluate(a,U,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,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
|
|
|
-for(f=0;f<g.frames;f++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(c,t,f);k=t;l=h.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var y=0;y<l.weights[v].length;y++){var w=l.weights[v][y];w.joint==p&&m.weights.push(w)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
-m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+f,vertices:u})}}}function h(a){var 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 y;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 y,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new y,l.url=k.morph.source,l.instance_material=a.controllers[f].instance_material,a.geometries.push(l),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
|
|
|
-0;f<a.geometries.length;f++){var k=a.geometries[f],l=k.instance_material,k=ba[k.url],m={},o=0,n;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=
|
|
|
-k.faces[j],o.materials=[m[o.daeMaterial]]}if(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;o=e instanceof u?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var t=ba[o.targets[p]];if(t.mesh&&t.mesh.primitives&&t.mesh.primitives.length)t=t.mesh.primitives[0].geometry,t.vertices.length===
|
|
|
-m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:t.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);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 p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function u(){this.url=
|
|
|
-"";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function t(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic=
|
|
|
-"";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
|
|
|
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function O(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function H(a){var b=a.getAttribute("id");
|
|
|
-if(V[b]!=void 0)return V[b];V[b]=(new E(b)).parse(a);return V[b]}function Q(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function P(a){for(var a=X(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function T(a){for(var a=X(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function X(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function R(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function S(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 W(a,b){var c="";c+=S(a.x,b)+",";c+=S(a.y,b)+",";c+=S(a.z,b);return c}var U=null,Z=null,Y,$=null,V={},fa={},ca={},aa={},ba={},ga={},ha={},ia,ja,da,ea,ka=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var 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 B).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=P(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);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 B).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 B).parse(g));break;case "v":c=T(g.textContent);break;case "vcount":e=T(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var o={},n=0;n<f.length;n++){var p=f[n],t=c[g+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=b[p.source].data[t]}}l.push(o);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};n.prototype.getChildById=function(a,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 u).parse(b));break;case "instance_geometry":this.geometries.push((new y).parse(b));break;case "instance_light":break;case "instance_node":b=
|
|
|
-b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,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 p).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)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=P(a.textContent);this.updateMatrix();return this};p.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
|
|
|
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var 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=U.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new v).parse(e)),e=c.iterateNext()}}return this};v.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(a){this.url=
|
|
|
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new v).parse(b)),b=a.iterateNext();break}}return this};t.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 z(this)).parse(c)}}return this};z.prototype.parse=function(a){function b(a,c){var e=W(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 w).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var f=
|
|
|
-{};this.geometry3js=new THREE.Geometry;e=V[this.vertices.input.POSITION.source].data;for(a=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};z.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[n++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=k[h],source=V[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=W(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],
|
|
|
-source.data[o+1],source.data[o+2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var x;p==3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;b.faces.push(x);for(h=0;h<t.length;h++)f=
|
|
|
-y[t[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=R(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));
|
|
|
-break;case "vcount":this.vcount=T(c.textContent);break;case "p":this.p=T(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=R(a,"count",0);this.stride=R(a,"stride",0);for(var 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 B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=R(a,"set",-1);this.offset=R(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
|
|
|
-X(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=P(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=X(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=P(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=U.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)};C.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 C(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 O(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};O.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 B).parse(c))}}return this};
|
|
|
-O.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=this,g;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),g=a,a=g.model,c=g.callback,b=g.texture_path;g=new Worker(a);b=b?b:this.extractUrlbase(a);g.onmessage=function(a){e.createModel(a.data,c,b);e.onLoadComplete()};this.onLoadStart();g.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(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,p,u,v,y,t,z,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=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;)p=new THREE.Vertex,p.position.x=o[m++]*b,p.position.y=
|
|
|
-o[m++]*b,p.position.z=o[m++]*b,e.vertices.push(p);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;u=b&16;p=b&32;y=b&64;b&=128;o?(t=new THREE.Face4,t.a=A[m++],t.b=A[m++],t.c=A[m++],t.d=A[m++],o=4):(t=new THREE.Face3,t.a=A[m++],t.b=A[m++],t.c=A[m++],o=3);if(l)l=A[m++],t.materials=e.materials[l];l=e.faces.length;if(c)for(c=0;c<E;c++)z=a.uvs[c],v=A[m++],w=z[v*2],v=z[v*2+1],e.faceUvs[c][l]=new THREE.UV(w,v);if(g)for(c=0;c<E;c++){z=a.uvs[c];x=[];for(g=0;g<o;g++)v=A[m++],w=z[v*2],v=z[v*2+1],x[g]=
|
|
|
-new THREE.UV(w,v);e.faceVertexUvs[c][l]=x}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],t.normal=g;if(p)for(c=0;c<o;c++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],t.vertexNormals.push(g);if(y)p=A[m++],p=new THREE.Color(B[p]),t.color=p;if(b)for(c=0;c<o;c++)p=A[m++],p=new THREE.Color(B[p]),t.vertexColors.push(p);e.faces.push(t)}}})(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,p,u,v;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=[];u=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;l=0;for(m=v.length;l<m;l+=3)n=v[l]*b,o=v[l+1]*
|
|
|
-b,p=v[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(n,o,p)))}}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,e){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,e=f.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),f=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(f)};
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,f,h){var g=new XMLHttpRequest,k=e+"/"+a,l=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+g.status+"]"):g.readyState==3?h&&(l==0&&(l=g.getResponseHeader("Content-Length")),h({total:l,loaded:g.responseText.length})):g.readyState==2&&(l=g.getResponseHeader("Content-Length"))};g.open("GET",k,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var f=function(b){function c(a,b){var e=n(a,b),g=n(a,b+1),f=n(a,b+2),h=n(a,b+3),k=(h<<1&255|f>>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function f(a,b){var c=n(a,b),e=n(a,b+1),g=n(a,b+2);return(n(a,b+3)<<24)+(g<<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,g;c=f(a,b);e=f(a,b+B);g=f(a,b+E);b=l(a,b+I);y.faces.push(new THREE.Face3(c,e,g,null,null,b))}function u(b){var c,e,g,h,m,n,o;c=f(a,b);e=f(a,b+B);g=f(a,b+E);h=l(a,b+I);m=f(a,b+G);n=f(a,b+L);o=f(a,b+C);var b=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[o*3],u=A[o*3+1];o=A[o*3+2];y.faces.push(new THREE.Face3(c,e,g,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(b,p,n),new THREE.Vector3(t,u,o)],null,h))}function t(b){var c,e,g,h;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);b=l(a,b+N);y.faces.push(new THREE.Face4(c,
|
|
|
+e,g,h,null,null,b))}function z(b){var c,e,g,h,m,n,o,p,t;c=f(a,b);e=f(a,b+F);g=f(a,b+J);h=f(a,b+M);m=l(a,b+N);n=f(a,b+K);o=f(a,b+P);p=f(a,b+H);t=f(a,b+Q);var b=A[o*3],u=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[t*3],v=A[t*3+1];t=A[t*3+2];y.faces.push(new THREE.Face4(c,e,g,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(b,u,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(na,v,t)],null,m))}function v(b){var c,e,g,h;c=f(a,b);e=f(a,b+O);g=f(a,b+R);b=D[c*2];h=D[c*
|
|
|
+2+1];c=D[e*2];var l=y.faceVertexUvs[0];e=D[e*2+1];var m=D[g*2];g=D[g*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(m,g));l.push(o)}function p(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+U);g=f(a,b+S);h=f(a,b+T);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[g*2];var o=y.faceVertexUvs[0];g=D[g*2+1];var n=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,g));p.push(new THREE.UV(n,h));o.push(p)}var y=this,x=0,w,A=[],D=[],
|
|
|
+B,E,I,G,L,C,F,J,M,N,K,P,H,Q,O,R,U,S,T,X,V,Z,Y,$,W;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);w={signature:a.substr(x,8),header_bytes:n(a,x+8),vertex_coordinate_bytes:n(a,x+9),normal_coordinate_bytes:n(a,x+10),uv_coordinate_bytes:n(a,x+11),vertex_index_bytes:n(a,x+12),normal_index_bytes:n(a,x+13),uv_index_bytes:n(a,x+14),material_index_bytes:n(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,
|
|
|
+x+16+20),ntri_smooth_uv:f(a,x+16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;L=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;J=w.vertex_index_bytes*2;M=w.vertex_index_bytes*3;N=w.vertex_index_bytes*
|
|
|
+4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;Q=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;R=w.uv_index_bytes*2;U=w.uv_index_bytes;S=w.uv_index_bytes*2;T=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;W=w.vertex_index_bytes*4+w.material_index_bytes;X=w.ntri_flat*b;V=w.ntri_smooth*(b+w.normal_index_bytes*
|
|
|
+3);Z=w.ntri_flat_uv*(b+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*W;b=w.nquad_smooth*(W+w.normal_index_bytes*4);W=w.nquad_flat_uv*(W+w.uv_index_bytes*4);x+=function(b){for(var e,f,h,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),f=c(a,b+w.vertex_coordinate_bytes),h=c(a,b+w.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,h)));return w.nvertices*k}(x);x+=function(b){for(var c,e,g,f=w.normal_coordinate_bytes*
|
|
|
+3,h=b+w.nnormals*f;b<h;b+=f)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),g=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,g/127);return w.nnormals*f}(x);x+=function(b){for(var e,f,h=w.uv_coordinate_bytes*2,k=b+w.nuvs*h;b<k;b+=h)e=c(a,b),f=c(a,b+w.uv_coordinate_bytes),D.push(e,f);return w.nuvs*h}(x);X=x+X;V=X+V;Z=V+Z;Y=Z+Y;$=Y+$;b=$+b;W=b+W;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=c+w.uv_index_bytes*3,g=a+w.ntri_flat_uv*e;for(b=a;b<g;b+=e)o(b),v(b+c);return g-a})(V);
|
|
|
+(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,g=a+w.ntri_smooth_uv*e;for(b=a;b<g;b+=e)u(b),v(b+c);return g-a})(Z);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,g=a+w.nquad_flat_uv*e;for(b=a;b<g;b+=e)t(b),p(b+c);return g-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=c+w.uv_index_bytes*4,g=a+w.nquad_smooth_uv*e;for(b=a;b<g;b+=e)z(b),p(b+
|
|
|
+c);return g-a})(W);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)u(b);return e-a})(X);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)t(b);return e-a})(Y);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
|
|
|
+4,e=a+w.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()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,f){V=a;e=e||$;f!==void 0&&(a=f.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");fa=c("//dae:library_images/dae:image",g,"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",p,"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={},g=a.iterateNext(),f=0;g;){g=(new b).parse(g);if(g.id.length==0)g.id=c+f++;e[g.id]=g;g=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var g=ca[e],f=0;f<g.sampler.length;f++){var h=g.sampler[f];h.create();a=Math.min(a,h.startTime);b=Math.max(b,h.endTime);c=Math.max(c,h.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,g){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
|
|
|
+f instanceof THREE.Matrix4&&a.world.copy(f)}g&&a.world.multiply(g,a.world);b.push(a);for(g=0;g<a.nodes.length;g++)e(a.nodes[g],b,c,a.world)}function f(a,c,g){var f=aa[c.url];if(!f||!f.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 h=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),k,l,m,o,n=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);
|
|
|
+for(g=0;g<h.frames;g++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));e(c,t,g);k=t;l=f.skin;for(o=0;o<k.length;o++)if(m=k[o],p=-1,m.type=="JOINT"){for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v<l.weights.length;v++)for(var w=0;w<l.weights[v].length;w++){var x=l.weights[v][w];x.joint==p&&m.weights.push(x)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
+m.sid+"'.";}for(k=0;k<t.length;k++)if(t[k].type=="JOINT")for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],o=m.index,m=m.weight,p=a.vertices[o],o=u[o],n.x=p.position.x,n.y=p.position.y,n.z=p.position.z,t[k].skinningMatrix.multiplyVector3(n),o.position.x+=n.x*m,o.position.y+=n.y*m,o.position.z+=n.z*m;a.morphTargets.push({name:"target_"+g,vertices:u})}}}function h(a){var b=new THREE.Object3D,c,e,g;b.name=a.id||"";b.matrixAutoUpdate=!1;b.matrix=a.matrix;for(g=0;g<a.controllers.length;g++){var k=aa[a.controllers[g].url];
|
|
|
+switch(k.type){case "skin":if(ba[k.skin.source]){var l=new v;l.url=k.skin.source;l.instance_material=a.controllers[g].instance_material;a.geometries.push(l);c=a.controllers[g]}else if(aa[k.skin.source]&&(e=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new v,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=new v,l.url=k.morph.source,l.instance_material=a.controllers[g].instance_material,a.geometries.push(l),
|
|
|
+e=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var k=a.geometries[g],l=k.instance_material,k=ba[k.url],m={},o=0,n;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++){n=l[j];var p=ha[ga[n.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;n=m[n.symbol]=p.material;o++}l=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});
|
|
|
+k=k.mesh.geometry3js;if(o>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)o=k.faces[j],o.materials=[m[o.daeMaterial]]}if(c!==void 0)f(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;o=e instanceof t?aa[e.url]:e;if(!o||!o.morph)console.log("could not find morph controller!");else{o=o.morph;for(p=0;p<o.targets.length;p++){var u=ba[o.targets[p]];if(u.mesh&&
|
|
|
+u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);b.add(l)}}for(g=0;g<a.nodes.length;g++)b.add(h(a.nodes[g],a));return b}function g(){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 t(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input=
|
|
|
+{}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function L(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function F(a){this.effect=a;this.mipfilter=this.magfilter=
|
|
|
+this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function K(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;g.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 g=a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "source":g=(new E).parse(g);b[g.id]=g;break;case "targets":c=this.parseInputs(g);break;default:console.log(g.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],g=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=g.read();break;case "MORPH_WEIGHT":this.weights=g.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 B).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 g=0;g<a.childNodes.length;g++){var f=a.childNodes[g];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=O(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],
|
|
|
+f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new E).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.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 B).parse(e),g=b[e.source];if(e.semantic=="JOINT")this.joints=g.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
|
|
|
+g.read()}}};m.prototype.parseWeights=function(a,b){for(var c,e,g=[],f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":g.push((new B).parse(h));break;case "v":c=R(h.textContent);break;case "vcount":e=R(h.textContent)}}for(f=h=0;f<e.length;f++){for(var k=e[f],l=[],m=0;m<k;m++){for(var o={},n=0;n<g.length;n++){var p=g[n],t=c[h+p.offset];switch(p.semantic){case "JOINT":o.joint=t;break;case "WEIGHT":o.weight=b[p.source].data[t]}}l.push(o);h+=g.length}for(m=
|
|
|
+0;m<l.length;m++)l[m].index=f;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 g=e.shift(),f=g.indexOf(".")>=0,h=g.indexOf("(")>=0,k;if(f)e=g.split("."),g=e.shift(),e.shift();else if(h){k=g.split("(");g=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}if(g==a)return c.info={sid:g,dotSyntax:f,arrSyntax:h,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 t).parse(b));
|
|
|
+break;case "instance_geometry":this.geometries.push((new v).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 g=ca[e],f=0;f<g.channel.length;f++){var h=g.channel[f],k=g.sampler[f];e=h.target.split("/")[0];if(e==this.id)k.create(),h.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(h)}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 g={},l=f=void 0,f=0;f<this.channels.length;f++)l=this.channels[f],g[l.sid]=l;h=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(k=this.transforms[f],l=g[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}h=n!==void 0?n instanceof THREE.Matrix4?h.multiply(h,n):h.multiply(h,k.matrix):h.multiply(h,k.matrix)}else h=h.multiply(h,k.matrix);b=h;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};t.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};v.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};
|
|
|
+p.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 y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,c){var e=X(a.position);g[e]===void 0&&(g[e]={v:a,index:c});return g[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 w).parse(e));
|
|
|
+break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(e))}}var g={};this.geometry3js=new THREE.Geometry;e=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,
|
|
|
+g);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(a,b,c){var e=0,g,f,h=a.p,k=a.inputs,l,m,o,n=0,p=3,t=[];for(g=0;g<k.length;g++)switch(l=k[g],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<h.length;){var u=[],v=[],w={},x=[];a.vcount&&(p=a.vcount[n++]);for(g=0;g<p;g++)for(f=0;f<k.length;f++)switch(l=k[f],source=W[l.source],m=h[e+g*k.length+l.offset],
|
|
|
+numParams=source.accessor.params.length,o=m*numParams,l.semantic){case "VERTEX":l=X(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":w[l.set]===void 0&&(w[l.set]=[]);w[l.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":x.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var z;p==3?z=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],
|
|
|
+x.length?x:new THREE.Color):p==4&&(z=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],x.length?x:new THREE.Color));z.daeMaterial=a.material;b.faces.push(z);for(f=0;f<t.length;f++)g=w[t[f]],b.faceVertexUvs[f].push([g[0],g[1],g[2]]);e+=k.length*p}};x.prototype=new w;x.prototype.constructor=x;w.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};w.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 B).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 B).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=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+/),g=[],f=0;f<e.length;f++)g.push(e[f]=="true"||e[f]=="1"?!0:!1);this.data=g;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};L.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 g=e.iterateNext(),f=[];g;)f.push(g),g=e.iterateNext();e=f;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};L.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)};C.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 C(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 L(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 K(this)).parse(c))}}return this};K.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,g,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){g=a.split("(");a=g.shift();for(b=0;b<g.length;b++)g[b]=
|
|
|
+parseInt(g[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=g;this.member=f;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 B).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:f,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,f=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){f.createModel(a.data,c,b);f.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=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,f,l,m,n,o,u,t,z,v,p,y,x,w,A=a.faces;o=a.vertices;var D=a.normals,B=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;f=b&8;t=b&16;u=b&32;v=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)y=a.uvs[c],z=A[m++],w=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(w,z);if(f)for(c=0;c<E;c++){y=a.uvs[c];x=[];for(f=0;f<o;f++)z=A[m++],w=y[z*2],z=y[z*2+1],x[f]=new THREE.UV(w,
|
|
|
+z);e.faceVertexUvs[c][l]=x}if(t)t=A[m++]*3,f=new THREE.Vector3,f.x=D[t++],f.y=D[t++],f.z=D[t],p.normal=f;if(u)for(c=0;c<o;c++)t=A[m++]*3,f=new THREE.Vector3,f.x=D[t++],f.y=D[t++],f.z=D[t],p.vertexNormals.push(f);if(v)u=A[m++],u=new THREE.Color(B[u]),p.color=u;if(b)for(c=0;c<o;c++)u=A[m++],u=new THREE.Color(B[u]),p.vertexColors.push(u);e.faces.push(p)}}})(f);(function(){var b,c,f,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
|
|
|
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,l,m,n,o,u,t,z;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];t=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,t.push(new THREE.Vertex(new THREE.Vector3(n,o,u)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;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)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(a,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(u in F.objects)if(!H.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;K=[];for(P=0;P<x.materials.length;P++)K[P]=H.materials[x.materials[P]],a=K[P]instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;
|
|
|
-q=x.quaternion;s=x.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,K);object.name=u;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));
|
|
|
-if(x.castsShadow)a=new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
-s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[u]=object,H.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}function l(a){return function(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:O,loadedModels:L-M,loadedTextures:O-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,p,
|
|
|
-u,v,y,t,z,x,w,A,D,B,E,I,G,K,C,F,J,M,N,L,O,H;F=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=M=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],
|
|
|
-A[1],A[2]);Q&&H.scene.scale.set(Q[0],Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(y in F.cameras)A=F.cameras[y],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[y]=E;for(v in F.lights)y=F.lights[v],E=y.color!==void 0?y.color:
|
|
|
-16777215,A=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(w=y.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):y.type=="point"?(w=y.position,d=y.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[v]=C;for(t in F.fogs)v=F.fogs[t],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,v.density)),A=v.color,I.color.setRGB(A[0],
|
|
|
-A[1],A[2]),H.fogs[t]=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(t=F.geometries[o],t.type=="bin_mesh"||t.type=="ascii_mesh")M+=1,b.onLoadStart();L=M;for(o in F.geometries)t=F.geometries[o],t.type=="cube"?(B=new THREE.CubeGeometry(t.width,t.height,t.depth,t.segmentsWidth,
|
|
|
-t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides),H.geometries[o]=B):t.type=="plane"?(B=new THREE.PlaneGeometry(t.width,t.height,t.segmentsWidth,t.segmentsHeight),H.geometries[o]=B):t.type=="sphere"?(B=new THREE.SphereGeometry(t.radius,t.segmentsWidth,t.segmentsHeight),H.geometries[o]=B):t.type=="cylinder"?(B=new THREE.CylinderGeometry(t.topRad,t.botRad,t.height,t.radSegs,t.heightSegs),H.geometries[o]=B):t.type=="torus"?(B=new THREE.TorusGeometry(t.radius,t.tube,t.segmentsR,t.segmentsT),H.geometries[o]=
|
|
|
-B):t.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(t.subdivisions),H.geometries[o]=B):t.type=="bin_mesh"?G.load({model:e(t.url,F.urlBaseType),callback:l(o)}):t.type=="ascii_mesh"?J.load({model:e(t.url,F.urlBaseType),callback:l(o)}):t.type=="embedded_mesh"&&(t=F.embeds[t.id])&&J.createModel(t,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(G=0;G<o.url.length;G++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(z in F.textures){o=F.textures[z];if(o.mapping!=
|
|
|
-void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){G=[];for(var P=0;P<o.url.length;P++)G[P]=e(o.url[P],F.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,o.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)G.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)G.magFilter=THREE[o.magFilter];if(o.repeat){G.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=
|
|
|
-1)G.wrapT=THREE.RepeatWrapping}o.offset&&G.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)G.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)G.wrapT=J[o.wrap[1]]}}H.textures[z]=G}for(p in F.materials){z=F.materials[p];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=H.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;
|
|
|
-else if(D=="blending")z.parameters[D]=THREE[z.parameters[D]]?THREE[z.parameters[D]]:THREE.NormalBlending;else if(D=="combine")z.parameters[D]=z.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(z.parameters[D]=="face")z.parameters[D]=THREE.FaceColors;else if(z.parameters[D])z.parameters[D]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;
|
|
|
-a=THREE.UniformsUtils.clone(o.uniforms);G=z.parameters.color;J=z.parameters.specular;t=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=H.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=H.textures[z.parameters.specularMap],
|
|
|
-a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(t);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);H.materials[p]=z}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){var c=new XMLHttpRequest,b=a.model,e=a.callback,g=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,f=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,e,g,h,f,k):alert("Couldn't load ["+b+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",b,!0);c.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,t,z=a.length;l<z;l+=f)m=a[l],n=a[l+1],t=a[l+2],m=m/16383*b,n=n/16383*b,t=t/16383*b,m+=e,n+=g,t+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,t)))})(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,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],K=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,K,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
|
|
|
-1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function k(){for(t in F.objects)if(!H.objects[t])if(x=F.objects[t],x.geometry!==void 0){if(B=H.geometries[x.geometry]){var a=!1;for(O=0;O<x.materials.length;O++)L=H.materials[x.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;q=x.quaternion;
|
|
|
+s=x.scale;q=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);object=new THREE.Mesh(B,L);object.name=t;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;H.scene.add(object);H.objects[t]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),H.scene.collisions.colliders.push(a));if(x.castsShadow)a=
|
|
|
+new THREE.ShadowVolume(B),H.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},H.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
+x.visible!==void 0?x.visible:!1,H.scene.add(object),H.objects[t]=object,H.empties[t]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},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:K,totalTextures:P,loadedModels:K-M,loadedTextures:P-N},H);b.onLoadProgress();M==0&&N==0&&c(H)}var o,u,t,z,v,p,y,x,w,A,D,B,E,I,G,
|
|
|
+L,C,F,J,M,N,K,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(t in F.objects)if(x=F.objects[t],x.meshCollider){a=!0;break}if(a)H.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var Q=F.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);A&&H.scene.rotation.set(A[0],A[1],A[2]);Q&&H.scene.scale.set(Q[0],
|
|
|
+Q[1],Q[2]);(a||A||Q)&&H.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(v in F.cameras)A=F.cameras[v],A.type=="perspective"?E=new THREE.PerspectiveCamera(A.fov,A.aspect,A.near,A.far):A.type=="ortho"&&(E=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),w=A.position,A=A.target,E.position.set(w[0],w[1],w[2]),E.target=new THREE.Vector3(A[0],A[1],A[2]),H.cameras[v]=E;for(z in F.lights)v=F.lights[z],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:
|
|
|
+1,v.type=="directional"?(w=v.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(C=new THREE.AmbientLight(E)),H.scene.add(C),H.lights[z]=C;for(p in F.fogs)z=F.fogs[p],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[p]=I;if(H.cameras&&
|
|
|
+F.defaults.camera)H.currentCamera=H.cameras[F.defaults.camera];if(H.fogs&&F.defaults.fog)H.scene.fog=H.fogs[F.defaults.fog];A=F.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(A[0],A[1],A[2]);H.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")M+=1,b.onLoadStart();K=M;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,
|
|
|
+null,p.flipped,p.sides),H.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),H.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),H.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),H.geometries[o]=B):p.type=="icosahedron"?
|
|
|
+(B=new THREE.IcosahedronGeometry(p.subdivisions),H.geometries[o]=B):p.type=="bin_mesh"?G.load(e(p.url,F.urlBaseType),l(o)):p.type=="ascii_mesh"?J.load(e(p.url,F.urlBaseType),l(o)):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(y in F.textures)if(o=F.textures[y],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(y in F.textures){o=F.textures[y];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[y]=G}for(u in F.materials){y=F.materials[u];for(D in y.parameters)if(D=="envMap"||D=="map"||D=="lightMap")y.parameters[D]=H.textures[y.parameters[D]];else if(D=="shading")y.parameters[D]=y.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")y.parameters[D]=THREE[y.parameters[D]]?
|
|
|
+THREE[y.parameters[D]]:THREE.NormalBlending;else if(D=="combine")y.parameters[D]=y.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(y.parameters[D]=="face")y.parameters[D]=THREE.FaceColors;else if(y.parameters[D])y.parameters[D]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);G=y.parameters.color;
|
|
|
+J=y.parameters.specular;p=y.parameters.ambient;I=y.parameters.shininess;a.tNormal.texture=H.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=H.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);
|
|
|
+a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);H.materials[u]=y}k();b.callbackSync(H)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
+THREE.UTF8Loader.prototype.load=function(a,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,f=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,g=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,f,h,g,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,f=0;f<8;f++){for(var h=0,g=0;g<c;++g){var k=a.charCodeAt(g+e);h+=k>>1^-(k&1);b[8*g+f]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(f=g=0;f<c;f++)k=a.charCodeAt(f+e),h[f]=g-k,k==0&&g++;return[b,h]};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,f,h){var g=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,g,l){for(var m,n,p,y=a.length;l<y;l+=g)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=f,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(g[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)})(g[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)})(g[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],G=m[B*3],L=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(G,L,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=n[e*2];e=n[e*2+
|
|
|
+1];l=n[f*2];x=n[f*2+1];w=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g)};
|
|
|
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,p=l+this.zd,u=h+this.yd+this.zd,v=l+this.yd+this.zd,y=0,t=this.field[h],z=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[p],B=this.field[u],E=this.field[v];t<f&&(y|=1);z<f&&(y|=2);x<f&&(y|=8);w<f&&(y|=4);A<f&&(y|=16);D<f&&(y|=32);B<f&&(y|=128);E<f&&(y|=64);var I=THREE.edgeTable[y];if(I==0)return 0;var G=this.delta,
|
|
|
-K=a+G,C=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,t,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,K,c,g,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,t,x));I&16&&(this.compNorm(n),this.compNorm(p),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,G,A,D));I&32&&(this.compNorm(p),
|
|
|
-this.compNorm(v),this.VIntY(p*3,this.vlist,this.nlist,15,f,K,c,G,D,E));I&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,t,A));I&512&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,27,f,K,c,g,z,D));I&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
|
|
|
-3,this.vlist,this.nlist,30,f,K,C,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,x,B));y<<=4;for(f=h=0;THREE.triTable[y+f]!=-1;)a=y+f,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 p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
|
|
|
-1);for(var v,y,t,z,x,w;o<l;o++){n=this.size2*o;y=o/this.size-g;x=y*y;for(y=p;y<m;y++){t=n+this.size*y;v=y/this.size-c;w=v*v;for(v=u;v<k;v++)z=v/this.size-a,z=h/(1.0E-6+z*z+w+x)-f,z>0&&(this.field[t+v]+=z)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,p=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(g=0;g<u;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++)p[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,l,m,n=this.size,o=this.yd,p=
|
|
|
-this.zd,u=this.field,v=n*Math.sqrt(a/c);v>n&&(v=n);for(h=0;h<v;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++)u[p*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,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<p;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<p;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,p,u;for(f=0;f<h.count;f++)p=f*3,n=p+1,u=p+2,k=h.positionArray[p],
|
|
|
-l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[p],l=h.normalArray[n],m=h.normalArray[u],p=new THREE.Vector3(k,l,m),p.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(p);nfaces=h.count/3;for(f=0;f<nfaces;f++)p=(a+f)*3,n=p+1,u=p+2,o=g[p],k=g[n],l=g[u],p=new THREE.Face3(p,n,u,[o,k,l]),c.faces.push(p);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,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k+g*this.delta;c[h+1]=l;c[h+2]=m;f[h]=this.lerp(n[a],n[a+3],g);f[h+1]=this.lerp(n[a+1],n[a+4],g);f[h+2]=this.lerp(n[a+2],n[a+5],g)};this.VIntY=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+g*this.delta;c[h+
|
|
|
+2]=m;c=a+this.yd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};this.VIntZ=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+g*this.delta;c=a+this.zd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};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,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,t=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[u],B=this.field[t],E=this.field[z];p<g&&(v|=1);y<g&&(v|=2);x<g&&(v|=8);w<g&&(v|=4);A<g&&(v|=16);D<g&&(v|=32);B<g&&(v|=128);E<g&&(v|=64);var I=THREE.edgeTable[v];if(I===0)return 0;
|
|
|
+var G=this.delta,L=a+G,C=c+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,c,f,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,L,c,f,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,c,f,p,x));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,c,G,A,D));
|
|
|
+I&32&&(this.compNorm(u),this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,g,L,c,G,D,E));I&64&&(this.compNorm(t),this.compNorm(z),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,c,f,p,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,g,L,c,f,y,D));I&1024&&(this.compNorm(o),
|
|
|
+this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,g,L,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));v<<=4;for(g=h=0;THREE.triTable[v+g]!=-1;)a=v+g,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,c,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+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[g];this.positionArray[l+7]=a[g+1];this.positionArray[l+8]=a[g+2];this.normalArray[l]=c[f];this.normalArray[l+1]=c[f+1];this.normalArray[l+2]=c[f+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[g];this.normalArray[l+7]=c[g+1];this.normalArray[l+8]=c[g+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,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*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 t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);
|
|
|
+k>this.size-1&&(k=this.size-1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-f;x=v*v;for(v=u;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=t;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-g,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,t=m*Math.sqrt(a/c);t>m&&(t=m);for(f=0;f<t;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)u[o*g+l]+=k}};this.addPlaneY=function(a,c){var f,h,g,k,
|
|
|
+l,m,n=this.size,o=this.yd,u=this.zd,t=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-c,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)t[u*g+m]+=k}}};this.addPlaneZ=function(a,c){var f,h,g,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(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-c,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=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,f,h,g,k,l,m,n,o,u=this.size-2;for(g=1;g<u;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<u;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,u,t;for(g=0;g<h.count;g++)u=
|
|
|
+g*3,n=u+1,t=u+2,k=h.positionArray[u],l=h.positionArray[n],m=h.positionArray[t],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[t],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),f.push(u);nfaces=h.count/3;for(g=0;g<nfaces;g++)u=(a+g)*3,n=u+1,t=u+2,o=f[u],k=f[n],l=f[t],u=new THREE.Face3(u,n,t,[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;
|
|
|
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]);
|
|
@@ -338,23 +338,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.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,f,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(f=this.colliders[c],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>h?this.hits.push(f):this.hits.unshift(f),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.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.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,f,h=0;h<c.numFaces;h++){var g=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[g.a].position,l=c.mesh.geometry.vertices[g.b].position,m=c.mesh.geometry.vertices[g.c].position,n=g instanceof THREE.Face4?c.mesh.geometry.vertices[g.d].position:null;g instanceof THREE.Face3?(g=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),g<e&&(e=g,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+g instanceof THREE.Face4&&(g=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),g<e&&(e=g,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),g=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),g<e&&(e=g,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,f,h,g){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(g.doubleSided||g.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;g=h.dot(c)-h.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=k*f))return Number.MAX_VALUE;g/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(g);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,f=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,f=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,f=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,f=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*f)*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 g};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);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.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,f=0,h=0,g=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,g=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,m=!1,g=1);b.origin.y<c.min.y?(f=c.min.y-b.origin.y,f/=b.direction.y,m=!1,k=-1):b.origin.y>c.max.y&&(f=c.max.y-b.origin.y,f/=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;f>e&&(m=1,e=f);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(g,0,0);break;case 1:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>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:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>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.__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);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;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,1,1,1E4);u.position.z=
|
|
|
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture: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 v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;p.width=a;p.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var z=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;f.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;z.n11=2*m/(D-x);z.n13=(D+x)/(D-x);g.projectionMatrix=z.clone();x=-A*l-w;D=A*l-w;z.n11=2*m/(D-x);z.n13=
|
|
|
-(D+x)/(D-x);h.projectionMatrix=z.clone()}g.matrix=b.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(b.position);g.near=m;g.far=b.far;e.call(c,a,g,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,p,!0);e.call(c,v,u)}};
|
|
|
-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);var c=this,b=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,g=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,1,1,1E4);t.position.z=
|
|
|
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:u}},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 z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;u.width=a;u.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var y=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(n*Math.PI/360),D;g.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;y.n11=2*m/(D-x);y.n13=(D+x)/(D-x);f.projectionMatrix=y.clone();x=-A*l-w;D=A*l-w;y.n11=2*m/(D-x);y.n13=
|
|
|
+(D+x)/(D-x);h.projectionMatrix=y.clone()}f.matrix=b.matrixWorld.clone().multiplySelf(k);f.update(null,!0);f.position.copy(b.position);f.near=m;f.far=b.far;e.call(c,a,f,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,u,!0);e.call(c,z,t)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,f,h,g=new THREE.PerspectiveCamera;g.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);f=a/2;h=e};this.render=function(a,b){this.clear();g.fov=b.fov;g.aspect=0.5*b.aspect;g.near=b.near;g.far=
|
|
|
+b.far;g.updateProjectionMatrix();g.position.copy(b.position);g.target.copy(b.target);g.translateX(c.separation);g.lookAt(g.target);k.projectionMatrix=g.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,f,h);e.call(c,a,g);this.setViewport(f,0,f,h);e.call(c,a,k,!1)}};
|