ThreeExtras.js 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // ThreeExtras.js r36 - http://github.com/mrdoob/three.js
  2. var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,c=a.vertices.length,g=b?d.geometry:d,e=a.vertices,f=g.vertices,h=a.faces,j=g.faces,l=a.uvs;g=g.uvs;b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,t=f.length;k<t;k++){var n=new THREE.Vertex(f[k].position.clone());b&&d.matrix.multiplyVector3(n.position);e.push(n)}k=0;for(t=j.length;k<t;k++){f=j[k];var m,p=f.vertexNormals;if(f instanceof THREE.Face3)m=new THREE.Face3(f.a+c,f.b+c,f.c+c);else f instanceof THREE.Face4&&(m=new THREE.Face4(f.a+
  3. c,f.b+c,f.c+c,f.d+c));m.centroid.copy(f.centroid);m.normal.copy(f.normal);b=0;for(e=p.length;b<e;b++){n=p[b];m.vertexNormals.push(n.clone())}m.materials=f.materials.slice();h.push(m)}k=0;for(t=g.length;k<t;k++){c=g[k];h=[];b=0;for(e=c.length;b<e;b++)h.push(new THREE.UV(c[b].u,c[b].v));l.push(h)}}},ImageUtils={loadTexture:function(a,d,b){var c=new Image,g=new THREE.Texture(c,d);c.onload=function(){g.needsUpdate=!0;b&&b(this)};c.src=a;return g},loadTextureCube:function(a,d,b){var c,g=[],e=new THREE.Texture(g,
  4. d);d=g.loadCount=0;for(c=a.length;d<c;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)e.needsUpdate=!0;b&&b(this)};g[d].src=a[d]}return e}},SceneUtils={loadScene:function(a,d,b,c){a=new Worker(a);a.postMessage(0);a.onmessage=function(g){function e(){for(k in C.objects)if(!G.objects[k]){u=C.objects[k];if(o=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(o,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 f(N){return function(M){G.geometries[N]=M;e();F-=1;h()}}function h(){c({total_models:K,total_textures:O,loaded_models:K-F,loaded_textures:O-J},G);F==0&&J==0&&b(G)}var j,l,k,t,n,m,p,u,z,w,x,o,D,A,I,C,E,F,J,K,O,G;C=g.data;E=new THREE.Loader;J=F=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
  6. fogs:{}};g=function(){J-=1;h()};for(n in C.cameras){w=C.cameras[n];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[n]=D}for(t in C.lights){n=C.lights[t];if(n.type=="directional"){z=n.direction;light=new THREE.DirectionalLight;light.position.set(z[0],
  7. z[1],z[2]);light.position.normalize()}else if(n.type=="point"){z=n.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}w=n.color;i=n.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);G.scene.addLight(light);G.lights[t]=light}for(m in C.fogs){t=C.fogs[m];if(t.type=="linear")A=new THREE.Fog(0,t.near,t.far);else t.type=="exp2"&&(A=new THREE.FogExp2(0,t.density));w=t.color;A.color.setRGB(w[0],w[1],w[2]);G.fogs[m]=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){m=C.geometries[j];if(m.type=="bin_mesh"||m.type=="ascii_mesh")F+=1}K=F;for(j in C.geometries){m=C.geometries[j];if(m.type=="cube"){o=new Cube(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);G.geometries[j]=o}else if(m.type=="plane"){o=new Plane(m.width,
  9. m.height,m.segmentsWidth,m.segmentsHeight);G.geometries[j]=o}else if(m.type=="sphere"){o=new Sphere(m.radius,m.segmentsWidth,m.segmentsHeight);G.geometries[j]=o}else if(m.type=="cylinder"){o=new Cylinder(m.numSegs,m.topRad,m.botRad,m.height,m.topOffset,m.botOffset);G.geometries[j]=o}else if(m.type=="torus"){o=new Torus(m.radius,m.tube,m.segmentsR,m.segmentsT);G.geometries[j]=o}else if(m.type=="icosahedron"){o=new Icosahedron(m.subdivisions);G.geometries[j]=o}else if(m.type=="bin_mesh")E.loadBinary({model:m.url,
  10. callback:f(j)});else m.type=="ascii_mesh"&&E.loadAscii({model:m.url,callback:f(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)m=ImageUtils.loadTextureCube(j.url,j.mapping,g);else{m=ImageUtils.loadTexture(j.url,j.mapping,g);if(THREE[j.minFilter]!=undefined)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)m.magFilter=
  11. THREE[j.magFilter]}G.textures[p]=m}for(l in C.materials){p=C.materials[l];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[l]=p}e();d(G)}},addMesh:function(a,d,b,c,g,e,f,h,j,l){d=new THREE.Mesh(d,l);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=c;d.position.y=g;d.position.z=e;d.rotation.x=f;d.rotation.y=h;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:c.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 c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new Cube(d,d,d,1,1,c,!0),new THREE.MeshFaceMaterial);
  14. a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var c=d/2;d=new Plane(d,d);var g=Math.PI,e=Math.PI/2;SceneUtils.addMesh(a,d,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,d,1,-c,0,0,0,e,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,d,1,c,0,0,0,-e,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,d,1,0,c,0,e,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
  15. SceneUtils.addMesh(a,d,1,0,-c,0,-e,0,g,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,c,g,e=2*Math.ceil(a*3)+1;e>25&&(e=25);g=(e-1)*0.5;b=Array(e);for(d=c=0;d<e;++d){b[d]=Math.exp(-((d-g)*(d-g))/(2*a*a));c+=b[d]}for(d=0;d<e;++d)b[d]/=c;return b}};
  25. THREE.QuakeCamera=function(a){function d(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
  26. a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
  27. this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
  28. !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.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}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
  29. !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
  30. var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(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;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
  31. !1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
  32. THREE.QuakeCamera.prototype.translate=function(a,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(a));this.target.position.addSelf(d.multiplyScalar(a))};
  33. THREE.PathCamera=function(a){function d(l,k,t,n){var m={name:t,fps:0.6,length:n,hierarchy:[]},p,u=k.getControlPointsArray(),z=k.getLength(),w=u.length,x=0;p=w-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:u[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[p]={time:n,pos:u[p],rot:[0,0,0,1],scl:[1,1,1]};for(p=1;p<w-1;p++){x=n*z.chunks[p]/z.total;k.keys[p]={time:x,pos:u[p]}}m.hierarchy[0]=k;THREE.AnimationHandler.add(m);return new THREE.Animation(l,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var t,
  34. n,m=new THREE.Geometry;for(t=0;t<l.points.length*k;t++){n=t/(l.points.length*k);n=l.getPoint(n);m.vertices[t]=new THREE.Vertex(new THREE.Vector3(n.x,n.y,n.z))}return m}function c(l,k){var t=b(k,10),n=b(k,10),m=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,m);particleObj=new THREE.ParticleSystem(n,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);n=new Sphere(1,
  35. 16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){t=new THREE.Mesh(n,m);t.position.copy(k.points[i]);t.updateMatrix();l.addChild(t)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;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.005;this.lookVertical=
  36. !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
  37. if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
  38. this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,e=Math.PI/180;this.update=function(l,k,t){var n,m;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)*e;this.theta=this.lon*e;n=this.phi%g;this.phi=n>=0?n:n+g;n=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;
  39. this.phi=(this.phi-n[0])*(m[1]-m[0])/(n[1]-n[0])+m[0];n=this.horizontalAngleMap.srcRange;m=this.horizontalAngleMap.dstRange;this.theta=(this.theta-n[0])*(m[1]-m[0])/(n[1]-n[0])+m[0];n=this.target.position;n.x=100*Math.sin(this.phi)*Math.cos(this.theta);n.y=100*Math.cos(this.phi);n.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,t)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
  40. this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var f=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,f);a.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
  41. d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
  42. var Cube=function(a,d,b,c,g,e,f,h,j){function l(z,w,x,o,D,A,I,C){var E,F,J=c||1,K=g||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=e||1}else if(z=="z"&&w=="y"||z=="y"&&w=="z"){E="x";J=e||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)*o;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*
  43. (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,t=a/2,n=d/2,m=b/2;h=h?-1:1;if(f!==undefined)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([f])}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&&
  44. l("z","y",1*h,-1,b,d,-t,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,t,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,n,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-n,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,m,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-m,this.materials[5]);(function(){for(var z=[],w=[],x=0,o=k.vertices.length;x<o;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==
  45. 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(o=k.faces.length;x<o;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();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
  46. var Cylinder=function(a,d,b,c,g,e){function f(k,t,n){h.vertices.push(new THREE.Vertex(new THREE.Vector3(k,t,n)))}THREE.Geometry.call(this);var h=this,j=Math.PI,l=c/2;for(c=0;c<a;c++)f(Math.sin(2*j*c/a)*d,Math.cos(2*j*c/a)*d,-l);for(c=0;c<a;c++)f(Math.sin(2*j*c/a)*b,Math.cos(2*j*c/a)*b,l);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){f(0,0,-l-(e||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(d>0){f(0,0,l+(g||0));
  47. for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4((2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
  48. var Icosahedron=function(a){function d(t,n,m){var p=Math.sqrt(t*t+n*n+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/p,n/p,m/p)))-1}function b(t,n,m,p){p.faces.push(new THREE.Face3(t,n,m))}function c(t,n){var m=g.vertices[t].position,p=g.vertices[n].position;return d((m.x+p.x)/2,(m.y+p.y)/2,(m.z+p.z)/2)}var g=this,e=new THREE.Geometry,f;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,
  49. 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(a=0;a<this.subdivisions;a++){f=new THREE.Geometry;for(var h in e.faces){var j=c(e.faces[h].a,e.faces[h].b),l=c(e.faces[h].b,e.faces[h].c),k=c(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,j,k,f);b(e.faces[h].b,l,j,f);b(e.faces[h].c,
  50. k,l,f);b(j,l,k,f)}e.faces=f.faces}g.faces=e.faces;delete e;delete f;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
  51. function Lathe(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;for(var c=[],g=[],e=[],f=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(d),l=0;l<=this.angle+0.001;l+=d){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));e[h]=this.vertices.length-1}else e=f;l==0&&(f=g);for(h=
  52. 0;h<g.length-1;h++){this.faces.push(new THREE.Face4(e[h],e[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
  53. var Plane=function(a,d,b,c){THREE.Geometry.call(this);var g,e=a/2,f=d/2;b=b||1;c=c||1;var h=b+1,j=c+1;a/=b;var l=d/c;for(g=0;g<j;g++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-e,-(g*l-f),0)));for(g=0;g<c;g++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*g,d+h*(g+1),d+1+h*(g+1),d+1+h*g));this.uvs.push([new THREE.UV(d/b,g/c),new THREE.UV(d/b,(g+1)/c),new THREE.UV((d+1)/b,(g+1)/c),new THREE.UV((d+1)/b,g/c)])}this.computeCentroids();this.computeFaceNormals()};
  54. Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
  55. var Sphere=function(a,d,b){THREE.Geometry.call(this);var c,g=Math.PI,e=Math.max(3,d||8),f=Math.max(2,b||6);d=[];for(b=0;b<f+1;b++){c=b/f;var h=a*Math.cos(c*g),j=a*Math.sin(c*g),l=[],k=0;for(c=0;c<e;c++){var t=2*c/e,n=j*Math.sin(t*g);t=j*Math.cos(t*g);(b==0||b==f)&&c>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,h,n)))-1);l.push(k)}d.push(l)}var m,p,u;g=d.length;for(b=0;b<g;b++){e=d[b].length;if(b>0)for(c=0;c<e;c++){l=c==e-1;f=d[b][l?0:c+1];h=d[b][l?e-1:c];j=d[b-1][l?e-1:c];l=d[b-1][l?
  56. 0:c+1];n=b/(g-1);m=(b-1)/(g-1);p=(c+1)/e;t=c/e;k=new THREE.UV(1-p,n);n=new THREE.UV(1-t,n);t=new THREE.UV(1-t,m);var z=new THREE.UV(1-p,m);if(b<d.length-1){m=this.vertices[f].position.clone();p=this.vertices[h].position.clone();u=this.vertices[j].position.clone();m.normalize();p.normalize();u.normalize();this.faces.push(new THREE.Face3(f,h,j,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([k,n,t])}if(b>1){m=this.vertices[f].position.clone();
  57. p=this.vertices[j].position.clone();u=this.vertices[l].position.clone();m.normalize();p.normalize();u.normalize();this.faces.push(new THREE.Face3(f,j,l,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([k,t,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
  58. var Torus=function(a,d,b,c){this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(c),(this.radius+this.tube*Math.cos(g))*Math.sin(c),this.tube*Math.sin(g))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b=
  59. 1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*d+b;g=(this.segmentsT+1)*d+b-1;var e=(this.segmentsT+1)*(d-1)+b-1,f=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(c,g,e,f));this.uvs.push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
  60. var TorusKnot=function(a,d,b,c,g,e,f){function h(t,n,m,p,u,z){n=m/p*t;m=Math.cos(n);return new THREE.Vector3(u*(2+m)*0.5*Math.cos(t),u*(2+m)*Math.sin(t)*0.5,z*u*Math.sin(n)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=d||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=g||2;this.q=e||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var j=
  61. a/this.segmentsR*2*this.p*Math.PI;f=d/this.segmentsT*2*Math.PI;g=h(j,f,this.q,this.p,this.radius,this.heightScale);j=h(j+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=j.x-g.x;b.y=j.y-g.y;b.z=j.z-g.z;c.x=j.x+g.x;c.y=j.y+g.y;c.z=j.z+g.z;e.cross(b,c);c.cross(e,b);e.normalize();c.normalize();j=this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=j*c.x+f*e.x;g.y+=j*c.y+f*e.y;g.z+=j*c.z+f*e.z;this.grid[a][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(d=
  62. 0;d<this.segmentsT;++d){e=(a+1)%this.segmentsR;f=(d+1)%this.segmentsT;g=this.grid[a][d];b=this.grid[e][d];c=this.grid[a][f];e=this.grid[e][f];f=new THREE.UV(a/this.segmentsR,d/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,d/this.segmentsT);var l=new THREE.UV(a/this.segmentsR,(d+1)/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,b,c));this.uvs.push([f,j,l]);this.faces.push(new THREE.Face3(e,c,b));this.uvs.push([k,l,j])}this.computeCentroids();
  63. this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
  64. 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=
  65. 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,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);d.onmessage=function(g){THREE.Loader.prototype.createModel(g.data,b,c)};d.postMessage(a)},loadBinary:function(a){var d=a.model,b=a.callback,c=a.texture_path?a.texture_path:
  66. THREE.Loader.prototype.extractUrlbase(d),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);var e=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(f){THREE.Loader.prototype.loadAjaxBuffers(f.data.buffers,f.data.materials,b,g,c,e)};d.onerror=function(f){alert("worker.onerror: "+f.message+"\n"+f.data);f.preventDefault()};d.postMessage(a)},loadAjaxBuffers:function(a,d,b,c,g,e){var f=new XMLHttpRequest,h=c+"/"+a,j=0;
  67. f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.Loader.prototype.createBinModel(f.responseText,b,g,d):alert("Couldn't load ["+h+"] ["+f.status+"]");else if(f.readyState==3){if(e){j==0&&(j=f.getResponseHeader("Content-Length"));e({total:j,loaded:f.responseText.length})}}else f.readyState==2&&(j=f.getResponseHeader("Content-Length"))};f.open("GET",h,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)},
  68. createBinModel:function(a,d,b,c){var g=function(e){function f(q,v){var y=k(q,v),B=k(q,v+1),H=k(q,v+2),L=k(q,v+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 h(q,v){var y=k(q,v),B=k(q,v+1),H=k(q,v+2);return(k(q,v+3)<<24)+(H<<16)+(B<<8)+y}function j(q,v){var y=k(q,v);return(k(q,v+1)<<8)+y}function l(q,v){var y=k(q,v);return y>127?y-256:y}function k(q,v){return q.charCodeAt(v)&255}function t(q){var v,y,B;v=h(a,q);
  69. y=h(a,q+I);B=h(a,q+C);q=j(a,q+E);THREE.Loader.prototype.f3(w,v,y,B,q)}function n(q){var v,y,B,H,L,P;v=h(a,q);y=h(a,q+I);B=h(a,q+C);H=j(a,q+E);L=h(a,q+F);P=h(a,q+J);q=h(a,q+K);THREE.Loader.prototype.f3n(w,D,v,y,B,H,L,P,q)}function m(q){var v,y,B,H;v=h(a,q);y=h(a,q+O);B=h(a,q+G);H=h(a,q+N);q=j(a,q+M);THREE.Loader.prototype.f4(w,v,y,B,H,q)}function p(q){var v,y,B,H,L,P,Z,$;v=h(a,q);y=h(a,q+O);B=h(a,q+G);H=h(a,q+N);L=j(a,q+M);P=h(a,q+X);Z=h(a,q+Y);$=h(a,q+R);q=h(a,q+aa);THREE.Loader.prototype.f4n(w,D,
  70. v,y,B,H,L,P,Z,$,q)}function u(q){var v,y;v=h(a,q);y=h(a,q+ba);q=h(a,q+ca);THREE.Loader.prototype.uv3(w.uvs,A[v*2],A[v*2+1],A[y*2],A[y*2+1],A[q*2],A[q*2+1])}function z(q){var v,y,B;v=h(a,q);y=h(a,q+da);B=h(a,q+ea);q=h(a,q+fa);THREE.Loader.prototype.uv4(w.uvs,A[v*2],A[v*2+1],A[y*2],A[y*2+1],A[B*2],A[B*2+1],A[q*2],A[q*2+1])}var w=this,x=0,o,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,c,e);o={signature:a.substr(x,
  71. 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:h(a,x+16),nnormals:h(a,x+16+4),nuvs:h(a,x+16+8),ntri_flat:h(a,x+16+12),ntri_smooth:h(a,x+16+16),ntri_flat_uv:h(a,x+16+20),ntri_smooth_uv:h(a,x+16+24),nquad_flat:h(a,x+16+28),nquad_smooth:h(a,x+16+32),nquad_flat_uv:h(a,x+16+36),nquad_smooth_uv:h(a,x+16+40)};
  72. x+=o.header_bytes;I=o.vertex_index_bytes;C=o.vertex_index_bytes*2;E=o.vertex_index_bytes*3;F=o.vertex_index_bytes*3+o.material_index_bytes;J=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;K=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;O=o.vertex_index_bytes;G=o.vertex_index_bytes*2;N=o.vertex_index_bytes*3;M=o.vertex_index_bytes*4;X=o.vertex_index_bytes*4+o.material_index_bytes;Y=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;R=o.vertex_index_bytes*
  73. 4+o.material_index_bytes+o.normal_index_bytes*2;aa=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;ba=o.uv_index_bytes;ca=o.uv_index_bytes*2;da=o.uv_index_bytes;ea=o.uv_index_bytes*2;fa=o.uv_index_bytes*3;e=o.vertex_index_bytes*3+o.material_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes;S=o.ntri_flat*e;T=o.ntri_smooth*(e+o.normal_index_bytes*3);U=o.ntri_flat_uv*(e+o.uv_index_bytes*3);V=o.ntri_smooth_uv*(e+o.normal_index_bytes*3+o.uv_index_bytes*3);W=o.nquad_flat*
  74. Q;e=o.nquad_smooth*(Q+o.normal_index_bytes*4);Q=o.nquad_flat_uv*(Q+o.uv_index_bytes*4);x+=function(q){for(var v,y,B,H=o.vertex_coordinate_bytes*3,L=q+o.nvertices*H;q<L;q+=H){v=f(a,q);y=f(a,q+o.vertex_coordinate_bytes);B=f(a,q+o.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,v,y,B)}return o.nvertices*H}(x);x+=function(q){for(var v,y,B,H=o.normal_coordinate_bytes*3,L=q+o.nnormals*H;q<L;q+=H){v=l(a,q);y=l(a,q+o.normal_coordinate_bytes);B=l(a,q+o.normal_coordinate_bytes*2);D.push(v/127,y/127,B/
  75. 127)}return o.nnormals*H}(x);x+=function(q){for(var v,y,B=o.uv_coordinate_bytes*2,H=q+o.nuvs*B;q<H;q+=B){v=f(a,q);y=f(a,q+o.uv_coordinate_bytes);A.push(v,y)}return o.nuvs*B}(x);S=x+S;T=S+T;U=T+U;V=U+V;W=V+W;e=W+e;Q=e+Q;(function(q){var v,y=o.vertex_index_bytes*3+o.material_index_bytes,B=y+o.uv_index_bytes*3,H=q+o.ntri_flat_uv*B;for(v=q;v<H;v+=B){t(v);u(v+y)}return H-q})(T);(function(q){var v,y=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,B=y+o.uv_index_bytes*3,H=q+o.ntri_smooth_uv*
  76. B;for(v=q;v<H;v+=B){n(v);u(v+y)}return H-q})(U);(function(q){var v,y=o.vertex_index_bytes*4+o.material_index_bytes,B=y+o.uv_index_bytes*4,H=q+o.nquad_flat_uv*B;for(v=q;v<H;v+=B){m(v);z(v+y)}return H-q})(e);(function(q){var v,y=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,B=y+o.uv_index_bytes*4,H=q+o.nquad_smooth_uv*B;for(v=q;v<H;v+=B){p(v);z(v+y)}return H-q})(Q);(function(q){var v,y=o.vertex_index_bytes*3+o.material_index_bytes,B=q+o.ntri_flat*y;for(v=q;v<B;v+=y)t(v);return B-
  77. q})(x);(function(q){var v,y=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,B=q+o.ntri_smooth*y;for(v=q;v<B;v+=y)n(v);return B-q})(S);(function(q){var v,y=o.vertex_index_bytes*4+o.material_index_bytes,B=q+o.nquad_flat*y;for(v=q;v<B;v+=y)m(v);return B-q})(V);(function(q){var v,y=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,B=q+o.nquad_smooth*y;for(v=q;v<B;v+=y)p(v);return B-q})(W);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;
  78. g.prototype.constructor=g;d(new g(b))},createModel:function(a,d,b){var c=function(g){var e=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(e,a.materials,g);(function(){var f,h,j,l,k,t;f=0;for(h=a.vertices.length;f<h;f+=3){j=a.vertices[f];l=a.vertices[f+1];k=a.vertices[f+2];THREE.Loader.prototype.v(e,j,l,k)}if(a.morphTargets!==undefined){f=0;for(h=a.morphTargets.length;f<h;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];t=e.morphTargets[f].vertices;
  79. k=a.morphTargets[f].vertices;j=0;for(l=k.length;j<l;j+=3)t.push(new THREE.Vertex(new THREE.Vector3(k[j],k[j+1],k[j+2])))}}if(a.colors){f=0;for(h=a.colors.length;f<h;f+=3){j=a.colors[f];l=a.colors[f+1];k=a.colors[f+2];THREE.Loader.prototype.vc(e,j,l,k)}}})();(function(){function f(p,u){THREE.Loader.prototype.f3(e,p[u],p[u+1],p[u+2],p[u+3])}function h(p,u){THREE.Loader.prototype.f3n(e,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(e,p[u],p[u+1],p[u+
  80. 2],p[u+3],p[u+4])}function l(p,u){THREE.Loader.prototype.f4n(e,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,o,D,A,I,C,E;z=p[u];w=p[u+1];x=p[u+2];o=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(e.uvs,o,I,D,C,A,E);if(a.uvs2&&a.uvs2.length){o=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(e.uvs2,o,1-I,D,1-C,A,1-E)}}function t(p,
  81. u){var z,w,x,o,D,A,I,C,E,F,J,K;z=p[u];w=p[u+1];x=p[u+2];o=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[o*2];K=a.uvs[o*2+1];THREE.Loader.prototype.uv4(e.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*2];J=a.uvs2[x*2+1];C=a.uvs2[o*2];K=a.uvs2[o*2+1];THREE.Loader.prototype.uv4(e.uvs2,D,1-E,A,1-F,I,1-J,C,1-K)}}var n,m;n=0;for(m=a.trianglesUvs.length;n<m;n+=7){f(a.trianglesUvs,n);k(a.trianglesUvs,
  82. n+4)}n=0;for(m=a.trianglesNormalsUvs.length;n<m;n+=10){h(a.trianglesNormalsUvs,n);k(a.trianglesNormalsUvs,n+7)}n=0;for(m=a.quadsUvs.length;n<m;n+=9){j(a.quadsUvs,n);t(a.quadsUvs,n+5)}n=0;for(m=a.quadsNormalsUvs.length;n<m;n+=13){l(a.quadsNormalsUvs,n);t(a.quadsNormalsUvs,n+9)}n=0;for(m=a.triangles.length;n<m;n+=4)f(a.triangles,n);n=0;for(m=a.trianglesNormals.length;n<m;n+=7)h(a.trianglesNormals,n);n=0;for(m=a.quads.length;n<m;n+=5)j(a.quads,n);n=0;for(m=a.quadsNormals.length;n<m;n+=9)l(a.quadsNormals,
  83. n)})();(function(){var f,h,j,l;if(a.skinWeights){f=0;for(h=a.skinWeights.length;f<h;f+=2){j=a.skinWeights[f];l=a.skinWeights[f+1];THREE.Loader.prototype.sw(e,j,l,0,0)}}if(a.skinIndices){f=0;for(h=a.skinIndices.length;f<h;f+=2){j=a.skinIndices[f];l=a.skinIndices[f+1];THREE.Loader.prototype.si(e,j,l,0,0)}}THREE.Loader.prototype.bones(e,a.bones);THREE.Loader.prototype.animation(e,a.animation)})();this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=
  84. c;d(new c(b))},bones:function(a,d){a.bones=d},animation:function(a,d){a.animation=d},si:function(a,d,b,c,g){a.skinIndices.push(new THREE.Vector4(d,b,c,g))},sw:function(a,d,b,c,g){a.skinWeights.push(new THREE.Vector4(d,b,c,g))},v:function(a,d,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(d,b,c)))},vc:function(a,d,b,c){var g=new THREE.Color(16777215);g.setRGB(d,b,c);a.colors.push(g)},f3:function(a,d,b,c,g){a.faces.push(new THREE.Face3(d,b,c,null,a.materials[g]))},f4:function(a,d,b,c,g,e){a.faces.push(new THREE.Face4(d,
  85. b,c,g,null,a.materials[e]))},f3n:function(a,d,b,c,g,e,f,h,j){e=a.materials[e];var l=d[h*3],k=d[h*3+1];h=d[h*3+2];var t=d[j*3],n=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,c,g,[new THREE.Vector3(d[f*3],d[f*3+1],d[f*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(t,n,j)],e))},f4n:function(a,d,b,c,g,e,f,h,j,l,k){f=a.materials[f];var t=d[j*3],n=d[j*3+1];j=d[j*3+2];var m=d[l*3],p=d[l*3+1];l=d[l*3+2];var u=d[k*3],z=d[k*3+1];k=d[k*3+2];a.faces.push(new THREE.Face4(b,c,g,e,[new THREE.Vector3(d[h*
  86. 3],d[h*3+1],d[h*3+2]),new THREE.Vector3(t,n,j),new THREE.Vector3(m,p,l),new THREE.Vector3(u,z,k)],f))},uv3:function(a,d,b,c,g,e,f){var h=[];h.push(new THREE.UV(d,b));h.push(new THREE.UV(c,g));h.push(new THREE.UV(e,f));a.push(h)},uv4:function(a,d,b,c,g,e,f,h,j){var l=[];l.push(new THREE.UV(d,b));l.push(new THREE.UV(c,g));l.push(new THREE.UV(e,f));l.push(new THREE.UV(h,j));a.push(l)},init_materials:function(a,d,b){a.materials=[];for(var c=0;c<d.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(d[c],
  87. b)]},createMaterial:function(a,d){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));h.image.width=k;h.image.height=t;h.image.getContext("2d").drawImage(this,0,0,k,t)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,e,f;g="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,
  88. vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(g="MeshPhongMaterial");if(a.mapDiffuse&&d){f=document.createElement("canvas");e.map=new THREE.Texture(f);e.map.sourceFile=a.mapDiffuse;c(e.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){f=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;e.color=f;e.opacity=a.transparency}else if(a.DbgColor)e.color=a.DbgColor;if(a.mapLightmap&&d){f=document.createElement("canvas");e.lightMap=new THREE.Texture(f);e.lightMap.sourceFile=
  89. a.mapLightmap;c(e.lightMap,d+"/"+a.mapLightmap)}return new THREE[g](e)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
  90. 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=
  91. 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,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,e,f,h,j,l,k,t){f=(f-k)/(t-k);k=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=j;c[e+2]=l;g[e]=this.lerp(k[b],k[b+3],f);g[e+1]=this.lerp(k[b+1],k[b+4],f);g[e+2]=this.lerp(k[b+2],k[b+5],f)};this.VIntY=function(b,c,g,e,f,h,j,l,k,t){f=(f-k)/(t-k);k=this.normal_cache;c[e]=h;c[e+1]=j+f*this.delta;c[e+
  92. 2]=l;c=b+this.yd*3;g[e]=this.lerp(k[b],k[c],f);g[e+1]=this.lerp(k[b+1],k[c+1],f);g[e+2]=this.lerp(k[b+2],k[c+2],f)};this.VIntZ=function(b,c,g,e,f,h,j,l,k,t){f=(f-k)/(t-k);k=this.normal_cache;c[e]=h;c[e+1]=j;c[e+2]=l+f*this.delta;c=b+this.zd*3;g[e]=this.lerp(k[b],k[c],f);g[e+1]=this.lerp(k[b+1],k[c+1],f);g[e+2]=this.lerp(k[b+2],k[c+2],f)};this.compNorm=function(b){var c=b*3;if(this.normal_cache[c]==0){this.normal_cache[c]=this.field[b-1]-this.field[b+1];this.normal_cache[c+1]=this.field[b-this.yd]-
  93. this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,g,e,f,h){var j=e+1,l=e+this.yd,k=e+this.zd,t=j+this.yd,n=j+this.zd,m=e+this.yd+this.zd,p=j+this.yd+this.zd,u=0,z=this.field[e],w=this.field[j],x=this.field[l],o=this.field[t],D=this.field[k],A=this.field[n],I=this.field[m],C=this.field[p];z<f&&(u|=1);w<f&&(u|=2);x<f&&(u|=8);o<f&&(u|=4);D<f&&(u|=16);A<f&&(u|=32);I<f&&(u|=128);C<f&&(u|=64);var E=THREE.edgeTable[u];if(E==0)return 0;
  94. var F=this.delta,J=b+F,K=c+F;F=g+F;if(E&1){this.compNorm(e);this.compNorm(j);this.VIntX(e*3,this.vlist,this.nlist,0,f,b,c,g,z,w)}if(E&2){this.compNorm(j);this.compNorm(t);this.VIntY(j*3,this.vlist,this.nlist,3,f,J,c,g,w,o)}if(E&4){this.compNorm(l);this.compNorm(t);this.VIntX(l*3,this.vlist,this.nlist,6,f,b,K,g,x,o)}if(E&8){this.compNorm(e);this.compNorm(l);this.VIntY(e*3,this.vlist,this.nlist,9,f,b,c,g,z,x)}if(E&16){this.compNorm(k);this.compNorm(n);this.VIntX(k*3,this.vlist,this.nlist,12,f,b,c,F,
  95. D,A)}if(E&32){this.compNorm(n);this.compNorm(p);this.VIntY(n*3,this.vlist,this.nlist,15,f,J,c,F,A,C)}if(E&64){this.compNorm(m);this.compNorm(p);this.VIntX(m*3,this.vlist,this.nlist,18,f,b,K,F,I,C)}if(E&128){this.compNorm(k);this.compNorm(m);this.VIntY(k*3,this.vlist,this.nlist,21,f,b,c,F,D,I)}if(E&256){this.compNorm(e);this.compNorm(k);this.VIntZ(e*3,this.vlist,this.nlist,24,f,b,c,g,z,D)}if(E&512){this.compNorm(j);this.compNorm(n);this.VIntZ(j*3,this.vlist,this.nlist,27,f,J,c,g,w,A)}if(E&1024){this.compNorm(t);
  96. this.compNorm(p);this.VIntZ(t*3,this.vlist,this.nlist,30,f,J,K,g,o,C)}if(E&2048){this.compNorm(l);this.compNorm(m);this.VIntZ(l*3,this.vlist,this.nlist,33,f,b,K,g,x,I)}u<<=4;for(f=e=0;THREE.triTable[u+f]!=-1;){b=u+f;c=b+1;g=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],h);f+=3;e++}return e};this.posnormtriv=function(b,c,g,e,f,h){var j=this.count*3;this.positionArray[j]=b[g];this.positionArray[j+1]=b[g+1];this.positionArray[j+2]=b[g+2];this.positionArray[j+
  97. 3]=b[e];this.positionArray[j+4]=b[e+1];this.positionArray[j+5]=b[e+2];this.positionArray[j+6]=b[f];this.positionArray[j+7]=b[f+1];this.positionArray[j+8]=b[f+2];this.normalArray[j]=c[g];this.normalArray[j+1]=c[g+1];this.normalArray[j+2]=c[g+2];this.normalArray[j+3]=c[e];this.normalArray[j+4]=c[e+1];this.normalArray[j+5]=c[e+2];this.normalArray[j+6]=c[f];this.normalArray[j+7]=c[f+1];this.normalArray[j+8]=c[f+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
  98. function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,e,f){var h=this.size*Math.sqrt(e/f),j=g*this.size,l=c*this.size,k=b*this.size,t=Math.floor(j-h);t<1&&(t=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);
  99. h>this.size-1&&(h=this.size-1);for(var p,u,z,w,x,o;t<j;t++){k=this.size2*t;u=t/this.size-g;x=u*u;for(u=n;u<l;u++){z=k+this.size*u;p=u/this.size-c;o=p*p;for(p=m;p<h;p++){w=p/this.size-b;w=e/(1.0E-6+w*w+o+x)-f;w>0&&(this.field[z+p]+=w)}}}};this.addPlaneX=function(b,c){var g,e,f,h,j,l=this.size,k=this.yd,t=this.zd,n=this.field,m=l*Math.sqrt(b/c);m>l&&(m=l);for(g=0;g<m;g++){e=g/l;e*=e;h=b/(1.0E-4+e)-c;if(h>0)for(e=0;e<l;e++){j=g+e*k;for(f=0;f<l;f++)n[t*f+j]+=h}}};this.addPlaneY=function(b,c){var g,e,
  100. f,h,j,l,k=this.size,t=this.yd,n=this.zd,m=this.field,p=k*Math.sqrt(b/c);p>k&&(p=k);for(e=0;e<p;e++){g=e/k;g*=g;h=b/(1.0E-4+g)-c;if(h>0){j=e*t;for(g=0;g<k;g++){l=j+g;for(f=0;f<k;f++)m[n*f+l]+=h}}}};this.addPlaneZ=function(b,c){var g,e,f,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(f=0;f<dist;f++){g=f/size;g*=g;h=b/(1.0E-4+g)-c;if(h>0){j=zd*f;for(e=0;e<size;e++){l=j+e*yd;for(g=0;g<size;g++)field[l+g]+=h}}}};this.reset=function(){var b;
  101. for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var c,g,e,f,h,j,l,k,t,n=this.size-2;for(f=1;f<n;f++){t=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(e=1;e<n;e++){k=t+this.size*e;j=(e-this.halfsize)/this.halfsize;for(g=1;g<n;g++){h=(g-this.halfsize)/this.halfsize;c=k+g;this.polygonize(h,j,l,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(g){var e,f,h,j,l,k,t,n;for(e=
  102. 0;e<g.count;e++){l=e*3;t=l+1;n=l+2;f=g.positionArray[l];h=g.positionArray[t];j=g.positionArray[n];k=new THREE.Vector3(f,h,j);f=g.normalArray[l];h=g.normalArray[t];j=g.normalArray[n];l=new THREE.Vector3(f,h,j);l.normalize();l=new THREE.Vertex(k,l);c.vertices.push(l)}nfaces=g.count/3;for(e=0;e<nfaces;e++){l=(b+e)*3;t=l+1;n=l+2;k=c.vertices[l].normal;f=c.vertices[t].normal;h=c.vertices[n].normal;l=new THREE.Face3(l,t,n,[k,f,h]);c.faces.push(l)}b+=nfaces;g.count=0});return c};this.init(a)};
  103. THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
  104. 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,
  105. 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,
  106. 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]);
  107. 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,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