123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // ThreeExtras.js r36 - http://github.com/mrdoob/three.js
- var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,h=b?c.geometry:c,d=a.vertices,f=h.vertices,g=a.faces,j=h.faces,o=a.uvs;h=h.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,y=f.length;n<y;n++){var u=new THREE.Vertex(f[n].position.clone());b&&c.matrix.multiplyVector3(u.position);d.push(u)}n=0;for(y=j.length;n<y;n++){f=j[n];var k,l=f.vertexNormals;if(f instanceof THREE.Face3)k=new THREE.Face3(f.a+e,f.b+e,f.c+e);else f instanceof THREE.Face4&&(k=new THREE.Face4(f.a+
- e,f.b+e,f.c+e,f.d+e));k.centroid.copy(f.centroid);k.normal.copy(f.normal);b=0;for(d=l.length;b<d;b++){u=l[b];k.vertexNormals.push(u.clone())}k.materials=f.materials.slice();g.push(k)}n=0;for(y=h.length;n<y;n++){e=h[n];g=[];b=0;for(d=e.length;b<d;b++)g.push(new THREE.UV(e[b].u,e[b].v));o.push(g)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,h=new THREE.Texture(e,c);e.onload=function(){h.needsUpdate=!0;b&&b(this)};e.src=a;return h},loadTextureCube:function(a,c,b){var e,h=[],d=new THREE.Texture(h,
- c);c=h.loadCount=0;for(e=a.length;c<e;++c){h[c]=new Image;h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)d.needsUpdate=!0;b&&b(this)};h[c].src=a[c]}return d}},SceneUtils={loadScene:function(a,c,b,e){a=new Worker(a);a.postMessage(0);a.onmessage=function(h){function d(){for(n in D.objects)if(!G.objects[n]){p=D.objects[n];if(m=G.geometries[p.geometry]){I=[];for(i=0;i<p.materials.length;i++)I[i]=G.materials[p.materials[i]];v=p.position;r=p.rotation;s=p.scale;object=new THREE.Mesh(m,I);object.position.set(v[0],
- v[1],v[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=p.visible;G.scene.addObject(object);G.objects[n]=object}}}function f(N){return function(M){G.geometries[N]=M;d();F-=1;g()}}function g(){e({total_models:K,total_textures:O,loaded_models:K-F,loaded_textures:O-J},G);F==0&&J==0&&b(G)}var j,o,n,y,u,k,l,p,v,t,w,m,B,z,I,D,E,F,J,K,O,G;D=h.data;E=new THREE.Loader;J=F=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
- fogs:{}};h=function(){J-=1;g()};for(u in D.cameras){t=D.cameras[u];if(t.type=="perspective")B=new THREE.Camera(t.fov,t.aspect,t.near,t.far);else if(t.type=="ortho"){B=new THREE.Camera;B.projectionMatrix=THREE.Matrix4.makeOrtho(t.left,t.right,t.top,t.bottom,t.near,t.far)}v=t.position;t=t.target;B.position.set(v[0],v[1],v[2]);B.target.position.set(t[0],t[1],t[2]);G.cameras[u]=B}for(y in D.lights){u=D.lights[y];if(u.type=="directional"){v=u.direction;light=new THREE.DirectionalLight;light.position.set(v[0],
- v[1],v[2]);light.position.normalize()}else if(u.type=="point"){v=u.position;light=new THREE.PointLight;light.position.set(v[0],v[1],v[2])}t=u.color;i=u.intensity||1;light.color.setRGB(t[0]*i,t[1]*i,t[2]*i);G.scene.addLight(light);G.lights[y]=light}for(k in D.fogs){y=D.fogs[k];if(y.type=="linear")z=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(z=new THREE.FogExp2(0,y.density));t=y.color;z.color.setRGB(t[0],t[1],t[2]);G.fogs[k]=z}if(G.cameras&&D.defaults.camera)G.currentCamera=G.cameras[D.defaults.camera];
- if(G.fogs&&D.defaults.fog)G.scene.fog=G.fogs[D.defaults.fog];t=D.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(t[0],t[1],t[2]);G.bgColorAlpha=D.defaults.bgalpha;for(j in D.geometries){k=D.geometries[j];if(k.type=="bin_mesh"||k.type=="ascii_mesh")F+=1}K=F;for(j in D.geometries){k=D.geometries[j];if(k.type=="cube"){m=new Cube(k.width,k.height,k.depth,k.segmentsWidth,k.segmentsHeight,k.segmentsDepth,null,k.flipped,k.sides);G.geometries[j]=m}else if(k.type=="plane"){m=new Plane(k.width,
- k.height,k.segmentsWidth,k.segmentsHeight);G.geometries[j]=m}else if(k.type=="sphere"){m=new Sphere(k.radius,k.segmentsWidth,k.segmentsHeight);G.geometries[j]=m}else if(k.type=="cylinder"){m=new Cylinder(k.numSegs,k.topRad,k.botRad,k.height,k.topOffset,k.botOffset);G.geometries[j]=m}else if(k.type=="torus"){m=new Torus(k.radius,k.tube,k.segmentsR,k.segmentsT);G.geometries[j]=m}else if(k.type=="icosahedron"){m=new Icosahedron(k.subdivisions);G.geometries[j]=m}else if(k.type=="bin_mesh")E.loadBinary({model:k.url,
- callback:f(j)});else k.type=="ascii_mesh"&&E.loadAscii({model:k.url,callback:f(j)})}for(l in D.textures){j=D.textures[l];J+=j.url instanceof Array?j.url.length:1}O=J;for(l in D.textures){j=D.textures[l];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)k=ImageUtils.loadTextureCube(j.url,j.mapping,h);else{k=ImageUtils.loadTexture(j.url,j.mapping,h);if(THREE[j.minFilter]!=undefined)k.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)k.magFilter=
- THREE[j.magFilter]}G.textures[l]=k}for(o in D.materials){l=D.materials[o];for(w in l.parameters)if(w=="envMap"||w=="map"||w=="lightMap")l.parameters[w]=G.textures[l.parameters[w]];else if(w=="shading")l.parameters[w]=l.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")l.parameters[w]=THREE[l.parameters[w]]?THREE[l.parameters[w]]:THREE.NormalBlending;else w=="combine"&&(l.parameters[w]=l.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);l=new THREE[l.type](l.parameters);
- G.materials[o]=l}d();c(G)}},addMesh:function(a,c,b,e,h,d,f,g,j,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=h;c.position.z=d;c.rotation.x=f;c.rotation.y=g;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
- return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);
- a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var h=Math.PI,d=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,d,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-d,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,e,0,d,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
- SceneUtils.addMesh(a,c,1,0,-e,0,-d,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}",
- vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
- normal:{uniforms:{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},
- 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}",
- 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}"},
- 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",
- 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}"},
- 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}"},
- 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}",
- fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,h,d=2*Math.ceil(a*3)+1;d>25&&(d=25);h=(d-1)*0.5;b=Array(d);for(c=e=0;c<d;++c){b[c]=Math.exp(-((c-h)*(c-h))/(2*a*a));e+=b[c]}for(c=0;c<d;++c)b[c]/=e;return b}};
- THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;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=
- 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=
- 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=
- !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=
- !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);
- 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 e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
- !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
- THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
- THREE.PathCamera=function(a){function c(k,l){var p=k[0]-l[0],v=k[1]-l[1],t=k[2]-l[2];return Math.sqrt(p*p+v*v+t*t)}function b(k,l,p,v){var t={name:p,fps:0.6,length:v,hierarchy:[]},w,m,B=l.length,z=d(l),I=0;w=B-1;m={parent:-1,keys:[]};m.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};m.keys[w]={time:v,pos:l[w],rot:[0,0,0,1],scl:[1,1,1]};for(w=1;w<B-1;w++){I=v*z.chunks[w]/z.total;m.keys[w]={time:I,pos:l[w]}}t.hierarchy[0]=m;THREE.AnimationHandler.add(t);return new THREE.Animation(k,p,THREE.AnimationHandler.CATMULLROM_FORWARD,
- !1)}function e(k){var l,p,v=k.length,t=[];for(l=0;l<v;l++){p=k[l];t[l]={x:p[0],y:p[1],z:p[2]}}return t}function h(k,l){var p,v,t,w,m,B,z=[],I=e(k),D=new THREE.Spline,E=d(k);z.push(k[0]);for(p=1;p<k.length;p++){linearDistance=c(k[p],k[p-1]);realDistance=E.chunks[p]-E.chunks[p-1];B=Math.ceil(l*realDistance/E.total);w=(p-1)/(k.length-1);m=p/(k.length-1);for(v=1;v<B-1;v++){t=w+v*(1/B)*(m-w);position=D.getPoint(I,t);z.push([position.x,position.y,position.z])}z.push(k[p])}return z}function d(k){var l,p=
- e(k),v=new THREE.Spline,t=l=l=0,w=[0],m=0,B=[k[0][0],k[0][1],k[0][2]];for(k=1;k<p.length*100;k++){l=k/(p.length*100);position=v.getPoint(p,l);m+=c([position.x,position.y,position.z],B);B=[position.x,position.y,position.z];l*=p.length-1;l=Math.floor(l);if(l!=t){w[l]=m;t=l}}w[w.length]=m;return{chunks:w,total:m}}function f(k,l){var p,v,t=new THREE.Geometry,w=new THREE.Spline,m=e(k);for(p=0;p<m.length*l;p++){v=p/(m.length*l);v=w.getPoint(m,v);t.vertices[p]=new THREE.Vertex(new THREE.Vector3(v.x,v.y,
- v.z))}return t}function g(k,l){var p=f(l,10),v=f(l,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(p,t);particleObj=new THREE.ParticleSystem(v,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);k.addChild(lineObj);particleObj.scale.set(1,1,1);k.addChild(particleObj);v=new Sphere(1,16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<l.length;i++){p=new THREE.Mesh(v,t);p.position.set(l[i][0],l[i][1],l[i][2]);p.updateMatrix();
- k.addChild(p)}}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.0050;this.lookVertical=!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;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=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var j=Math.PI*2,o=Math.PI/180;this.update=
- function(k,l,p){var v,t;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)*o;this.theta=this.lon*o;v=this.phi%j;this.phi=v>=0?v:v+j;v=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;this.phi=(this.phi-v[0])*(t[1]-t[0])/(v[1]-v[0])+t[0];v=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;
- this.theta=(this.theta-v[0])*(t[1]-t[0])/(v[1]-v[0])+t[0];v=this.target.position;v.x=100*Math.sin(this.phi)*Math.cos(this.theta);v.y=100*Math.cos(this.phi);v.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,k,l,p)};this.onMouseMove=function(k){this.mouseX=k.clientX-this.windowHalfX;this.mouseY=k.clientY-this.windowHalfY};if(this.useConstantSpeed)this.waypoints=h(this.waypoints,this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var n=
- new THREE.MeshLambertMaterial({color:65280}),y=new Cube(10,10,20),u=new Cube(2,2,10);this.animationParent=new THREE.Mesh(y,a);a=new THREE.Mesh(u,n);a.position.set(0,10,0);this.animation=b(this.animationParent,this.waypoints,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=b(this.animationParent,this.waypoints,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&
- g(this.debugPath,this.waypoints);this.domElement.addEventListener("mousemove",function(k,l){return function(){l.apply(k,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;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
- 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 c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
- c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(h){THREE.Loader.prototype.createModel(h.data,b,e)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:
- THREE.Loader.prototype.extractUrlbase(c),h=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var d=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(f){THREE.Loader.prototype.loadAjaxBuffers(f.data.buffers,f.data.materials,b,h,e,d)};c.onerror=function(f){alert("worker.onerror: "+f.message+"\n"+f.data);f.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,h,d){var f=new XMLHttpRequest,g=e+"/"+a,j=0;
- f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.Loader.prototype.createBinModel(f.responseText,b,h,c):alert("Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(d){j==0&&(j=f.getResponseHeader("Content-Length"));d({total:j,loaded:f.responseText.length})}}else f.readyState==2&&(j=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)},
- createBinModel:function(a,c,b,e){var h=function(d){function f(q,x){var A=n(q,x),C=n(q,x+1),H=n(q,x+2),L=n(q,x+3),P=(L<<1&255|H>>7)-127;A|=(H&127)<<16|C<<8;if(A==0&&P==-127)return 0;return(1-2*(L>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,P)}function g(q,x){var A=n(q,x),C=n(q,x+1),H=n(q,x+2);return(n(q,x+3)<<24)+(H<<16)+(C<<8)+A}function j(q,x){var A=n(q,x);return(n(q,x+1)<<8)+A}function o(q,x){var A=n(q,x);return A>127?A-256:A}function n(q,x){return q.charCodeAt(x)&255}function y(q){var x,A,C;x=g(a,q);
- A=g(a,q+I);C=g(a,q+D);q=j(a,q+E);THREE.Loader.prototype.f3(t,x,A,C,q)}function u(q){var x,A,C,H,L,P;x=g(a,q);A=g(a,q+I);C=g(a,q+D);H=j(a,q+E);L=g(a,q+F);P=g(a,q+J);q=g(a,q+K);THREE.Loader.prototype.f3n(t,B,x,A,C,H,L,P,q)}function k(q){var x,A,C,H;x=g(a,q);A=g(a,q+O);C=g(a,q+G);H=g(a,q+N);q=j(a,q+M);THREE.Loader.prototype.f4(t,x,A,C,H,q)}function l(q){var x,A,C,H,L,P,Z,$;x=g(a,q);A=g(a,q+O);C=g(a,q+G);H=g(a,q+N);L=j(a,q+M);P=g(a,q+X);Z=g(a,q+Y);$=g(a,q+R);q=g(a,q+aa);THREE.Loader.prototype.f4n(t,B,
- x,A,C,H,L,P,Z,$,q)}function p(q){var x,A;x=g(a,q);A=g(a,q+ba);q=g(a,q+ca);THREE.Loader.prototype.uv3(t.uvs,z[x*2],z[x*2+1],z[A*2],z[A*2+1],z[q*2],z[q*2+1])}function v(q){var x,A,C;x=g(a,q);A=g(a,q+da);C=g(a,q+ea);q=g(a,q+fa);THREE.Loader.prototype.uv4(t.uvs,z[x*2],z[x*2+1],z[A*2],z[A*2+1],z[C*2],z[C*2+1],z[q*2],z[q*2+1])}var t=this,w=0,m,B=[],z=[],I,D,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(t,e,d);m={signature:a.substr(w,
- 8),header_bytes:n(a,w+8),vertex_coordinate_bytes:n(a,w+9),normal_coordinate_bytes:n(a,w+10),uv_coordinate_bytes:n(a,w+11),vertex_index_bytes:n(a,w+12),normal_index_bytes:n(a,w+13),uv_index_bytes:n(a,w+14),material_index_bytes:n(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a,w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};
- w+=m.header_bytes;I=m.vertex_index_bytes;D=m.vertex_index_bytes*2;E=m.vertex_index_bytes*3;F=m.vertex_index_bytes*3+m.material_index_bytes;J=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;K=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;O=m.vertex_index_bytes;G=m.vertex_index_bytes*2;N=m.vertex_index_bytes*3;M=m.vertex_index_bytes*4;X=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;R=m.vertex_index_bytes*
- 4+m.material_index_bytes+m.normal_index_bytes*2;aa=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;ba=m.uv_index_bytes;ca=m.uv_index_bytes*2;da=m.uv_index_bytes;ea=m.uv_index_bytes*2;fa=m.uv_index_bytes*3;d=m.vertex_index_bytes*3+m.material_index_bytes;Q=m.vertex_index_bytes*4+m.material_index_bytes;S=m.ntri_flat*d;T=m.ntri_smooth*(d+m.normal_index_bytes*3);U=m.ntri_flat_uv*(d+m.uv_index_bytes*3);V=m.ntri_smooth_uv*(d+m.normal_index_bytes*3+m.uv_index_bytes*3);W=m.nquad_flat*
- Q;d=m.nquad_smooth*(Q+m.normal_index_bytes*4);Q=m.nquad_flat_uv*(Q+m.uv_index_bytes*4);w+=function(q){for(var x,A,C,H=m.vertex_coordinate_bytes*3,L=q+m.nvertices*H;q<L;q+=H){x=f(a,q);A=f(a,q+m.vertex_coordinate_bytes);C=f(a,q+m.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(t,x,A,C)}return m.nvertices*H}(w);w+=function(q){for(var x,A,C,H=m.normal_coordinate_bytes*3,L=q+m.nnormals*H;q<L;q+=H){x=o(a,q);A=o(a,q+m.normal_coordinate_bytes);C=o(a,q+m.normal_coordinate_bytes*2);B.push(x/127,A/127,C/
- 127)}return m.nnormals*H}(w);w+=function(q){for(var x,A,C=m.uv_coordinate_bytes*2,H=q+m.nuvs*C;q<H;q+=C){x=f(a,q);A=f(a,q+m.uv_coordinate_bytes);z.push(x,A)}return m.nuvs*C}(w);S=w+S;T=S+T;U=T+U;V=U+V;W=V+W;d=W+d;Q=d+Q;(function(q){var x,A=m.vertex_index_bytes*3+m.material_index_bytes,C=A+m.uv_index_bytes*3,H=q+m.ntri_flat_uv*C;for(x=q;x<H;x+=C){y(x);p(x+A)}return H-q})(T);(function(q){var x,A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,C=A+m.uv_index_bytes*3,H=q+m.ntri_smooth_uv*
- C;for(x=q;x<H;x+=C){u(x);p(x+A)}return H-q})(U);(function(q){var x,A=m.vertex_index_bytes*4+m.material_index_bytes,C=A+m.uv_index_bytes*4,H=q+m.nquad_flat_uv*C;for(x=q;x<H;x+=C){k(x);v(x+A)}return H-q})(d);(function(q){var x,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,C=A+m.uv_index_bytes*4,H=q+m.nquad_smooth_uv*C;for(x=q;x<H;x+=C){l(x);v(x+A)}return H-q})(Q);(function(q){var x,A=m.vertex_index_bytes*3+m.material_index_bytes,C=q+m.ntri_flat*A;for(x=q;x<C;x+=A)y(x);return C-
- q})(w);(function(q){var x,A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,C=q+m.ntri_smooth*A;for(x=q;x<C;x+=A)u(x);return C-q})(S);(function(q){var x,A=m.vertex_index_bytes*4+m.material_index_bytes,C=q+m.nquad_flat*A;for(x=q;x<C;x+=A)k(x);return C-q})(V);(function(q){var x,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,C=q+m.nquad_smooth*A;for(x=q;x<C;x+=A)l(x);return C-q})(W);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;
- h.prototype.constructor=h;c(new h(b))},createModel:function(a,c,b){var e=function(h){var d=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(d,a.materials,h);(function(){var f,g,j,o,n;f=0;for(g=a.vertices.length;f<g;f+=3){j=a.vertices[f];o=a.vertices[f+1];n=a.vertices[f+2];THREE.Loader.prototype.v(d,j,o,n)}if(a.colors){f=0;for(g=a.colors.length;f<g;f+=3){j=a.colors[f];o=a.colors[f+1];n=a.colors[f+2];THREE.Loader.prototype.vc(d,j,o,n)}}})();(function(){function f(l,p){THREE.Loader.prototype.f3(d,
- l[p],l[p+1],l[p+2],l[p+3])}function g(l,p){THREE.Loader.prototype.f3n(d,a.normals,l[p],l[p+1],l[p+2],l[p+3],l[p+4],l[p+5],l[p+6])}function j(l,p){THREE.Loader.prototype.f4(d,l[p],l[p+1],l[p+2],l[p+3],l[p+4])}function o(l,p){THREE.Loader.prototype.f4n(d,a.normals,l[p],l[p+1],l[p+2],l[p+3],l[p+4],l[p+5],l[p+6],l[p+7],l[p+8])}function n(l,p){var v,t,w,m,B,z,I,D,E;v=l[p];t=l[p+1];w=l[p+2];m=a.uvs[v*2];I=a.uvs[v*2+1];B=a.uvs[t*2];D=a.uvs[t*2+1];z=a.uvs[w*2];E=a.uvs[w*2+1];THREE.Loader.prototype.uv3(d.uvs,
- m,I,B,D,z,E);if(a.uvs2&&a.uvs2.length){m=a.uvs2[v*2];I=a.uvs2[v*2+1];B=a.uvs2[t*2];D=a.uvs2[t*2+1];z=a.uvs2[w*2];E=a.uvs2[w*2+1];THREE.Loader.prototype.uv3(d.uvs2,m,1-I,B,1-D,z,1-E)}}function y(l,p){var v,t,w,m,B,z,I,D,E,F,J,K;v=l[p];t=l[p+1];w=l[p+2];m=l[p+3];B=a.uvs[v*2];E=a.uvs[v*2+1];z=a.uvs[t*2];F=a.uvs[t*2+1];I=a.uvs[w*2];J=a.uvs[w*2+1];D=a.uvs[m*2];K=a.uvs[m*2+1];THREE.Loader.prototype.uv4(d.uvs,B,E,z,F,I,J,D,K);if(a.uvs2){B=a.uvs2[v*2];E=a.uvs2[v*2+1];z=a.uvs2[t*2];F=a.uvs2[t*2+1];I=a.uvs2[w*
- 2];J=a.uvs2[w*2+1];D=a.uvs2[m*2];K=a.uvs2[m*2+1];THREE.Loader.prototype.uv4(d.uvs2,B,1-E,z,1-F,I,1-J,D,1-K)}}var u,k;u=0;for(k=a.trianglesUvs.length;u<k;u+=7){f(a.trianglesUvs,u);n(a.trianglesUvs,u+4)}u=0;for(k=a.trianglesNormalsUvs.length;u<k;u+=10){g(a.trianglesNormalsUvs,u);n(a.trianglesNormalsUvs,u+7)}u=0;for(k=a.quadsUvs.length;u<k;u+=9){j(a.quadsUvs,u);y(a.quadsUvs,u+5)}u=0;for(k=a.quadsNormalsUvs.length;u<k;u+=13){o(a.quadsNormalsUvs,u);y(a.quadsNormalsUvs,u+9)}u=0;for(k=a.triangles.length;u<
- k;u+=4)f(a.triangles,u);u=0;for(k=a.trianglesNormals.length;u<k;u+=7)g(a.trianglesNormals,u);u=0;for(k=a.quads.length;u<k;u+=5)j(a.quads,u);u=0;for(k=a.quadsNormals.length;u<k;u+=9)o(a.quadsNormals,u)})();(function(){var f,g,j,o;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){j=a.skinWeights[f];o=a.skinWeights[f+1];THREE.Loader.prototype.sw(d,j,o,0,0)}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){j=a.skinIndices[f];o=a.skinIndices[f+1];THREE.Loader.prototype.si(d,j,o,0,0)}}THREE.Loader.prototype.bones(d,
- a.bones);THREE.Loader.prototype.animation(d,a.animation)})();this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,e,h){a.skinIndices.push(new THREE.Vector4(c,b,e,h))},sw:function(a,c,b,e,h){a.skinWeights.push(new THREE.Vector4(c,b,e,h))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},vc:function(a,c,b,e){var h=
- new THREE.Color(16777215);h.setRGB(c,b,e);a.colors.push(h)},f3:function(a,c,b,e,h){a.faces.push(new THREE.Face3(c,b,e,null,a.materials[h]))},f4:function(a,c,b,e,h,d){a.faces.push(new THREE.Face4(c,b,e,h,null,a.materials[d]))},f3n:function(a,c,b,e,h,d,f,g,j){d=a.materials[d];var o=c[g*3],n=c[g*3+1];g=c[g*3+2];var y=c[j*3],u=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(c[f*3],c[f*3+1],c[f*3+2]),new THREE.Vector3(o,n,g),new THREE.Vector3(y,u,j)],d))},f4n:function(a,c,b,e,
- h,d,f,g,j,o,n){f=a.materials[f];var y=c[j*3],u=c[j*3+1];j=c[j*3+2];var k=c[o*3],l=c[o*3+1];o=c[o*3+2];var p=c[n*3],v=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(b,e,h,d,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(y,u,j),new THREE.Vector3(k,l,o),new THREE.Vector3(p,v,n)],f))},uv3:function(a,c,b,e,h,d,f){var g=[];g.push(new THREE.UV(c,b));g.push(new THREE.UV(e,h));g.push(new THREE.UV(d,f));a.push(g)},uv4:function(a,c,b,e,h,d,f,g,j){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(e,
- h));o.push(new THREE.UV(d,f));o.push(new THREE.UV(g,j));a.push(o)},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(g){g=Math.log(g)/Math.LN2;return Math.floor(g)==g}function e(g,j){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var n=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),y=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));g.image.width=
- n;g.image.height=y;g.image.getContext("2d").drawImage(this,0,0,n,y)}else g.image=this;g.needsUpdate=!0};o.src=j}var h,d,f;h="MeshLambertMaterial";d={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(h="MeshPhongMaterial");if(a.mapDiffuse&&c){f=document.createElement("canvas");d.map=new THREE.Texture(f);d.map.sourceFile=a.mapDiffuse;e(d.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){f=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+
- a.colorDiffuse[2]*255;d.color=f;d.opacity=a.transparency}else if(a.DbgColor)d.color=a.DbgColor;if(a.mapLightmap&&c){f=document.createElement("canvas");d.lightMap=new THREE.Texture(f);d.lightMap.sourceFile=a.mapLightmap;e(d.lightMap,c+"/"+a.mapLightmap)}return new THREE[h](d)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
- THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];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=
- 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,e,h){return b+(e-b)*h};this.VIntX=function(b,e,h,d,f,g,j,o,n,y){f=(f-n)/(y-n);n=this.normal_cache;e[d]=g+f*this.delta;e[d+1]=j;e[d+2]=o;h[d]=this.lerp(n[b],n[b+3],f);h[d+1]=this.lerp(n[b+1],n[b+4],f);h[d+2]=this.lerp(n[b+2],n[b+5],f)};this.VIntY=function(b,e,h,d,f,g,j,o,n,y){f=(f-n)/(y-n);n=this.normal_cache;e[d]=g;e[d+1]=j+f*this.delta;e[d+
- 2]=o;e=b+this.yd*3;h[d]=this.lerp(n[b],n[e],f);h[d+1]=this.lerp(n[b+1],n[e+1],f);h[d+2]=this.lerp(n[b+2],n[e+2],f)};this.VIntZ=function(b,e,h,d,f,g,j,o,n,y){f=(f-n)/(y-n);n=this.normal_cache;e[d]=g;e[d+1]=j;e[d+2]=o+f*this.delta;e=b+this.zd*3;h[d]=this.lerp(n[b],n[e],f);h[d+1]=this.lerp(n[b+1],n[e+1],f);h[d+2]=this.lerp(n[b+2],n[e+2],f)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
- this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,h,d,f,g){var j=d+1,o=d+this.yd,n=d+this.zd,y=j+this.yd,u=j+this.zd,k=d+this.yd+this.zd,l=j+this.yd+this.zd,p=0,v=this.field[d],t=this.field[j],w=this.field[o],m=this.field[y],B=this.field[n],z=this.field[u],I=this.field[k],D=this.field[l];v<f&&(p|=1);t<f&&(p|=2);w<f&&(p|=8);m<f&&(p|=4);B<f&&(p|=16);z<f&&(p|=32);I<f&&(p|=128);D<f&&(p|=64);var E=THREE.edgeTable[p];if(E==0)return 0;
- var F=this.delta,J=b+F,K=e+F;F=h+F;if(E&1){this.compNorm(d);this.compNorm(j);this.VIntX(d*3,this.vlist,this.nlist,0,f,b,e,h,v,t)}if(E&2){this.compNorm(j);this.compNorm(y);this.VIntY(j*3,this.vlist,this.nlist,3,f,J,e,h,t,m)}if(E&4){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,6,f,b,K,h,w,m)}if(E&8){this.compNorm(d);this.compNorm(o);this.VIntY(d*3,this.vlist,this.nlist,9,f,b,e,h,v,w)}if(E&16){this.compNorm(n);this.compNorm(u);this.VIntX(n*3,this.vlist,this.nlist,12,f,b,e,F,
- B,z)}if(E&32){this.compNorm(u);this.compNorm(l);this.VIntY(u*3,this.vlist,this.nlist,15,f,J,e,F,z,D)}if(E&64){this.compNorm(k);this.compNorm(l);this.VIntX(k*3,this.vlist,this.nlist,18,f,b,K,F,I,D)}if(E&128){this.compNorm(n);this.compNorm(k);this.VIntY(n*3,this.vlist,this.nlist,21,f,b,e,F,B,I)}if(E&256){this.compNorm(d);this.compNorm(n);this.VIntZ(d*3,this.vlist,this.nlist,24,f,b,e,h,v,B)}if(E&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,f,J,e,h,t,z)}if(E&1024){this.compNorm(y);
- this.compNorm(l);this.VIntZ(y*3,this.vlist,this.nlist,30,f,J,K,h,m,D)}if(E&2048){this.compNorm(o);this.compNorm(k);this.VIntZ(o*3,this.vlist,this.nlist,33,f,b,K,h,w,I)}p<<=4;for(f=d=0;THREE.triTable[p+f]!=-1;){b=p+f;e=b+1;h=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[h],g);f+=3;d++}return d};this.posnormtriv=function(b,e,h,d,f,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+
- 3]=b[d];this.positionArray[j+4]=b[d+1];this.positionArray[j+5]=b[d+2];this.positionArray[j+6]=b[f];this.positionArray[j+7]=b[f+1];this.positionArray[j+8]=b[f+2];this.normalArray[j]=e[h];this.normalArray[j+1]=e[h+1];this.normalArray[j+2]=e[h+2];this.normalArray[j+3]=e[d];this.normalArray[j+4]=e[d+1];this.normalArray[j+5]=e[d+2];this.normalArray[j+6]=e[f];this.normalArray[j+7]=e[f+1];this.normalArray[j+8]=e[f+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&g(this)};this.begin=
- function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,h,d,f){var g=this.size*Math.sqrt(d/f),j=h*this.size,o=e*this.size,n=b*this.size,y=Math.floor(j-g);y<1&&(y=1);j=Math.floor(j+g);j>this.size-1&&(j=this.size-1);var u=Math.floor(o-g);u<1&&(u=1);o=Math.floor(o+g);o>this.size-1&&(o=this.size-1);var k=Math.floor(n-g);k<1&&(k=1);g=Math.floor(n+g);
- g>this.size-1&&(g=this.size-1);for(var l,p,v,t,w,m;y<j;y++){n=this.size2*y;p=y/this.size-h;w=p*p;for(p=u;p<o;p++){v=n+this.size*p;l=p/this.size-e;m=l*l;for(l=k;l<g;l++){t=l/this.size-b;t=d/(1.0E-6+t*t+m+w)-f;t>0&&(this.field[v+l]+=t)}}}};this.addPlaneX=function(b,e){var h,d,f,g,j,o=this.size,n=this.yd,y=this.zd,u=this.field,k=o*Math.sqrt(b/e);k>o&&(k=o);for(h=0;h<k;h++){d=h/o;d*=d;g=b/(1.0E-4+d)-e;if(g>0)for(d=0;d<o;d++){j=h+d*n;for(f=0;f<o;f++)u[y*f+j]+=g}}};this.addPlaneY=function(b,e){var h,d,
- f,g,j,o,n=this.size,y=this.yd,u=this.zd,k=this.field,l=n*Math.sqrt(b/e);l>n&&(l=n);for(d=0;d<l;d++){h=d/n;h*=h;g=b/(1.0E-4+h)-e;if(g>0){j=d*y;for(h=0;h<n;h++){o=j+h;for(f=0;f<n;f++)k[u*f+o]+=g}}}};this.addPlaneZ=function(b,e){var h,d,f,g,j,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(f=0;f<dist;f++){h=f/size;h*=h;g=b/(1.0E-4+h)-e;if(g>0){j=zd*f;for(d=0;d<size;d++){o=j+d*yd;for(h=0;h<size;h++)field[o+h]+=g}}}};this.reset=function(){var b;
- for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,h,d,f,g,j,o,n,y,u=this.size-2;for(f=1;f<u;f++){y=this.size2*f;o=(f-this.halfsize)/this.halfsize;for(d=1;d<u;d++){n=y+this.size*d;j=(d-this.halfsize)/this.halfsize;for(h=1;h<u;h++){g=(h-this.halfsize)/this.halfsize;e=n+h;this.polygonize(g,j,o,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;this.render(function(h){var d,f,g,j,o,n,y,u;for(d=
- 0;d<h.count;d++){o=d*3;y=o+1;u=o+2;f=h.positionArray[o];g=h.positionArray[y];j=h.positionArray[u];n=new THREE.Vector3(f,g,j);f=h.normalArray[o];g=h.normalArray[y];j=h.normalArray[u];o=new THREE.Vector3(f,g,j);o.normalize();o=new THREE.Vertex(n,o);e.vertices.push(o)}nfaces=h.count/3;for(d=0;d<nfaces;d++){o=(b+d)*3;y=o+1;u=o+2;n=e.vertices[o].normal;f=e.vertices[y].normal;g=e.vertices[u].normal;o=new THREE.Face3(o,y,u,[n,f,g]);e.faces.push(o)}b+=nfaces;h.count=0});return e};this.init(a)};
- THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
- THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
- 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
- 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
- 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,
- -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,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,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1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
- 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
- var Cube=function(a,c,b,e,h,d,f,g,j){function o(v,t,w,m,B,z,I,D){var E,F,J=e||1,K=h||1,O=B/2,G=z/2,N=n.vertices.length;if(v=="x"&&t=="y"||v=="y"&&t=="x")E="z";else if(v=="x"&&t=="z"||v=="z"&&t=="x"){E="y";K=d||1}else if(v=="z"&&t=="y"||v=="y"&&t=="z"){E="x";J=d||1}var M=J+1,X=K+1;B/=J;var Y=z/K;for(F=0;F<X;F++)for(z=0;z<M;z++){var R=new THREE.Vector3;R[v]=(z*B-O)*w;R[t]=(F*Y-G)*m;R[E]=I;n.vertices.push(new THREE.Vertex(R))}for(F=0;F<K;F++)for(z=0;z<J;z++){n.faces.push(new THREE.Face4(z+M*F+N,z+M*
- (F+1)+N,z+1+M*(F+1)+N,z+1+M*F+N,null,D));n.uvs.push([new THREE.UV(z/J,F/K),new THREE.UV(z/J,(F+1)/K),new THREE.UV((z+1)/J,(F+1)/K),new THREE.UV((z+1)/J,F/K)])}}THREE.Geometry.call(this);var n=this,y=a/2,u=c/2,k=b/2;g=g?-1:1;if(f!==undefined)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var l=0;l<6;l++)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 p in j)this.sides[p]!=undefined&&(this.sides[p]=j[p]);this.sides.px&&
- o("z","y",1*g,-1,b,c,-y,this.materials[0]);this.sides.nx&&o("z","y",-1*g,-1,b,c,y,this.materials[1]);this.sides.py&&o("x","z",1*g,1,a,b,u,this.materials[2]);this.sides.ny&&o("x","z",1*g,-1,a,b,-u,this.materials[3]);this.sides.pz&&o("x","y",1*g,-1,a,c,k,this.materials[4]);this.sides.nz&&o("x","y",-1*g,-1,a,c,-k,this.materials[5]);(function(){for(var v=[],t=[],w=0,m=n.vertices.length;w<m;w++){for(var B=n.vertices[w],z=!1,I=0,D=v.length;I<D;I++){var E=v[I];if(B.position.x==E.position.x&&B.position.y==
- E.position.y&&B.position.z==E.position.z){t[w]=I;z=!0;break}}if(!z){t[w]=v.length;v.push(new THREE.Vertex(B.position.clone()))}}w=0;for(m=n.faces.length;w<m;w++){B=n.faces[w];B.a=t[B.a];B.b=t[B.b];B.c=t[B.c];B.d=t[B.d]}n.vertices=v})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,c,b,e,h){function d(o,n,y){f.vertices.push(new THREE.Vertex(new THREE.Vector3(o,n,y)))}THREE.Geometry.call(this);var f=this,g=Math.PI,j;for(j=0;j<a;j++)d(Math.sin(2*g*j/a)*c,Math.cos(2*g*j/a)*c,0);for(j=0;j<a;j++)d(Math.sin(2*g*j/a)*b,Math.cos(2*g*j/a)*b,e);for(j=0;j<a;j++)f.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b!=0){d(0,0,-h);for(j=a;j<a+a/2;j++)f.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(c!=0){d(0,0,e+h);for(j=a+a/2;j<
- 2*a;j++)f.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;
- var Plane=function(a,c,b,e){THREE.Geometry.call(this);var h,d=a/2,f=c/2;b=b||1;e=e||1;var g=b+1,j=e+1;a/=b;var o=c/e;for(h=0;h<j;h++)for(c=0;c<g;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-d,-(h*o-f),0)));for(h=0;h<e;h++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+g*h,c+g*(h+1),c+1+g*(h+1),c+1+g*h));this.uvs.push([new THREE.UV(c/b,h/e),new THREE.UV(c/b,(h+1)/e),new THREE.UV((c+1)/b,(h+1)/e),new THREE.UV((c+1)/b,h/e)])}this.computeCentroids();this.computeFaceNormals()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,h=Math.PI,d=Math.max(3,c||8),f=Math.max(2,b||6);c=[];for(b=0;b<f+1;b++){e=b/f;var g=a*Math.cos(e*h),j=a*Math.sin(e*h),o=[],n=0;for(e=0;e<d;e++){var y=2*e/d,u=j*Math.sin(y*h);y=j*Math.cos(y*h);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,g,u)))-1);o.push(n)}c.push(o)}var k,l,p;h=c.length;for(b=0;b<h;b++){d=c[b].length;if(b>0)for(e=0;e<d;e++){o=e==d-1;f=c[b][o?0:e+1];g=c[b][o?d-1:e];j=c[b-1][o?d-1:e];o=c[b-1][o?
- 0:e+1];u=b/(h-1);k=(b-1)/(h-1);l=(e+1)/d;y=e/d;n=new THREE.UV(1-l,u);u=new THREE.UV(1-y,u);y=new THREE.UV(1-y,k);var v=new THREE.UV(1-l,k);if(b<c.length-1){k=this.vertices[f].position.clone();l=this.vertices[g].position.clone();p=this.vertices[j].position.clone();k.normalize();l.normalize();p.normalize();this.faces.push(new THREE.Face3(f,g,j,[new THREE.Vector3(k.x,k.y,k.z),new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(p.x,p.y,p.z)]));this.uvs.push([n,u,y])}if(b>1){k=this.vertices[f].position.clone();
- l=this.vertices[j].position.clone();p=this.vertices[o].position.clone();k.normalize();l.normalize();p.normalize();this.faces.push(new THREE.Face3(f,j,o,[new THREE.Vector3(k.x,k.y,k.z),new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(p.x,p.y,p.z)]));this.uvs.push([n,y,v])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var h=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(e),(this.radius+this.tube*Math.cos(h))*Math.sin(e),this.tube*Math.sin(h))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
- 1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;h=(this.segmentsT+1)*c+b-1;var d=(this.segmentsT+1)*(c-1)+b-1,f=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,h,d,f));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[d][0],a[d][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;
- var Icosahedron=function(a){function c(y,u,k){var l=Math.sqrt(y*y+u*u+k*k);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(y/l,u/l,k/l)))-1}function b(y,u,k,l){l.faces.push(new THREE.Face3(y,u,k))}function e(y,u){var k=h.vertices[y].position,l=h.vertices[u].position;return c((k.x+l.x)/2,(k.y+l.y)/2,(k.z+l.z)/2)}var h=this,d=new THREE.Geometry,f;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
- 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,d);b(0,5,1,d);b(0,1,7,d);b(0,7,10,d);b(0,10,11,d);b(1,5,9,d);b(5,11,4,d);b(11,10,2,d);b(10,7,6,d);b(7,1,8,d);b(3,9,4,d);b(3,4,2,d);b(3,2,6,d);b(3,6,8,d);b(3,8,9,d);b(4,9,5,d);b(2,4,11,d);b(6,2,10,d);b(8,6,7,d);b(9,8,1,d);for(a=0;a<this.subdivisions;a++){f=new THREE.Geometry;for(var g in d.faces){var j=e(d.faces[g].a,d.faces[g].b),o=e(d.faces[g].b,d.faces[g].c),n=e(d.faces[g].c,d.faces[g].a);b(d.faces[g].a,j,n,f);b(d.faces[g].b,o,j,f);b(d.faces[g].c,
- n,o,f);b(j,o,n,f)}d.faces=f.faces}h.faces=d.faces;delete d;delete f;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var e=[],h=[],d=[],f=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;e[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),o=0;o<=this.latheAngle+0.0010;o+=this.stepSize){for(g=0;g<e.length;g++)if(o<b){e[g]=j.multiplyVector3(e[g].clone());this.vertices.push(new THREE.Vertex(e[g]));
- d[g]=this.vertices.length-1}else d=f;o==0&&(f=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(d[g],d[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(o/b,g/a.length),new THREE.UV(o/b,(g+1)/a.length),new THREE.UV((o-c)/b,(g+1)/a.length),new THREE.UV((o-c)/b,g/a.length)])}h=d;d=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|