| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- // ThreeExtras.js r32 - http://github.com/mrdoob/three.js
- var GeometryUtils={merge:function(a,e){var b=e instanceof THREE.Mesh,f=a.vertices.length,h=b?e.geometry:e,c=a.vertices,d=h.vertices,g=a.faces,j=h.faces,l=a.uvs;h=h.uvs;b&&e.matrixAutoUpdate&&e.updateMatrix();for(var m=0,v=d.length;m<v;m++){var q=new THREE.Vertex(d[m].position.clone());b&&e.localMatrix.multiplyVector3(q.position);c.push(q)}m=0;for(v=j.length;m<v;m++){d=j[m];var n,p=d.vertexNormals;if(d instanceof THREE.Face3)n=new THREE.Face3(d.a+f,d.b+f,d.c+f);else d instanceof THREE.Face4&&(n=new THREE.Face4(d.a+
- f,d.b+f,d.c+f,d.d+f));n.centroid.copy(d.centroid);n.normal.copy(d.normal);b=0;for(c=p.length;b<c;b++){q=p[b];n.vertexNormals.push(q.clone())}n.materials=d.materials.slice();g.push(n)}m=0;for(v=h.length;m<v;m++){f=h[m];g=[];b=0;for(c=f.length;b<c;b++)g.push(new THREE.UV(f[b].u,f[b].v));l.push(g)}}},ImageUtils={loadTexture:function(a,e,b){var f=new Image;f.onload=function(){this.loaded=!0;b&&b(this)};f.src=a;return new THREE.Texture(f,e)},loadArray:function(a,e){var b,f,h=[];b=h.loadCount=0;for(f=a.length;b<
- f;++b){h[b]=new Image;h[b].loaded=0;h[b].onload=function(){h.loadCount+=1;this.loaded=!0;e&&e(this)};h[b].src=a[b]}return h}},SceneUtils={loadScene:function(a,e,b,f){a=new Worker(a);a.postMessage(0);a.onmessage=function(h){function c(){for(m in A.objects)if(!F.objects[m]){t=A.objects[m];if(k=F.geometries[t.geometry]){J=[];for(i=0;i<t.materials.length;i++)J[i]=F.materials[t.materials[i]];z=t.position;r=t.rotation;s=t.scale;object=new THREE.Mesh(k,J);object.position.set(z[0],z[1],z[2]);object.rotation.set(r[0],
- r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=t.visible;F.scene.addObject(object);F.objects[m]=object}}}function d(P){return function(Q){F.geometries[P]=Q;c();H-=1;g()}}function g(){f({total_models:K,total_textures:M,loaded_models:K-H,loaded_textures:M-I},F);H==0&&I==0&&b(F)}var j,l,m,v,q,n,p,t,z,w,x,k,D,E,J,A,C,H,I,K,M,F;A=h.data;C=new THREE.Loader;I=H=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){I-=1;g()};for(q in A.cameras){w=
- A.cameras[q];if(w.type=="perspective")D=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){D=new THREE.Camera;D.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}z=w.position;w=w.target;D.position.set(z[0],z[1],z[2]);D.target.position.set(w[0],w[1],w[2]);F.cameras[q]=D}for(v in A.lights){q=A.lights[v];if(q.type=="directional"){z=q.direction;light=new THREE.DirectionalLight;light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(q.type==
- "point"){z=q.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}w=q.color;i=q.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);F.scene.addLight(light);F.lights[v]=light}for(n in A.fogs){v=A.fogs[n];if(v.type=="linear")E=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(E=new THREE.FogExp2(0,v.density));w=v.color;E.color.setRGB(w[0],w[1],w[2]);F.fogs[n]=E}if(F.cameras&&A.defaults.camera)F.currentCamera=F.cameras[A.defaults.camera];if(F.fogs&&A.defaults.fog)F.scene.fog=F.fogs[A.defaults.fog];
- w=A.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(w[0],w[1],w[2]);F.bgColorAlpha=A.defaults.bgalpha;for(j in A.geometries){n=A.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh")H+=1}K=H;for(j in A.geometries){n=A.geometries[j];if(n.type=="cube"){k=new Cube(n.width,n.height,n.depth,n.segments_width,n.segments_height,null,n.flipped,n.sides);F.geometries[j]=k}else if(n.type=="plane"){k=new Plane(n.width,n.height,n.segments_width,n.segments_height);F.geometries[j]=k}else if(n.type==
- "sphere"){k=new Sphere(n.radius,n.segments_width,n.segments_height);F.geometries[j]=k}else if(n.type=="cylinder"){k=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);F.geometries[j]=k}else if(n.type=="torus"){k=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);F.geometries[j]=k}else if(n.type=="icosahedron"){k=new Icosahedron(n.subdivisions);F.geometries[j]=k}else if(n.type=="bin_mesh")C.loadBinary({model:n.url,callback:d(j)});else n.type=="ascii_mesh"&&C.loadAscii({model:n.url,
- callback:d(j)})}for(p in A.textures){j=A.textures[p];I+=j.url instanceof Array?j.url.length:1}M=I;for(p in A.textures){j=A.textures[p];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=ImageUtils.loadArray(j.url,h);n=new THREE.Texture(n,j.mapping)}else{n=ImageUtils.loadTexture(j.url,j.mapping,h);if(THREE[j.min_filter]!=undefined)n.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)n.mag_filter=THREE[j.mag_filter]}F.textures[p]=
- n}for(l in A.materials){p=A.materials[l];for(x in p.parameters)if(x=="env_map"||x=="map"||x=="light_map")p.parameters[x]=F.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);F.materials[l]=
- p}c();e(F)}},addMesh:function(a,e,b,f,h,c,d,g,j,l){e=new THREE.Mesh(e,l);e.scale.x=e.scale.y=e.scale.z=b;e.position.x=f;e.position.y=h;e.position.z=c;e.rotation.x=d;e.rotation.y=g;e.rotation.z=j;a.addObject(e);return e},addPanoramaCubeWebGL:function(a,e,b){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragment_shader:f.fragment_shader,vertex_shader:f.vertex_shader,uniforms:f.uniforms});e=new THREE.Mesh(new Cube(e,e,e,1,1,null,!0),b);a.addObject(e);return e},
- addPanoramaCube:function(a,e,b){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));e=new THREE.Mesh(new Cube(e,e,e,1,1,f,!0),new THREE.MeshFaceMaterial);
- a.addObject(e);return e},addPanoramaCubePlanes:function(a,e,b){var f=e/2;e=new Plane(e,e);var h=Math.PI/2,c=Math.PI;SceneUtils.addMesh(a,e,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,e,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,e,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,e,1,0,f,0,h,0,c,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
- SceneUtils.addMesh(a,e,1,0,-f,0,-h,0,c,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}},fragment_shader:"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}",
- vertex_shader:"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}},fragment_shader:"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}",
- vertex_shader:"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}},vertex_shader:"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}",fragment_shader:"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:[]}},vertex_shader:"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}",fragment_shader:"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},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.5;\nconst float fSintensity = 0.05;\nconst float fScount = 4096.0;\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 * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 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}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
- fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,f,h,c=2*Math.ceil(a*3)+1;c>25&&(c=25);h=(c-1)*0.5;b=Array(c);for(e=f=0;e<c;++e){b[e]=Math.exp(-((e-h)*(e-h))/(2*a*a));f+=b[e]}for(e=0;e<c;++e)b[e]/=f;return b}},Cube=function(a,e,b,f,h,c,d,g){function j(t,z,w,x,k,D,E,J){var A,C,H=f||1,I=h||1,K=H+1,M=I+1,F=k/2,P=D/2;k/=H;var Q=D/I,R=l.vertices.length;if(t=="x"&&z=="y"||t=="y"&&z=="x")A="z";else if(t=="x"&&z=="z"||t=="z"&&z=="x")A="y";else if(t==
- "z"&&z=="y"||t=="y"&&z=="z")A="x";for(C=0;C<M;C++)for(D=0;D<K;D++){var S=new THREE.Vector3;S[t]=(D*k-F)*w;S[z]=(C*Q-P)*x;S[A]=E;l.vertices.push(new THREE.Vertex(S))}for(C=0;C<I;C++)for(D=0;D<H;D++){l.faces.push(new THREE.Face4(D+K*C+R,D+K*(C+1)+R,D+1+K*(C+1)+R,D+1+K*C+R,null,J));l.uvs.push([new THREE.UV(D/H,C/I),new THREE.UV(D/H,(C+1)/I),new THREE.UV((D+1)/H,(C+1)/I),new THREE.UV((D+1)/H,C/I)])}}THREE.Geometry.call(this);var l=this,m=a/2,v=e/2,q=b/2;d=d?-1:1;if(c!==undefined)if(c instanceof Array)this.materials=
- c;else{this.materials=[];for(var n=0;n<6;n++)this.materials.push([c])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(g!=undefined)for(var p in g)this.sides[p]!=undefined&&(this.sides[p]=g[p]);this.sides.px&&j("z","y",1*d,-1,b,e,-m,this.materials[0]);this.sides.nx&&j("z","y",-1*d,-1,b,e,m,this.materials[1]);this.sides.py&&j("x","z",1*d,1,a,b,v,this.materials[2]);this.sides.ny&&j("x","z",1*d,-1,a,b,-v,this.materials[3]);this.sides.pz&&j("x","y",1*d,-1,a,e,q,this.materials[4]);
- this.sides.nz&&j("x","y",-1*d,-1,a,e,-q,this.materials[5]);(function(){for(var t=[],z=[],w=0,x=l.vertices.length;w<x;w++){for(var k=l.vertices[w],D=!1,E=0,J=t.length;E<J;E++){var A=t[E];if(k.position.x==A.position.x&&k.position.y==A.position.y&&k.position.z==A.position.z){z[w]=E;D=!0;break}}if(!D){z[w]=t.length;t.push(new THREE.Vertex(k.position.clone()))}}w=0;for(x=l.faces.length;w<x;w++){k=l.faces[w];k.a=z[k.a];k.b=z[k.b];k.c=z[k.c];k.d=z[k.d]}l.vertices=t})();this.computeCentroids();this.computeFaceNormals();
- this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,e,b,f,h){function c(l,m,v){d.vertices.push(new THREE.Vertex(new THREE.Vector3(l,m,v)))}THREE.Geometry.call(this);var d=this,g=Math.PI,j;for(j=0;j<a;j++)c(Math.sin(2*g*j/a)*e,Math.cos(2*g*j/a)*e,0);for(j=0;j<a;j++)c(Math.sin(2*g*j/a)*b,Math.cos(2*g*j/a)*b,f);for(j=0;j<a;j++)d.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b!=0){c(0,0,-h);for(j=a;j<a+a/2;j++)d.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(e!=0){c(0,0,f+h);for(j=a+a/2;j<
- 2*a;j++)d.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();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,e,b,f){THREE.Geometry.call(this);var h,c=a/2,d=e/2;b=b||1;f=f||1;var g=b+1,j=f+1;a/=b;var l=e/f;for(h=0;h<j;h++)for(e=0;e<g;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-c,-(h*l-d),0)));for(h=0;h<f;h++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+g*h,e+g*(h+1),e+1+g*(h+1),e+1+g*h));this.uvs.push([new THREE.UV(e/b,h/f),new THREE.UV(e/b,(h+1)/f),new THREE.UV((e+1)/b,(h+1)/f),new THREE.UV((e+1)/b,h/f)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,e,b){THREE.Geometry.call(this);var f,h=Math.PI,c=Math.max(3,e||8),d=Math.max(2,b||6);e=[];for(b=0;b<d+1;b++){f=b/d;var g=a*Math.cos(f*h),j=a*Math.sin(f*h),l=[],m=0;for(f=0;f<c;f++){var v=2*f/c,q=j*Math.sin(v*h);v=j*Math.cos(v*h);(b==0||b==d)&&f>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,g,q)))-1);l.push(m)}e.push(l)}var n,p,t;h=e.length;for(b=0;b<h;b++){c=e[b].length;if(b>0)for(f=0;f<c;f++){l=f==c-1;d=e[b][l?0:f+1];g=e[b][l?c-1:f];j=e[b-1][l?c-1:f];l=e[b-1][l?
- 0:f+1];q=b/(h-1);n=(b-1)/(h-1);p=(f+1)/c;v=f/c;m=new THREE.UV(1-p,q);q=new THREE.UV(1-v,q);v=new THREE.UV(1-v,n);var z=new THREE.UV(1-p,n);if(b<e.length-1){n=this.vertices[d].position.clone();p=this.vertices[g].position.clone();t=this.vertices[j].position.clone();n.normalize();p.normalize();t.normalize();this.faces.push(new THREE.Face3(d,g,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(t.x,t.y,t.z)]));this.uvs.push([m,q,v])}if(b>1){n=this.vertices[d].position.clone();
- p=this.vertices[j].position.clone();t=this.vertices[l].position.clone();n.normalize();p.normalize();t.normalize();this.faces.push(new THREE.Face3(d,j,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(t.x,t.y,t.z)]));this.uvs.push([m,v,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,e,b,f){this.radius=a||100;this.tube=e||40;this.segmentsR=b||8;this.segmentsT=f||6;a=[];THREE.Geometry.call(this);for(e=0;e<=this.segmentsR;++e)for(b=0;b<=this.segmentsT;++b){f=b/this.segmentsT*2*Math.PI;var h=e/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(f),(this.radius+this.tube*Math.cos(h))*Math.sin(f),this.tube*Math.sin(h))));a.push([b/this.segmentsT,1-e/this.segmentsR])}for(e=1;e<=this.segmentsR;++e)for(b=
- 1;b<=this.segmentsT;++b){f=(this.segmentsT+1)*e+b;h=(this.segmentsT+1)*e+b-1;var c=(this.segmentsT+1)*(e-1)+b-1,d=(this.segmentsT+1)*(e-1)+b;this.faces.push(new THREE.Face4(f,h,c,d));this.uvs.push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[d][0],a[d][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
- var Icosahedron=function(a){function e(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return e((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,d;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
- 1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){d=new THREE.Geometry;for(var g in c.faces){var j=f(c.faces[g].a,c.faces[g].b),l=f(c.faces[g].b,c.faces[g].c),m=f(c.faces[g].c,c.faces[g].a);b(c.faces[g].a,j,m,d);b(c.faces[g].b,l,j,d);b(c.faces[g].c,
- m,l,d);b(j,l,m,d)}c.faces=d.faces}h.faces=c.faces;delete c;delete d;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- function LathedObject(a,e,b){THREE.Geometry.call(this);b=b||2*Math.PI;e=b/(e||12);for(var f=[],h=[],c=[],d=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(e),l=0;l<=b+0.001;l+=e){for(g=0;g<f.length;g++)if(l<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));c[g]=this.vertices.length-1}else c=d;l==0&&(d=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(c[g],
- c[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(l/b,g/a.length),new THREE.UV(l/b,(g+1)/a.length),new THREE.UV((l-e)/b,(g+1)/a.length),new THREE.UV((l-e)/b,g/a.length)])}h=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
- THREE.MarchingCubes=function(a,e){THREE.Object3D.call(this);this.materials=e instanceof Array?e:[e];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,f,h){return b+(f-b)*h};this.VIntX=function(b,f,h,c,d,g,j,l,m,v){d=(d-m)/(v-m);m=this.normal_cache;f[c]=g+d*this.delta;f[c+1]=j;f[c+2]=l;h[c]=this.lerp(m[b],m[b+3],d);h[c+1]=this.lerp(m[b+1],m[b+4],d);h[c+2]=this.lerp(m[b+2],m[b+5],d)};this.VIntY=function(b,f,h,c,d,g,j,l,m,v){d=(d-m)/(v-m);m=this.normal_cache;f[c]=g;f[c+1]=j+d*this.delta;f[c+
- 2]=l;f=b+this.yd*3;h[c]=this.lerp(m[b],m[f],d);h[c+1]=this.lerp(m[b+1],m[f+1],d);h[c+2]=this.lerp(m[b+2],m[f+2],d)};this.VIntZ=function(b,f,h,c,d,g,j,l,m,v){d=(d-m)/(v-m);m=this.normal_cache;f[c]=g;f[c+1]=j;f[c+2]=l+d*this.delta;f=b+this.zd*3;h[c]=this.lerp(m[b],m[f],d);h[c+1]=this.lerp(m[b+1],m[f+1],d);h[c+2]=this.lerp(m[b+2],m[f+2],d)};this.compNorm=function(b){var f=b*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[b-1]-this.field[b+1];this.normal_cache[f+1]=this.field[b-this.yd]-
- this.field[b+this.yd];this.normal_cache[f+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,f,h,c,d,g){var j=c+1,l=c+this.yd,m=c+this.zd,v=j+this.yd,q=j+this.zd,n=c+this.yd+this.zd,p=j+this.yd+this.zd,t=0,z=this.field[c],w=this.field[j],x=this.field[l],k=this.field[v],D=this.field[m],E=this.field[q],J=this.field[n],A=this.field[p];z<d&&(t|=1);w<d&&(t|=2);x<d&&(t|=8);k<d&&(t|=4);D<d&&(t|=16);E<d&&(t|=32);J<d&&(t|=128);A<d&&(t|=64);var C=THREE.edgeTable[t];if(C==0)return 0;
- var H=this.delta,I=b+H,K=f+H;H=h+H;if(C&1){this.compNorm(c);this.compNorm(j);this.VIntX(c*3,this.vlist,this.nlist,0,d,b,f,h,z,w)}if(C&2){this.compNorm(j);this.compNorm(v);this.VIntY(j*3,this.vlist,this.nlist,3,d,I,f,h,w,k)}if(C&4){this.compNorm(l);this.compNorm(v);this.VIntX(l*3,this.vlist,this.nlist,6,d,b,K,h,x,k)}if(C&8){this.compNorm(c);this.compNorm(l);this.VIntY(c*3,this.vlist,this.nlist,9,d,b,f,h,z,x)}if(C&16){this.compNorm(m);this.compNorm(q);this.VIntX(m*3,this.vlist,this.nlist,12,d,b,f,H,
- D,E)}if(C&32){this.compNorm(q);this.compNorm(p);this.VIntY(q*3,this.vlist,this.nlist,15,d,I,f,H,E,A)}if(C&64){this.compNorm(n);this.compNorm(p);this.VIntX(n*3,this.vlist,this.nlist,18,d,b,K,H,J,A)}if(C&128){this.compNorm(m);this.compNorm(n);this.VIntY(m*3,this.vlist,this.nlist,21,d,b,f,H,D,J)}if(C&256){this.compNorm(c);this.compNorm(m);this.VIntZ(c*3,this.vlist,this.nlist,24,d,b,f,h,z,D)}if(C&512){this.compNorm(j);this.compNorm(q);this.VIntZ(j*3,this.vlist,this.nlist,27,d,I,f,h,w,E)}if(C&1024){this.compNorm(v);
- this.compNorm(p);this.VIntZ(v*3,this.vlist,this.nlist,30,d,I,K,h,k,A)}if(C&2048){this.compNorm(l);this.compNorm(n);this.VIntZ(l*3,this.vlist,this.nlist,33,d,b,K,h,x,J)}t<<=4;for(d=c=0;THREE.triTable[t+d]!=-1;){b=t+d;f=b+1;h=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[f],3*THREE.triTable[h],g);d+=3;c++}return c};this.posnormtriv=function(b,f,h,c,d,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[c];this.positionArray[j+4]=b[c+1];this.positionArray[j+5]=b[c+2];this.positionArray[j+6]=b[d];this.positionArray[j+7]=b[d+1];this.positionArray[j+8]=b[d+2];this.normalArray[j]=f[h];this.normalArray[j+1]=f[h+1];this.normalArray[j+2]=f[h+2];this.normalArray[j+3]=f[c];this.normalArray[j+4]=f[c+1];this.normalArray[j+5]=f[c+2];this.normalArray[j+6]=f[d];this.normalArray[j+7]=f[d+1];this.normalArray[j+8]=f[d+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 f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;b(this)}};this.addBall=function(b,f,h,c,d){var g=this.size*Math.sqrt(c/d),j=h*this.size,l=f*this.size,m=b*this.size,v=Math.floor(j-g);v<1&&(v=1);j=Math.floor(j+g);j>this.size-1&&(j=this.size-1);var q=Math.floor(l-g);q<1&&(q=1);l=Math.floor(l+g);l>this.size-1&&(l=this.size-1);var n=Math.floor(m-g);n<1&&(n=1);g=Math.floor(m+g);
- g>this.size-1&&(g=this.size-1);for(var p,t,z,w,x,k;v<j;v++){m=this.size2*v;t=v/this.size-h;x=t*t;for(t=q;t<l;t++){z=m+this.size*t;p=t/this.size-f;k=p*p;for(p=n;p<g;p++){w=p/this.size-b;w=c/(1.0E-6+w*w+k+x)-d;w>0&&(this.field[z+p]+=w)}}}};this.addPlaneX=function(b,f){var h,c,d,g,j,l=this.size,m=this.yd,v=this.zd,q=this.field,n=l*Math.sqrt(b/f);n>l&&(n=l);for(h=0;h<n;h++){c=h/l;c*=c;g=b/(1.0E-4+c)-f;if(g>0)for(c=0;c<l;c++){j=h+c*m;for(d=0;d<l;d++)q[v*d+j]+=g}}};this.addPlaneY=function(b,f){var h,c,
- d,g,j,l,m=this.size,v=this.yd,q=this.zd,n=this.field,p=m*Math.sqrt(b/f);p>m&&(p=m);for(c=0;c<p;c++){h=c/m;h*=h;g=b/(1.0E-4+h)-f;if(g>0){j=c*v;for(h=0;h<m;h++){l=j+h;for(d=0;d<m;d++)n[q*d+l]+=g}}}};this.addPlaneZ=function(b,f){var h,c,d,g,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/f);dist>size&&(dist=size);for(d=0;d<dist;d++){h=d/size;h*=h;g=b/(1.0E-4+h)-f;if(g>0){j=zd*d;for(c=0;c<size;c++){l=j+c*yd;for(h=0;h<size;h++)field[l+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 f,h,c,d,g,j,l,m,v,q=this.size-2;for(d=1;d<q;d++){v=this.size2*d;l=(d-this.halfsize)/this.halfsize;for(c=1;c<q;c++){m=v+this.size*c;j=(c-this.halfsize)/this.halfsize;for(h=1;h<q;h++){g=(h-this.halfsize)/this.halfsize;f=m+h;this.polygonize(g,j,l,f,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,f=new THREE.Geometry;this.render(function(h){var c,d,g,j,l,m,v,q;for(c=
- 0;c<h.count;c++){l=c*3;v=l+1;q=l+2;d=h.positionArray[l];g=h.positionArray[v];j=h.positionArray[q];m=new THREE.Vector3(d,g,j);d=h.normalArray[l];g=h.normalArray[v];j=h.normalArray[q];l=new THREE.Vector3(d,g,j);l.normalize();l=new THREE.Vertex(m,l);f.vertices.push(l)}nfaces=h.count/3;for(c=0;c<nfaces;c++){l=(b+c)*3;v=l+1;q=l+2;m=f.vertices[l].normal;d=f.vertices[v].normal;g=f.vertices[q].normal;l=new THREE.Face3(l,v,q,[m,d,g]);f.faces.push(l)}b+=nfaces;h.count=0});f.sortFacesByMaterial();return f};
- 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,-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,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-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]);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 e="Loaded ";e+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
- e},loadAsciiOld:function(a,e){var b=document.createElement("script");b.type="text/javascript";b.onload=e;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var e=a.model,b=a.callback,f=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);e.onmessage=function(h){THREE.Loader.prototype.createModel(h.data,b,f)};e.postMessage(a)},loadBinary:function(a){var e=a.model,b=a.callback,f=a.texture_path?a.texture_path:
- THREE.Loader.prototype.extractUrlbase(e),h=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);var c=this.showProgress?THREE.Loader.prototype.updateProgress:null;e.onmessage=function(d){THREE.Loader.prototype.loadAjaxBuffers(d.data.buffers,d.data.materials,b,h,f,c)};e.onerror=function(d){alert("worker.onerror: "+d.message+"\n"+d.data);d.preventDefault()};e.postMessage(a)},loadAjaxBuffers:function(a,e,b,f,h,c){var d=new XMLHttpRequest,g=f+"/"+a,j=0;
- d.onreadystatechange=function(){if(d.readyState==4)d.status==200||d.status==0?THREE.Loader.prototype.createBinModel(d.responseText,b,h,e):alert("Couldn't load ["+g+"] ["+d.status+"]");else if(d.readyState==3){if(c){j==0&&(j=d.getResponseHeader("Content-Length"));c({total:j,loaded:d.responseText.length})}}else d.readyState==2&&(j=d.getResponseHeader("Content-Length"))};d.open("GET",g,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)},
- createBinModel:function(a,e,b,f){var h=function(c){function d(o,u){var y=m(o,u),B=m(o,u+1),G=m(o,u+2),L=m(o,u+3),N=(L<<1&255|G>>7)-127;y|=(G&127)<<16|B<<8;if(y==0&&N==-127)return 0;return(1-2*(L>>7))*(1+y*Math.pow(2,-23))*Math.pow(2,N)}function g(o,u){var y=m(o,u),B=m(o,u+1),G=m(o,u+2);return(m(o,u+3)<<24)+(G<<16)+(B<<8)+y}function j(o,u){var y=m(o,u);return(m(o,u+1)<<8)+y}function l(o,u){var y=m(o,u);return y>127?y-256:y}function m(o,u){return o.charCodeAt(u)&255}function v(o){var u,y,B;u=g(a,o);
- y=g(a,o+J);B=g(a,o+A);o=j(a,o+C);THREE.Loader.prototype.f3(w,u,y,B,o)}function q(o){var u,y,B,G,L,N;u=g(a,o);y=g(a,o+J);B=g(a,o+A);G=j(a,o+C);L=g(a,o+H);N=g(a,o+I);o=g(a,o+K);THREE.Loader.prototype.f3n(w,D,u,y,B,G,L,N,o)}function n(o){var u,y,B,G;u=g(a,o);y=g(a,o+M);B=g(a,o+F);G=g(a,o+P);o=j(a,o+Q);THREE.Loader.prototype.f4(w,u,y,B,G,o)}function p(o){var u,y,B,G,L,N,Y,Z;u=g(a,o);y=g(a,o+M);B=g(a,o+F);G=g(a,o+P);L=j(a,o+Q);N=g(a,o+R);Y=g(a,o+S);Z=g(a,o+$);o=g(a,o+aa);THREE.Loader.prototype.f4n(w,D,
- u,y,B,G,L,N,Y,Z,o)}function t(o){var u,y;u=g(a,o);y=g(a,o+ba);o=g(a,o+ca);THREE.Loader.prototype.uv3(w.uvs,E[u*2],E[u*2+1],E[y*2],E[y*2+1],E[o*2],E[o*2+1])}function z(o){var u,y,B;u=g(a,o);y=g(a,o+da);B=g(a,o+ea);o=g(a,o+fa);THREE.Loader.prototype.uv4(w.uvs,E[u*2],E[u*2+1],E[y*2],E[y*2+1],E[B*2],E[B*2+1],E[o*2],E[o*2+1])}var w=this,x=0,k,D=[],E=[],J,A,C,H,I,K,M,F,P,Q,R,S,$,aa,ba,ca,da,ea,fa,T,U,V,W,X,O;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);k={signature:a.substr(x,
- 8),header_bytes:m(a,x+8),vertex_coordinate_bytes:m(a,x+9),normal_coordinate_bytes:m(a,x+10),uv_coordinate_bytes:m(a,x+11),vertex_index_bytes:m(a,x+12),normal_index_bytes:m(a,x+13),uv_index_bytes:m(a,x+14),material_index_bytes:m(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};
- x+=k.header_bytes;J=k.vertex_index_bytes;A=k.vertex_index_bytes*2;C=k.vertex_index_bytes*3;H=k.vertex_index_bytes*3+k.material_index_bytes;I=k.vertex_index_bytes*3+k.material_index_bytes+k.normal_index_bytes;K=k.vertex_index_bytes*3+k.material_index_bytes+k.normal_index_bytes*2;M=k.vertex_index_bytes;F=k.vertex_index_bytes*2;P=k.vertex_index_bytes*3;Q=k.vertex_index_bytes*4;R=k.vertex_index_bytes*4+k.material_index_bytes;S=k.vertex_index_bytes*4+k.material_index_bytes+k.normal_index_bytes;$=k.vertex_index_bytes*
- 4+k.material_index_bytes+k.normal_index_bytes*2;aa=k.vertex_index_bytes*4+k.material_index_bytes+k.normal_index_bytes*3;ba=k.uv_index_bytes;ca=k.uv_index_bytes*2;da=k.uv_index_bytes;ea=k.uv_index_bytes*2;fa=k.uv_index_bytes*3;c=k.vertex_index_bytes*3+k.material_index_bytes;O=k.vertex_index_bytes*4+k.material_index_bytes;T=k.ntri_flat*c;U=k.ntri_smooth*(c+k.normal_index_bytes*3);V=k.ntri_flat_uv*(c+k.uv_index_bytes*3);W=k.ntri_smooth_uv*(c+k.normal_index_bytes*3+k.uv_index_bytes*3);X=k.nquad_flat*
- O;c=k.nquad_smooth*(O+k.normal_index_bytes*4);O=k.nquad_flat_uv*(O+k.uv_index_bytes*4);x+=function(o){for(var u,y,B,G=k.vertex_coordinate_bytes*3,L=o+k.nvertices*G;o<L;o+=G){u=d(a,o);y=d(a,o+k.vertex_coordinate_bytes);B=d(a,o+k.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,u,y,B)}return k.nvertices*G}(x);x+=function(o){for(var u,y,B,G=k.normal_coordinate_bytes*3,L=o+k.nnormals*G;o<L;o+=G){u=l(a,o);y=l(a,o+k.normal_coordinate_bytes);B=l(a,o+k.normal_coordinate_bytes*2);D.push(u/127,y/127,B/
- 127)}return k.nnormals*G}(x);x+=function(o){for(var u,y,B=k.uv_coordinate_bytes*2,G=o+k.nuvs*B;o<G;o+=B){u=d(a,o);y=d(a,o+k.uv_coordinate_bytes);E.push(u,y)}return k.nuvs*B}(x);T=x+T;U=T+U;V=U+V;W=V+W;X=W+X;c=X+c;O=c+O;(function(o){var u,y=k.vertex_index_bytes*3+k.material_index_bytes,B=y+k.uv_index_bytes*3,G=o+k.ntri_flat_uv*B;for(u=o;u<G;u+=B){v(u);t(u+y)}return G-o})(U);(function(o){var u,y=k.vertex_index_bytes*3+k.material_index_bytes+k.normal_index_bytes*3,B=y+k.uv_index_bytes*3,G=o+k.ntri_smooth_uv*
- B;for(u=o;u<G;u+=B){q(u);t(u+y)}return G-o})(V);(function(o){var u,y=k.vertex_index_bytes*4+k.material_index_bytes,B=y+k.uv_index_bytes*4,G=o+k.nquad_flat_uv*B;for(u=o;u<G;u+=B){n(u);z(u+y)}return G-o})(c);(function(o){var u,y=k.vertex_index_bytes*4+k.material_index_bytes+k.normal_index_bytes*4,B=y+k.uv_index_bytes*4,G=o+k.nquad_smooth_uv*B;for(u=o;u<G;u+=B){p(u);z(u+y)}return G-o})(O);(function(o){var u,y=k.vertex_index_bytes*3+k.material_index_bytes,B=o+k.ntri_flat*y;for(u=o;u<B;u+=y)v(u);return B-
- o})(x);(function(o){var u,y=k.vertex_index_bytes*3+k.material_index_bytes+k.normal_index_bytes*3,B=o+k.ntri_smooth*y;for(u=o;u<B;u+=y)q(u);return B-o})(T);(function(o){var u,y=k.vertex_index_bytes*4+k.material_index_bytes,B=o+k.nquad_flat*y;for(u=o;u<B;u+=y)n(u);return B-o})(W);(function(o){var u,y=k.vertex_index_bytes*4+k.material_index_bytes+k.normal_index_bytes*4,B=o+k.nquad_smooth*y;for(u=o;u<B;u+=y)p(u);return B-o})(X);this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- h.prototype=new THREE.Geometry;h.prototype.constructor=h;e(new h(b))},createModel:function(a,e,b){var f=function(h){var c=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(c,a.materials,h);(function(){var d,g,j,l,m;d=0;for(g=a.vertices.length;d<g;d+=3){j=a.vertices[d];l=a.vertices[d+1];m=a.vertices[d+2];THREE.Loader.prototype.v(c,j,l,m)}if(a.colors){d=0;for(g=a.colors.length;d<g;d+=3){j=a.colors[d];l=a.colors[d+1];m=a.colors[d+2];THREE.Loader.prototype.vc(c,j,l,m)}}})();(function(){function d(p,
- t){THREE.Loader.prototype.f3(c,p[t],p[t+1],p[t+2],p[t+3])}function g(p,t){THREE.Loader.prototype.f3n(c,a.normals,p[t],p[t+1],p[t+2],p[t+3],p[t+4],p[t+5],p[t+6])}function j(p,t){THREE.Loader.prototype.f4(c,p[t],p[t+1],p[t+2],p[t+3],p[t+4])}function l(p,t){THREE.Loader.prototype.f4n(c,a.normals,p[t],p[t+1],p[t+2],p[t+3],p[t+4],p[t+5],p[t+6],p[t+7],p[t+8])}function m(p,t){var z,w,x,k,D,E,J,A,C;z=p[t];w=p[t+1];x=p[t+2];k=a.uvs[z*2];J=a.uvs[z*2+1];D=a.uvs[w*2];A=a.uvs[w*2+1];E=a.uvs[x*2];C=a.uvs[x*2+1];
- THREE.Loader.prototype.uv3(c.uvs,k,J,D,A,E,C);if(a.uvs2&&a.uvs2.length){k=a.uvs2[z*2];J=a.uvs2[z*2+1];D=a.uvs2[w*2];A=a.uvs2[w*2+1];E=a.uvs2[x*2];C=a.uvs2[x*2+1];THREE.Loader.prototype.uv3(c.uvs2,k,1-J,D,1-A,E,1-C)}}function v(p,t){var z,w,x,k,D,E,J,A,C,H,I,K;z=p[t];w=p[t+1];x=p[t+2];k=p[t+3];D=a.uvs[z*2];C=a.uvs[z*2+1];E=a.uvs[w*2];H=a.uvs[w*2+1];J=a.uvs[x*2];I=a.uvs[x*2+1];A=a.uvs[k*2];K=a.uvs[k*2+1];THREE.Loader.prototype.uv4(c.uvs,D,C,E,H,J,I,A,K);if(a.uvs2){D=a.uvs2[z*2];C=a.uvs2[z*2+1];E=a.uvs2[w*
- 2];H=a.uvs2[w*2+1];J=a.uvs2[x*2];I=a.uvs2[x*2+1];A=a.uvs2[k*2];K=a.uvs2[k*2+1];THREE.Loader.prototype.uv4(c.uvs2,D,1-C,E,1-H,J,1-I,A,1-K)}}var q,n;q=0;for(n=a.triangles_uv.length;q<n;q+=7){d(a.triangles_uv,q);m(a.triangles_uv,q+4)}q=0;for(n=a.triangles_n_uv.length;q<n;q+=10){g(a.triangles_n_uv,q);m(a.triangles_n_uv,q+7)}q=0;for(n=a.quads_uv.length;q<n;q+=9){j(a.quads_uv,q);v(a.quads_uv,q+5)}q=0;for(n=a.quads_n_uv.length;q<n;q+=13){l(a.quads_n_uv,q);v(a.quads_n_uv,q+9)}q=0;for(n=a.triangles.length;q<
- n;q+=4)d(a.triangles,q);q=0;for(n=a.triangles_n.length;q<n;q+=7)g(a.triangles_n,q);q=0;for(n=a.quads.length;q<n;q+=5)j(a.quads,q);q=0;for(n=a.quads_n.length;q<n;q+=9)l(a.quads_n,q)})();(function(){var d,g,j,l;if(a.skinWeights){d=0;for(g=a.skinWeights.length;d<g;d+=2){j=a.skinWeights[d];l=a.skinWeights[d+1];THREE.Loader.prototype.sw(c,j,l,0,0)}}if(a.skinIndices){d=0;for(g=a.skinIndices.length;d<g;d+=2){j=a.skinIndices[d];l=a.skinIndices[d+1];THREE.Loader.prototype.si(c,j,l,0,0)}}THREE.Loader.prototype.bones(c,
- a.bones);THREE.Loader.prototype.animation(c,a.animation)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;e(new f(b))},bones:function(a,e){a.bones=e},animation:function(a,e){a.animation=e},si:function(a,e,b,f,h){a.skinIndices.push(new THREE.Vector4(e,b,f,h))},sw:function(a,e,b,f,h){a.skinWeights.push(new THREE.Vector4(e,b,f,h))},v:function(a,e,b,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(e,b,f)))},
- vc:function(a,e,b,f){var h=new THREE.Color(16777215);h.setRGB(e,b,f);a.colors.push(h)},f3:function(a,e,b,f,h){a.faces.push(new THREE.Face3(e,b,f,null,a.materials[h]))},f4:function(a,e,b,f,h,c){a.faces.push(new THREE.Face4(e,b,f,h,null,a.materials[c]))},f3n:function(a,e,b,f,h,c,d,g,j){c=a.materials[c];var l=e[g*3],m=e[g*3+1];g=e[g*3+2];var v=e[j*3],q=e[j*3+1];j=e[j*3+2];a.faces.push(new THREE.Face3(b,f,h,[new THREE.Vector3(e[d*3],e[d*3+1],e[d*3+2]),new THREE.Vector3(l,m,g),new THREE.Vector3(v,q,j)],
- c))},f4n:function(a,e,b,f,h,c,d,g,j,l,m){d=a.materials[d];var v=e[j*3],q=e[j*3+1];j=e[j*3+2];var n=e[l*3],p=e[l*3+1];l=e[l*3+2];var t=e[m*3],z=e[m*3+1];m=e[m*3+2];a.faces.push(new THREE.Face4(b,f,h,c,[new THREE.Vector3(e[g*3],e[g*3+1],e[g*3+2]),new THREE.Vector3(v,q,j),new THREE.Vector3(n,p,l),new THREE.Vector3(t,z,m)],d))},uv3:function(a,e,b,f,h,c,d){var g=[];g.push(new THREE.UV(e,b));g.push(new THREE.UV(f,h));g.push(new THREE.UV(c,d));a.push(g)},uv4:function(a,e,b,f,h,c,d,g,j){var l=[];l.push(new THREE.UV(e,
- b));l.push(new THREE.UV(f,h));l.push(new THREE.UV(c,d));l.push(new THREE.UV(g,j));a.push(l)},init_materials:function(a,e,b){a.materials=[];for(var f=0;f<e.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(e[f],b)]},createMaterial:function(a,e){function b(g){g=Math.log(g)/Math.LN2;return Math.floor(g)==g}function f(g,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var m=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/
- Math.LN2));g.image.width=m;g.image.height=v;g.image.getContext("2d").drawImage(this,0,0,m,v)}else g.image=this;g.image.loaded=1};l.src=j}var h,c,d;h="MeshLambertMaterial";c={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(h="MeshPhongMaterial");if(a.map_diffuse&&e){d=document.createElement("canvas");c.map=new THREE.Texture(d);f(c.map,e+"/"+a.map_diffuse)}else if(a.col_diffuse){d=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
- 255;c.color=d;c.opacity=a.transparency}else if(a.a_dbg_color)c.color=a.a_dbg_color;if(a.map_lightmap&&e){d=document.createElement("canvas");c.light_map=new THREE.Texture(d);f(c.light_map,e+"/"+a.map_lightmap)}return new THREE[h](c)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|