ThreeExtras.js 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // ThreeExtras.js r34 - http://github.com/mrdoob/three.js
  2. var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,f=a.vertices.length,h=b?d.geometry:d,c=a.vertices,e=h.vertices,g=a.faces,j=h.faces,m=a.uvs;h=h.uvs;b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,v=e.length;k<v;k++){var q=new THREE.Vertex(e[k].position.clone());b&&d.matrix.multiplyVector3(q.position);c.push(q)}k=0;for(v=j.length;k<v;k++){e=j[k];var n,p=e.vertexNormals;if(e instanceof THREE.Face3)n=new THREE.Face3(e.a+f,e.b+f,e.c+f);else e instanceof THREE.Face4&&(n=new THREE.Face4(e.a+
  3. f,e.b+f,e.c+f,e.d+f));n.centroid.copy(e.centroid);n.normal.copy(e.normal);b=0;for(c=p.length;b<c;b++){q=p[b];n.vertexNormals.push(q.clone())}n.materials=e.materials.slice();g.push(n)}k=0;for(v=h.length;k<v;k++){f=h[k];g=[];b=0;for(c=f.length;b<c;b++)g.push(new THREE.UV(f[b].u,f[b].v));m.push(g)}}},ImageUtils={loadTexture:function(a,d,b){var f=new Image,h=new THREE.Texture(f,d);f.onload=function(){h.needsUpdate=!0;b&&b(this)};f.src=a;return h},loadTextureCube:function(a,d,b){var f,h=[],c=new THREE.Texture(h,
  4. d);d=h.loadCount=0;for(f=a.length;d<f;++d){h[d]=new Image;h[d].onload=function(){h.loadCount+=1;if(h.loadCount==6)c.needsUpdate=!0;b&&b(this)};h[d].src=a[d]}return c}},SceneUtils={loadScene:function(a,d,b,f){a=new Worker(a);a.postMessage(0);a.onmessage=function(h){function c(){for(k in C.objects)if(!G.objects[k]){u=C.objects[k];if(l=G.geometries[u.geometry]){I=[];for(i=0;i<u.materials.length;i++)I[i]=G.materials[u.materials[i]];z=u.position;r=u.rotation;s=u.scale;object=new THREE.Mesh(l,I);object.position.set(z[0],
  5. z[1],z[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=u.visible;G.scene.addObject(object);G.objects[k]=object}}}function e(N){return function(M){G.geometries[N]=M;c();F-=1;g()}}function g(){f({total_models:K,total_textures:O,loaded_models:K-F,loaded_textures:O-J},G);F==0&&J==0&&b(G)}var j,m,k,v,q,n,p,u,z,w,x,l,D,A,I,C,E,F,J,K,O,G;C=h.data;E=new THREE.Loader;J=F=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
  6. fogs:{}};h=function(){J-=1;g()};for(q in C.cameras){w=C.cameras[q];if(w.type=="perspective")D=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){D=new THREE.Camera;D.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}z=w.position;w=w.target;D.position.set(z[0],z[1],z[2]);D.target.position.set(w[0],w[1],w[2]);G.cameras[q]=D}for(v in C.lights){q=C.lights[v];if(q.type=="directional"){z=q.direction;light=new THREE.DirectionalLight;light.position.set(z[0],
  7. z[1],z[2]);light.position.normalize()}else if(q.type=="point"){z=q.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}w=q.color;i=q.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);G.scene.addLight(light);G.lights[v]=light}for(n in C.fogs){v=C.fogs[n];if(v.type=="linear")A=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(A=new THREE.FogExp2(0,v.density));w=v.color;A.color.setRGB(w[0],w[1],w[2]);G.fogs[n]=A}if(G.cameras&&C.defaults.camera)G.currentCamera=G.cameras[C.defaults.camera];
  8. if(G.fogs&&C.defaults.fog)G.scene.fog=G.fogs[C.defaults.fog];w=C.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(w[0],w[1],w[2]);G.bgColorAlpha=C.defaults.bgalpha;for(j in C.geometries){n=C.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh")F+=1}K=F;for(j in C.geometries){n=C.geometries[j];if(n.type=="cube"){l=new Cube(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);G.geometries[j]=l}else if(n.type=="plane"){l=new Plane(n.width,
  9. n.height,n.segmentsWidth,n.segmentsHeight);G.geometries[j]=l}else if(n.type=="sphere"){l=new Sphere(n.radius,n.segmentsWidth,n.segmentsHeight);G.geometries[j]=l}else if(n.type=="cylinder"){l=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);G.geometries[j]=l}else if(n.type=="torus"){l=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);G.geometries[j]=l}else if(n.type=="icosahedron"){l=new Icosahedron(n.subdivisions);G.geometries[j]=l}else if(n.type=="bin_mesh")E.loadBinary({model:n.url,
  10. callback:e(j)});else n.type=="ascii_mesh"&&E.loadAscii({model:n.url,callback:e(j)})}for(p in C.textures){j=C.textures[p];J+=j.url instanceof Array?j.url.length:1}O=J;for(p in C.textures){j=C.textures[p];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)n=ImageUtils.loadTextureCube(j.url,j.mapping,h);else{n=ImageUtils.loadTexture(j.url,j.mapping,h);if(THREE[j.minFilter]!=undefined)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)n.magFilter=
  11. THREE[j.magFilter]}G.textures[p]=n}for(m in C.materials){p=C.materials[m];for(x in p.parameters)if(x=="envMap"||x=="map"||x=="lightMap")p.parameters[x]=G.textures[p.parameters[x]];else if(x=="shading")p.parameters[x]=p.parameters[x]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(x=="blending")p.parameters[x]=THREE[p.parameters[x]]?THREE[p.parameters[x]]:THREE.NormalBlending;else x=="combine"&&(p.parameters[x]=p.parameters[x]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);p=new THREE[p.type](p.parameters);
  12. G.materials[m]=p}c();d(G)}},addMesh:function(a,d,b,f,h,c,e,g,j,m){d=new THREE.Mesh(d,m);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=f;d.position.y=h;d.position.z=c;d.rotation.x=e;d.rotation.y=g;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new Cube(d,d,d,1,1,1,null,!0),b);a.addObject(d);
  13. return d},addPanoramaCube:function(a,d,b){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new Cube(d,d,d,1,1,f,!0),new THREE.MeshFaceMaterial);
  14. a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var f=d/2;d=new Plane(d,d);var h=Math.PI,c=Math.PI/2;SceneUtils.addMesh(a,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,d,1,-f,0,0,0,c,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,d,1,f,0,0,0,-c,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,d,1,0,f,0,c,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
  15. SceneUtils.addMesh(a,d,1,0,-f,0,-c,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))}},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}",
  16. 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}"},
  17. normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
  18. uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
  19. vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\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\n}"},
  20. cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},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;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
  21. value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
  22. film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
  23. screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
  24. fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,f,h,c=2*Math.ceil(a*3)+1;c>25&&(c=25);h=(c-1)*0.5;b=Array(c);for(d=f=0;d<c;++d){b[d]=Math.exp(-((d-h)*(d-h))/(2*a*a));f+=b[d]}for(d=0;d<c;++d)b[d]/=f;return b}},Cube=function(a,d,b,f,h,c,e,g,j){function m(z,w,x,l,D,A,I,C){var E,F,J=f||1,K=h||1,O=D/2,G=A/2,N=k.vertices.length;if(z=="x"&&w=="y"||z=="y"&&w=="x")E="z";else if(z=="x"&&w=="z"||z=="z"&&w=="x"){E="y";K=c||1}else if(z=="z"&&w=="y"||
  25. z=="y"&&w=="z"){E="x";J=c||1}var M=J+1,X=K+1;D/=J;var Y=A/K;for(F=0;F<X;F++)for(A=0;A<M;A++){var R=new THREE.Vector3;R[z]=(A*D-O)*x;R[w]=(F*Y-G)*l;R[E]=I;k.vertices.push(new THREE.Vertex(R))}for(F=0;F<K;F++)for(A=0;A<J;A++){k.faces.push(new THREE.Face4(A+M*F+N,A+M*(F+1)+N,A+1+M*(F+1)+N,A+1+M*F+N,null,C));k.uvs.push([new THREE.UV(A/J,F/K),new THREE.UV(A/J,(F+1)/K),new THREE.UV((A+1)/J,(F+1)/K),new THREE.UV((A+1)/J,F/K)])}}THREE.Geometry.call(this);var k=this,v=a/2,q=d/2,n=b/2;g=g?-1:1;if(e!==undefined)if(e instanceof
  26. Array)this.materials=e;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var u in j)this.sides[u]!=undefined&&(this.sides[u]=j[u]);this.sides.px&&m("z","y",1*g,-1,b,d,-v,this.materials[0]);this.sides.nx&&m("z","y",-1*g,-1,b,d,v,this.materials[1]);this.sides.py&&m("x","z",1*g,1,a,b,q,this.materials[2]);this.sides.ny&&m("x","z",1*g,-1,a,b,-q,this.materials[3]);this.sides.pz&&m("x","y",1*g,-1,
  27. a,d,n,this.materials[4]);this.sides.nz&&m("x","y",-1*g,-1,a,d,-n,this.materials[5]);(function(){for(var z=[],w=[],x=0,l=k.vertices.length;x<l;x++){for(var D=k.vertices[x],A=!1,I=0,C=z.length;I<C;I++){var E=z[I];if(D.position.x==E.position.x&&D.position.y==E.position.y&&D.position.z==E.position.z){w[x]=I;A=!0;break}}if(!A){w[x]=z.length;z.push(new THREE.Vertex(D.position.clone()))}}x=0;for(l=k.faces.length;x<l;x++){D=k.faces[x];D.a=w[D.a];D.b=w[D.b];D.c=w[D.c];D.d=w[D.d]}k.vertices=z})();this.computeCentroids();
  28. this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
  29. var Cylinder=function(a,d,b,f,h){function c(m,k,v){e.vertices.push(new THREE.Vertex(new THREE.Vector3(m,k,v)))}THREE.Geometry.call(this);var e=this,g=Math.PI,j;for(j=0;j<a;j++)c(Math.sin(2*g*j/a)*d,Math.cos(2*g*j/a)*d,0);for(j=0;j<a;j++)c(Math.sin(2*g*j/a)*b,Math.cos(2*g*j/a)*b,f);for(j=0;j<a;j++)e.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b!=0){c(0,0,-h);for(j=a;j<a+a/2;j++)e.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(d!=0){c(0,0,f+h);for(j=a+a/2;j<
  30. 2*a;j++)e.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
  31. var Plane=function(a,d,b,f){THREE.Geometry.call(this);var h,c=a/2,e=d/2;b=b||1;f=f||1;var g=b+1,j=f+1;a/=b;var m=d/f;for(h=0;h<j;h++)for(d=0;d<g;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-c,-(h*m-e),0)));for(h=0;h<f;h++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+g*h,d+g*(h+1),d+1+g*(h+1),d+1+g*h));this.uvs.push([new THREE.UV(d/b,h/f),new THREE.UV(d/b,(h+1)/f),new THREE.UV((d+1)/b,(h+1)/f),new THREE.UV((d+1)/b,h/f)])}this.computeCentroids();this.computeFaceNormals()};
  32. Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
  33. var Sphere=function(a,d,b){THREE.Geometry.call(this);var f,h=Math.PI,c=Math.max(3,d||8),e=Math.max(2,b||6);d=[];for(b=0;b<e+1;b++){f=b/e;var g=a*Math.cos(f*h),j=a*Math.sin(f*h),m=[],k=0;for(f=0;f<c;f++){var v=2*f/c,q=j*Math.sin(v*h);v=j*Math.cos(v*h);(b==0||b==e)&&f>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,g,q)))-1);m.push(k)}d.push(m)}var n,p,u;h=d.length;for(b=0;b<h;b++){c=d[b].length;if(b>0)for(f=0;f<c;f++){m=f==c-1;e=d[b][m?0:f+1];g=d[b][m?c-1:f];j=d[b-1][m?c-1:f];m=d[b-1][m?
  34. 0:f+1];q=b/(h-1);n=(b-1)/(h-1);p=(f+1)/c;v=f/c;k=new THREE.UV(1-p,q);q=new THREE.UV(1-v,q);v=new THREE.UV(1-v,n);var z=new THREE.UV(1-p,n);if(b<d.length-1){n=this.vertices[e].position.clone();p=this.vertices[g].position.clone();u=this.vertices[j].position.clone();n.normalize();p.normalize();u.normalize();this.faces.push(new THREE.Face3(e,g,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([k,q,v])}if(b>1){n=this.vertices[e].position.clone();
  35. p=this.vertices[j].position.clone();u=this.vertices[m].position.clone();n.normalize();p.normalize();u.normalize();this.faces.push(new THREE.Face3(e,j,m,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([k,v,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
  36. var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=f||6;a=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){f=b/this.segmentsT*2*Math.PI;var h=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(f),(this.radius+this.tube*Math.cos(h))*Math.sin(f),this.tube*Math.sin(h))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b=
  37. 1;b<=this.segmentsT;++b){f=(this.segmentsT+1)*d+b;h=(this.segmentsT+1)*d+b-1;var c=(this.segmentsT+1)*(d-1)+b-1,e=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(f,h,c,e));this.uvs.push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
  38. var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
  39. 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var g in c.faces){var j=f(c.faces[g].a,c.faces[g].b),m=f(c.faces[g].b,c.faces[g].c),k=f(c.faces[g].c,c.faces[g].a);b(c.faces[g].a,j,k,e);b(c.faces[g].b,m,j,e);b(c.faces[g].c,
  40. k,m,e);b(j,m,k,e)}c.faces=e.faces}h.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
  41. function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
  42. c[g]=this.vertices.length-1}else c=e;m==0&&(e=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(c[g],c[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(m/b,g/a.length),new THREE.UV(m/b,(g+1)/a.length),new THREE.UV((m-d)/b,(g+1)/a.length),new THREE.UV((m-d)/b,g/a.length)])}h=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
  43. if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
  44. THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;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=
  45. 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,f,h){return b+(f-b)*h};this.VIntX=function(b,f,h,c,e,g,j,m,k,v){e=(e-k)/(v-k);k=this.normal_cache;f[c]=g+e*this.delta;f[c+1]=j;f[c+2]=m;h[c]=this.lerp(k[b],k[b+3],e);h[c+1]=this.lerp(k[b+1],k[b+4],e);h[c+2]=this.lerp(k[b+2],k[b+5],e)};this.VIntY=function(b,f,h,c,e,g,j,m,k,v){e=(e-k)/(v-k);k=this.normal_cache;f[c]=g;f[c+1]=j+e*this.delta;f[c+
  46. 2]=m;f=b+this.yd*3;h[c]=this.lerp(k[b],k[f],e);h[c+1]=this.lerp(k[b+1],k[f+1],e);h[c+2]=this.lerp(k[b+2],k[f+2],e)};this.VIntZ=function(b,f,h,c,e,g,j,m,k,v){e=(e-k)/(v-k);k=this.normal_cache;f[c]=g;f[c+1]=j;f[c+2]=m+e*this.delta;f=b+this.zd*3;h[c]=this.lerp(k[b],k[f],e);h[c+1]=this.lerp(k[b+1],k[f+1],e);h[c+2]=this.lerp(k[b+2],k[f+2],e)};this.compNorm=function(b){var f=b*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[b-1]-this.field[b+1];this.normal_cache[f+1]=this.field[b-this.yd]-
  47. this.field[b+this.yd];this.normal_cache[f+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,f,h,c,e,g){var j=c+1,m=c+this.yd,k=c+this.zd,v=j+this.yd,q=j+this.zd,n=c+this.yd+this.zd,p=j+this.yd+this.zd,u=0,z=this.field[c],w=this.field[j],x=this.field[m],l=this.field[v],D=this.field[k],A=this.field[q],I=this.field[n],C=this.field[p];z<e&&(u|=1);w<e&&(u|=2);x<e&&(u|=8);l<e&&(u|=4);D<e&&(u|=16);A<e&&(u|=32);I<e&&(u|=128);C<e&&(u|=64);var E=THREE.edgeTable[u];if(E==0)return 0;
  48. var F=this.delta,J=b+F,K=f+F;F=h+F;if(E&1){this.compNorm(c);this.compNorm(j);this.VIntX(c*3,this.vlist,this.nlist,0,e,b,f,h,z,w)}if(E&2){this.compNorm(j);this.compNorm(v);this.VIntY(j*3,this.vlist,this.nlist,3,e,J,f,h,w,l)}if(E&4){this.compNorm(m);this.compNorm(v);this.VIntX(m*3,this.vlist,this.nlist,6,e,b,K,h,x,l)}if(E&8){this.compNorm(c);this.compNorm(m);this.VIntY(c*3,this.vlist,this.nlist,9,e,b,f,h,z,x)}if(E&16){this.compNorm(k);this.compNorm(q);this.VIntX(k*3,this.vlist,this.nlist,12,e,b,f,F,
  49. D,A)}if(E&32){this.compNorm(q);this.compNorm(p);this.VIntY(q*3,this.vlist,this.nlist,15,e,J,f,F,A,C)}if(E&64){this.compNorm(n);this.compNorm(p);this.VIntX(n*3,this.vlist,this.nlist,18,e,b,K,F,I,C)}if(E&128){this.compNorm(k);this.compNorm(n);this.VIntY(k*3,this.vlist,this.nlist,21,e,b,f,F,D,I)}if(E&256){this.compNorm(c);this.compNorm(k);this.VIntZ(c*3,this.vlist,this.nlist,24,e,b,f,h,z,D)}if(E&512){this.compNorm(j);this.compNorm(q);this.VIntZ(j*3,this.vlist,this.nlist,27,e,J,f,h,w,A)}if(E&1024){this.compNorm(v);
  50. this.compNorm(p);this.VIntZ(v*3,this.vlist,this.nlist,30,e,J,K,h,l,C)}if(E&2048){this.compNorm(m);this.compNorm(n);this.VIntZ(m*3,this.vlist,this.nlist,33,e,b,K,h,x,I)}u<<=4;for(e=c=0;THREE.triTable[u+e]!=-1;){b=u+e;f=b+1;h=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[f],3*THREE.triTable[h],g);e+=3;c++}return c};this.posnormtriv=function(b,f,h,c,e,g){var j=this.count*3;this.positionArray[j]=b[h];this.positionArray[j+1]=b[h+1];this.positionArray[j+2]=b[h+2];this.positionArray[j+
  51. 3]=b[c];this.positionArray[j+4]=b[c+1];this.positionArray[j+5]=b[c+2];this.positionArray[j+6]=b[e];this.positionArray[j+7]=b[e+1];this.positionArray[j+8]=b[e+2];this.normalArray[j]=f[h];this.normalArray[j+1]=f[h+1];this.normalArray[j+2]=f[h+2];this.normalArray[j+3]=f[c];this.normalArray[j+4]=f[c+1];this.normalArray[j+5]=f[c+2];this.normalArray[j+6]=f[e];this.normalArray[j+7]=f[e+1];this.normalArray[j+8]=f[e+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&g(this)};this.begin=
  52. function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;b(this)}};this.addBall=function(b,f,h,c,e){var g=this.size*Math.sqrt(c/e),j=h*this.size,m=f*this.size,k=b*this.size,v=Math.floor(j-g);v<1&&(v=1);j=Math.floor(j+g);j>this.size-1&&(j=this.size-1);var q=Math.floor(m-g);q<1&&(q=1);m=Math.floor(m+g);m>this.size-1&&(m=this.size-1);var n=Math.floor(k-g);n<1&&(n=1);g=Math.floor(k+g);
  53. g>this.size-1&&(g=this.size-1);for(var p,u,z,w,x,l;v<j;v++){k=this.size2*v;u=v/this.size-h;x=u*u;for(u=q;u<m;u++){z=k+this.size*u;p=u/this.size-f;l=p*p;for(p=n;p<g;p++){w=p/this.size-b;w=c/(1.0E-6+w*w+l+x)-e;w>0&&(this.field[z+p]+=w)}}}};this.addPlaneX=function(b,f){var h,c,e,g,j,m=this.size,k=this.yd,v=this.zd,q=this.field,n=m*Math.sqrt(b/f);n>m&&(n=m);for(h=0;h<n;h++){c=h/m;c*=c;g=b/(1.0E-4+c)-f;if(g>0)for(c=0;c<m;c++){j=h+c*k;for(e=0;e<m;e++)q[v*e+j]+=g}}};this.addPlaneY=function(b,f){var h,c,
  54. e,g,j,m,k=this.size,v=this.yd,q=this.zd,n=this.field,p=k*Math.sqrt(b/f);p>k&&(p=k);for(c=0;c<p;c++){h=c/k;h*=h;g=b/(1.0E-4+h)-f;if(g>0){j=c*v;for(h=0;h<k;h++){m=j+h;for(e=0;e<k;e++)n[q*e+m]+=g}}}};this.addPlaneZ=function(b,f){var h,c,e,g,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/f);dist>size&&(dist=size);for(e=0;e<dist;e++){h=e/size;h*=h;g=b/(1.0E-4+h)-f;if(g>0){j=zd*e;for(c=0;c<size;c++){m=j+c*yd;for(h=0;h<size;h++)field[m+h]+=g}}}};this.reset=function(){var b;
  55. for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var f,h,c,e,g,j,m,k,v,q=this.size-2;for(e=1;e<q;e++){v=this.size2*e;m=(e-this.halfsize)/this.halfsize;for(c=1;c<q;c++){k=v+this.size*c;j=(c-this.halfsize)/this.halfsize;for(h=1;h<q;h++){g=(h-this.halfsize)/this.halfsize;f=k+h;this.polygonize(g,j,m,f,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,f=new THREE.Geometry;this.render(function(h){var c,e,g,j,m,k,v,q;for(c=
  56. 0;c<h.count;c++){m=c*3;v=m+1;q=m+2;e=h.positionArray[m];g=h.positionArray[v];j=h.positionArray[q];k=new THREE.Vector3(e,g,j);e=h.normalArray[m];g=h.normalArray[v];j=h.normalArray[q];m=new THREE.Vector3(e,g,j);m.normalize();m=new THREE.Vertex(k,m);f.vertices.push(m)}nfaces=h.count/3;for(c=0;c<nfaces;c++){m=(b+c)*3;v=m+1;q=m+2;k=f.vertices[m].normal;e=f.vertices[v].normal;g=f.vertices[q].normal;m=new THREE.Face3(m,v,q,[k,e,g]);f.faces.push(m)}b+=nfaces;h.count=0});return f};this.init(a)};
  57. THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
  58. 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,
  59. 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,
  60. 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]);
  61. THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
  62. -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4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,-1,-1,-1,-1,-1,-1]);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
  82. THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var d="Loaded ";d+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
  83. d},loadAsciiOld:function(a,d){var b=document.createElement("script");b.type="text/javascript";b.onload=d;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var d=a.model,b=a.callback,f=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);d.onmessage=function(h){THREE.Loader.prototype.createModel(h.data,b,f)};d.postMessage(a)},loadBinary:function(a){var d=a.model,b=a.callback,f=a.texture_path?a.texture_path:
  84. THREE.Loader.prototype.extractUrlbase(d),h=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);var c=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(e){THREE.Loader.prototype.loadAjaxBuffers(e.data.buffers,e.data.materials,b,h,f,c)};d.onerror=function(e){alert("worker.onerror: "+e.message+"\n"+e.data);e.preventDefault()};d.postMessage(a)},loadAjaxBuffers:function(a,d,b,f,h,c){var e=new XMLHttpRequest,g=f+"/"+a,j=0;
  85. e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.Loader.prototype.createBinModel(e.responseText,b,h,d):alert("Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(c){j==0&&(j=e.getResponseHeader("Content-Length"));c({total:j,loaded:e.responseText.length})}}else e.readyState==2&&(j=e.getResponseHeader("Content-Length"))};e.open("GET",g,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)},
  86. createBinModel:function(a,d,b,f){var h=function(c){function e(o,t){var y=k(o,t),B=k(o,t+1),H=k(o,t+2),L=k(o,t+3),P=(L<<1&255|H>>7)-127;y|=(H&127)<<16|B<<8;if(y==0&&P==-127)return 0;return(1-2*(L>>7))*(1+y*Math.pow(2,-23))*Math.pow(2,P)}function g(o,t){var y=k(o,t),B=k(o,t+1),H=k(o,t+2);return(k(o,t+3)<<24)+(H<<16)+(B<<8)+y}function j(o,t){var y=k(o,t);return(k(o,t+1)<<8)+y}function m(o,t){var y=k(o,t);return y>127?y-256:y}function k(o,t){return o.charCodeAt(t)&255}function v(o){var t,y,B;t=g(a,o);
  87. y=g(a,o+I);B=g(a,o+C);o=j(a,o+E);THREE.Loader.prototype.f3(w,t,y,B,o)}function q(o){var t,y,B,H,L,P;t=g(a,o);y=g(a,o+I);B=g(a,o+C);H=j(a,o+E);L=g(a,o+F);P=g(a,o+J);o=g(a,o+K);THREE.Loader.prototype.f3n(w,D,t,y,B,H,L,P,o)}function n(o){var t,y,B,H;t=g(a,o);y=g(a,o+O);B=g(a,o+G);H=g(a,o+N);o=j(a,o+M);THREE.Loader.prototype.f4(w,t,y,B,H,o)}function p(o){var t,y,B,H,L,P,Z,$;t=g(a,o);y=g(a,o+O);B=g(a,o+G);H=g(a,o+N);L=j(a,o+M);P=g(a,o+X);Z=g(a,o+Y);$=g(a,o+R);o=g(a,o+aa);THREE.Loader.prototype.f4n(w,D,
  88. t,y,B,H,L,P,Z,$,o)}function u(o){var t,y;t=g(a,o);y=g(a,o+ba);o=g(a,o+ca);THREE.Loader.prototype.uv3(w.uvs,A[t*2],A[t*2+1],A[y*2],A[y*2+1],A[o*2],A[o*2+1])}function z(o){var t,y,B;t=g(a,o);y=g(a,o+da);B=g(a,o+ea);o=g(a,o+fa);THREE.Loader.prototype.uv4(w.uvs,A[t*2],A[t*2+1],A[y*2],A[y*2+1],A[B*2],A[B*2+1],A[o*2],A[o*2+1])}var w=this,x=0,l,D=[],A=[],I,C,E,F,J,K,O,G,N,M,X,Y,R,aa,ba,ca,da,ea,fa,S,T,U,V,W,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);l={signature:a.substr(x,
  89. 8),header_bytes:k(a,x+8),vertex_coordinate_bytes:k(a,x+9),normal_coordinate_bytes:k(a,x+10),uv_coordinate_bytes:k(a,x+11),vertex_index_bytes:k(a,x+12),normal_index_bytes:k(a,x+13),uv_index_bytes:k(a,x+14),material_index_bytes:k(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)};
  90. x+=l.header_bytes;I=l.vertex_index_bytes;C=l.vertex_index_bytes*2;E=l.vertex_index_bytes*3;F=l.vertex_index_bytes*3+l.material_index_bytes;J=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes;K=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*2;O=l.vertex_index_bytes;G=l.vertex_index_bytes*2;N=l.vertex_index_bytes*3;M=l.vertex_index_bytes*4;X=l.vertex_index_bytes*4+l.material_index_bytes;Y=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes;R=l.vertex_index_bytes*
  91. 4+l.material_index_bytes+l.normal_index_bytes*2;aa=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*3;ba=l.uv_index_bytes;ca=l.uv_index_bytes*2;da=l.uv_index_bytes;ea=l.uv_index_bytes*2;fa=l.uv_index_bytes*3;c=l.vertex_index_bytes*3+l.material_index_bytes;Q=l.vertex_index_bytes*4+l.material_index_bytes;S=l.ntri_flat*c;T=l.ntri_smooth*(c+l.normal_index_bytes*3);U=l.ntri_flat_uv*(c+l.uv_index_bytes*3);V=l.ntri_smooth_uv*(c+l.normal_index_bytes*3+l.uv_index_bytes*3);W=l.nquad_flat*
  92. Q;c=l.nquad_smooth*(Q+l.normal_index_bytes*4);Q=l.nquad_flat_uv*(Q+l.uv_index_bytes*4);x+=function(o){for(var t,y,B,H=l.vertex_coordinate_bytes*3,L=o+l.nvertices*H;o<L;o+=H){t=e(a,o);y=e(a,o+l.vertex_coordinate_bytes);B=e(a,o+l.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,t,y,B)}return l.nvertices*H}(x);x+=function(o){for(var t,y,B,H=l.normal_coordinate_bytes*3,L=o+l.nnormals*H;o<L;o+=H){t=m(a,o);y=m(a,o+l.normal_coordinate_bytes);B=m(a,o+l.normal_coordinate_bytes*2);D.push(t/127,y/127,B/
  93. 127)}return l.nnormals*H}(x);x+=function(o){for(var t,y,B=l.uv_coordinate_bytes*2,H=o+l.nuvs*B;o<H;o+=B){t=e(a,o);y=e(a,o+l.uv_coordinate_bytes);A.push(t,y)}return l.nuvs*B}(x);S=x+S;T=S+T;U=T+U;V=U+V;W=V+W;c=W+c;Q=c+Q;(function(o){var t,y=l.vertex_index_bytes*3+l.material_index_bytes,B=y+l.uv_index_bytes*3,H=o+l.ntri_flat_uv*B;for(t=o;t<H;t+=B){v(t);u(t+y)}return H-o})(T);(function(o){var t,y=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,B=y+l.uv_index_bytes*3,H=o+l.ntri_smooth_uv*
  94. B;for(t=o;t<H;t+=B){q(t);u(t+y)}return H-o})(U);(function(o){var t,y=l.vertex_index_bytes*4+l.material_index_bytes,B=y+l.uv_index_bytes*4,H=o+l.nquad_flat_uv*B;for(t=o;t<H;t+=B){n(t);z(t+y)}return H-o})(c);(function(o){var t,y=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*4,B=y+l.uv_index_bytes*4,H=o+l.nquad_smooth_uv*B;for(t=o;t<H;t+=B){p(t);z(t+y)}return H-o})(Q);(function(o){var t,y=l.vertex_index_bytes*3+l.material_index_bytes,B=o+l.ntri_flat*y;for(t=o;t<B;t+=y)v(t);return B-
  95. o})(x);(function(o){var t,y=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*3,B=o+l.ntri_smooth*y;for(t=o;t<B;t+=y)q(t);return B-o})(S);(function(o){var t,y=l.vertex_index_bytes*4+l.material_index_bytes,B=o+l.nquad_flat*y;for(t=o;t<B;t+=y)n(t);return B-o})(V);(function(o){var t,y=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*4,B=o+l.nquad_smooth*y;for(t=o;t<B;t+=y)p(t);return B-o})(W);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;
  96. h.prototype.constructor=h;d(new h(b))},createModel:function(a,d,b){var f=function(h){var c=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(c,a.materials,h);(function(){var e,g,j,m,k;e=0;for(g=a.vertices.length;e<g;e+=3){j=a.vertices[e];m=a.vertices[e+1];k=a.vertices[e+2];THREE.Loader.prototype.v(c,j,m,k)}if(a.colors){e=0;for(g=a.colors.length;e<g;e+=3){j=a.colors[e];m=a.colors[e+1];k=a.colors[e+2];THREE.Loader.prototype.vc(c,j,m,k)}}})();(function(){function e(p,u){THREE.Loader.prototype.f3(c,
  97. p[u],p[u+1],p[u+2],p[u+3])}function g(p,u){THREE.Loader.prototype.f3n(c,a.normals,p[u],p[u+1],p[u+2],p[u+3],p[u+4],p[u+5],p[u+6])}function j(p,u){THREE.Loader.prototype.f4(c,p[u],p[u+1],p[u+2],p[u+3],p[u+4])}function m(p,u){THREE.Loader.prototype.f4n(c,a.normals,p[u],p[u+1],p[u+2],p[u+3],p[u+4],p[u+5],p[u+6],p[u+7],p[u+8])}function k(p,u){var z,w,x,l,D,A,I,C,E;z=p[u];w=p[u+1];x=p[u+2];l=a.uvs[z*2];I=a.uvs[z*2+1];D=a.uvs[w*2];C=a.uvs[w*2+1];A=a.uvs[x*2];E=a.uvs[x*2+1];THREE.Loader.prototype.uv3(c.uvs,
  98. l,I,D,C,A,E);if(a.uvs2&&a.uvs2.length){l=a.uvs2[z*2];I=a.uvs2[z*2+1];D=a.uvs2[w*2];C=a.uvs2[w*2+1];A=a.uvs2[x*2];E=a.uvs2[x*2+1];THREE.Loader.prototype.uv3(c.uvs2,l,1-I,D,1-C,A,1-E)}}function v(p,u){var z,w,x,l,D,A,I,C,E,F,J,K;z=p[u];w=p[u+1];x=p[u+2];l=p[u+3];D=a.uvs[z*2];E=a.uvs[z*2+1];A=a.uvs[w*2];F=a.uvs[w*2+1];I=a.uvs[x*2];J=a.uvs[x*2+1];C=a.uvs[l*2];K=a.uvs[l*2+1];THREE.Loader.prototype.uv4(c.uvs,D,E,A,F,I,J,C,K);if(a.uvs2){D=a.uvs2[z*2];E=a.uvs2[z*2+1];A=a.uvs2[w*2];F=a.uvs2[w*2+1];I=a.uvs2[x*
  99. 2];J=a.uvs2[x*2+1];C=a.uvs2[l*2];K=a.uvs2[l*2+1];THREE.Loader.prototype.uv4(c.uvs2,D,1-E,A,1-F,I,1-J,C,1-K)}}var q,n;q=0;for(n=a.trianglesUvs.length;q<n;q+=7){e(a.trianglesUvs,q);k(a.trianglesUvs,q+4)}q=0;for(n=a.trianglesNormalsUvs.length;q<n;q+=10){g(a.trianglesNormalsUvs,q);k(a.trianglesNormalsUvs,q+7)}q=0;for(n=a.quadsUvs.length;q<n;q+=9){j(a.quadsUvs,q);v(a.quadsUvs,q+5)}q=0;for(n=a.quadsNormalsUvs.length;q<n;q+=13){m(a.quadsNormalsUvs,q);v(a.quadsNormalsUvs,q+9)}q=0;for(n=a.triangles.length;q<
  100. n;q+=4)e(a.triangles,q);q=0;for(n=a.trianglesNormals.length;q<n;q+=7)g(a.trianglesNormals,q);q=0;for(n=a.quads.length;q<n;q+=5)j(a.quads,q);q=0;for(n=a.quadsNormals.length;q<n;q+=9)m(a.quadsNormals,q)})();(function(){var e,g,j,m;if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e+=2){j=a.skinWeights[e];m=a.skinWeights[e+1];THREE.Loader.prototype.sw(c,j,m,0,0)}}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e+=2){j=a.skinIndices[e];m=a.skinIndices[e+1];THREE.Loader.prototype.si(c,j,m,0,0)}}THREE.Loader.prototype.bones(c,
  101. a.bones);THREE.Loader.prototype.animation(c,a.animation)})();this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;d(new f(b))},bones:function(a,d){a.bones=d},animation:function(a,d){a.animation=d},si:function(a,d,b,f,h){a.skinIndices.push(new THREE.Vector4(d,b,f,h))},sw:function(a,d,b,f,h){a.skinWeights.push(new THREE.Vector4(d,b,f,h))},v:function(a,d,b,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(d,b,f)))},vc:function(a,d,b,f){var h=
  102. new THREE.Color(16777215);h.setRGB(d,b,f);a.colors.push(h)},f3:function(a,d,b,f,h){a.faces.push(new THREE.Face3(d,b,f,null,a.materials[h]))},f4:function(a,d,b,f,h,c){a.faces.push(new THREE.Face4(d,b,f,h,null,a.materials[c]))},f3n:function(a,d,b,f,h,c,e,g,j){c=a.materials[c];var m=d[g*3],k=d[g*3+1];g=d[g*3+2];var v=d[j*3],q=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,f,h,[new THREE.Vector3(d[e*3],d[e*3+1],d[e*3+2]),new THREE.Vector3(m,k,g),new THREE.Vector3(v,q,j)],c))},f4n:function(a,d,b,f,
  103. h,c,e,g,j,m,k){e=a.materials[e];var v=d[j*3],q=d[j*3+1];j=d[j*3+2];var n=d[m*3],p=d[m*3+1];m=d[m*3+2];var u=d[k*3],z=d[k*3+1];k=d[k*3+2];a.faces.push(new THREE.Face4(b,f,h,c,[new THREE.Vector3(d[g*3],d[g*3+1],d[g*3+2]),new THREE.Vector3(v,q,j),new THREE.Vector3(n,p,m),new THREE.Vector3(u,z,k)],e))},uv3:function(a,d,b,f,h,c,e){var g=[];g.push(new THREE.UV(d,b));g.push(new THREE.UV(f,h));g.push(new THREE.UV(c,e));a.push(g)},uv4:function(a,d,b,f,h,c,e,g,j){var m=[];m.push(new THREE.UV(d,b));m.push(new THREE.UV(f,
  104. h));m.push(new THREE.UV(c,e));m.push(new THREE.UV(g,j));a.push(m)},init_materials:function(a,d,b){a.materials=[];for(var f=0;f<d.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],b)]},createMaterial:function(a,d){function b(g){g=Math.log(g)/Math.LN2;return Math.floor(g)==g}function f(g,j){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));g.image.width=
  105. k;g.image.height=v;g.image.getContext("2d").drawImage(this,0,0,k,v)}else g.image=this;g.needsUpdate=!0};m.src=j}var h,c,e;h="MeshLambertMaterial";c={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(h="MeshPhongMaterial");if(a.mapDiffuse&&d){e=document.createElement("canvas");c.map=new THREE.Texture(e);f(c.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){e=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;c.color=
  106. e;c.opacity=a.transparency}else if(a.DbgColor)c.color=a.DbgColor;if(a.mapLightmap&&d){e=document.createElement("canvas");c.lightMap=new THREE.Texture(e);f(c.lightMap,d+"/"+a.mapLightmap)}return new THREE[h](c)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};