123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- // ThreeExtras.js r42 - http://github.com/mrdoob/three.js
- THREE.ColorUtils={adjustHSV:function(a,b,c,g){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.ColorUtils.clamp(e.h+b,0,1);e.s=THREE.ColorUtils.clamp(e.s+c,0,1);e.v=THREE.ColorUtils.clamp(e.v+g,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,g=a.g,e=a.b,h=Math.max(Math.max(c,g),e),f=Math.min(Math.min(c,g),e);if(f==h)f=c=0;else{var j=h-f,f=j/h,c=c==h?(g-e)/j:g==h?2+(e-c)/j:4+(c-g)/j;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=h;return b},
- clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
- var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,g=a.vertices.length,e=c?b.geometry:b,h=a.vertices,f=e.vertices,j=a.faces,k=e.faces,l=a.faceVertexUvs[0],e=e.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,o=f.length;m<o;m++){var n=new THREE.Vertex(f[m].position.clone());c&&b.matrix.multiplyVector3(n.position);h.push(n)}m=0;for(o=k.length;m<o;m++){var f=k[m],t,v,y=f.vertexNormals,n=f.vertexColors;f instanceof THREE.Face3?t=new THREE.Face3(f.a+g,f.b+g,f.c+g):
- f instanceof THREE.Face4&&(t=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));t.normal.copy(f.normal);c=0;for(h=y.length;c<h;c++)v=y[c],t.vertexNormals.push(v.clone());t.color.copy(f.color);c=0;for(h=n.length;c<h;c++)v=n[c],t.vertexColors.push(v.clone());t.materials=f.materials.slice();t.centroid.copy(f.centroid);j.push(t)}m=0;for(o=e.length;m<o;m++){g=e[m];j=[];c=0;for(h=g.length;c<h;c++)j.push(new THREE.UV(g[c].u,g[c].v));l.push(j)}}};
- THREE.ImageUtils={loadTexture:function(a,b,c){var g=new Image,e=new THREE.Texture(g,b);g.onload=function(){e.needsUpdate=!0;c&&c(this)};g.crossOrigin="";g.src=a;return e},loadTextureCube:function(a,b,c){var g,e=[],h=new THREE.Texture(e,b),b=e.loadCount=0;for(g=a.length;b<g;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount==6)h.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return h}};
- THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,g,e=a.children.length;for(g=0;g<e;g++)c=a.children[g],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
- if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
- normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},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},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
- THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( 1.0 );\nvec4 mColor = vec4( uDiffuseColor, uOpacity );\nvec4 mSpecular = vec4( uSpecularColor, uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\nif( enableAO )\ngl_FragColor = gl_FragColor * texture2D( tAO, vUv );\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointTotal = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = specularTex.r * pow( pointDotNormalHalf, uShininess );\npointTotal += pointDistance * vec4( pointLightColor[ i ], 1.0 ) * ( mColor * pointDiffuseWeight + mSpecular * pointSpecularWeight * pointDiffuseWeight );\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirTotal = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = specularTex.r * pow( dirDotNormalHalf, uShininess );\ndirTotal += vec4( directionalLightColor[ i ], 1.0 ) * ( mColor * dirDiffuseWeight + mSpecular * dirSpecularWeight * dirDiffuseWeight );\n}\n#endif\nvec4 totalLight = vec4( ambientLightColor * uAmbientColor, uOpacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirTotal;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointTotal;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:"attribute vec4 tangent;\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;\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\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;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\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 b,c,g,e,h=2*Math.ceil(a*3)+1;h>25&&(h=25);e=(h-1)*0.5;c=Array(h);for(b=g=0;b<h;++b)c[b]=Math.exp(-((b-e)*(b-e))/(2*a*a)),g+=c[b];for(b=0;b<h;++b)c[b]/=g;return c}};
- THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var f=0;f<a.hierarchy[c].keys.length;f++){if(a.hierarchy[c].keys[f].time<
- 0)a.hierarchy[c].keys[f].time=0;if(a.hierarchy[c].keys[f].rot!==void 0&&!(a.hierarchy[c].keys[f].rot instanceof THREE.Quaternion)){var g=a.hierarchy[c].keys[f].rot;a.hierarchy[c].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){g={};for(f=0;f<a.hierarchy[c].keys.length;f++)for(var k=0;k<a.hierarchy[c].keys[f].morphTargets.length;k++){var l=a.hierarchy[c].keys[f].morphTargets[k];g[l]=-1}a.hierarchy[c].usedMorphTargets=g;for(f=0;f<a.hierarchy[c].keys.length;f++){var m=
- {};for(l in g){for(k=0;k<a.hierarchy[c].keys[f].morphTargets.length;k++)if(a.hierarchy[c].keys[f].morphTargets[k]===l){m[l]=a.hierarchy[c].keys[f].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[f].morphTargets.length&&(m[l]=0)}a.hierarchy[c].keys[f].morphTargetsInfluences=m}}for(f=1;f<a.hierarchy[c].keys.length;f++)a.hierarchy[c].keys[f].time===a.hierarchy[c].keys[f-1].time&&(a.hierarchy[c].keys.splice(f,1),f--);for(f=1;f<a.hierarchy[c].keys.length;f++)a.hierarchy[c].keys[f].index=f}f=parseInt(a.length*
- a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(f));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else g(a,c);return c}},g=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)g(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
- 2;return c}();THREE.Animation=function(a,b,c,g){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==void 0?g:!0;this.points=[];this.target=new THREE.Vector3};
- THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,g=this.hierarchy.length,e;for(c=0;c<g;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
- THREE.Bone?e.skinMatrix:e.matrix;var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
- THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
- THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
- THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,g,e,h,f,j,k,l,m=this.data.JIT.hierarchy,o,n;this.currentTime+=a*this.timeScale;n=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,v=this.hierarchy.length;t<v;t++)if(a=this.hierarchy[t],k=a.animationCache,this.JITCompile&&m[t][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
- !1):(a.matrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var y=0;y<3;y++){c=b[y];f=k.prevKey[c];j=k.nextKey[c];if(j.time<=n){if(o<n)if(this.loop){f=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<o;)f=j,j=this.getNextKeyWith(c,t,j.index+1)}else{this.stop();return}else{do f=j,j=this.getNextKeyWith(c,t,j.index+1);while(j.time<
- o)}k.prevKey[c]=f;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(o-f.time)/(j.time-f.time);e=f[c];h=j[c];if(g<0||g>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+t),g=g<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(h[0]-e[0])*g,c.y=e[1]+(h[1]-e[1])*g,c.z=e[2]+(h[2]-e[2])*g;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
- this.getPrevKeyWith("pos",t,f.index-1).pos,this.points[1]=e,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,j.index+1).pos,g=g*0.33+0.33,e=this.interpolateCatmullRom(this.points,g),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)g=this.interpolateCatmullRom(this.points,g*1.01),this.target.set(g[0],g[1],g[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),g=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,g,0)}else if(c===
- "rot")THREE.Quaternion.slerp(e,h,a.quaternion,g);else if(c==="scl")c=a.scale,c.x=e[0]+(h[0]-e[0])*g,c.y=e[1]+(h[1]-e[1])*g,c.z=e[2]+(h[2]-e[2])*g}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)m[t][l]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],g=[],e,h,f,j,k,l;e=(a.length-1)*b;h=Math.floor(e);e-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];j=a[c[1]];k=a[c[2]];l=a[c[3]];c=e*e;f=e*c;g[0]=this.interpolate(h[0],j[0],k[0],l[0],e,c,f);g[1]=this.interpolate(h[1],j[1],k[1],l[1],e,c,f);g[2]=this.interpolate(h[2],j[2],k[2],l[2],e,c,f);return g};
- THREE.Animation.prototype.interpolate=function(a,b,c,g,e,h,f){a=(c-a)*0.5;g=(g-b)*0.5;return(2*(b-c)+a+g)*f+(-3*(b-c)-2*a-g)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var g=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<g.length-1?c:g.length-1:c%=g.length;c<g.length;c++)if(g[c][a]!==void 0)return g[c];return this.data.hierarchy[b].keys[0]};
- THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var g=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+g.length;c>=0;c--)if(g[c][a]!==void 0)return g[c];return this.data.hierarchy[b].keys[g.length-1]};
- THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,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.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
- a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
- void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
- a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
- !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=
- this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);this.moveRight&&this.translateX(b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&
- (this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}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;if(this.constrainVertical)this.phi=
- (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),
- !1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
- THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
- THREE.PathCamera=function(a){function b(a,c,b,f){var g={name:b,fps:0.6,length:f,hierarchy:[]},e,h=c.getControlPointsArray(),j=c.getLength(),k=h.length,x=0;e=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[e]={time:f,pos:h[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<k-1;e++)x=f*j.chunks[e]/j.total,c.keys[e]={time:x,pos:h[e]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
- f,e=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)f=b/(a.points.length*c),f=a.getPoint(f),e.vertices[b]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return e}function g(a,b){var f=c(b,10),e=c(b,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(e,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);e=new THREE.SphereGeometry(1,
- 16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)f=new THREE.Mesh(e,g),f.position.copy(b.points[i]),f.updateMatrix(),a.addChild(f)}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.lookHorizontal=
- this.lookVertical=!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!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
- void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)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 e=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var f,g;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)*h;this.theta=this.lon*h;f=this.phi%e;this.phi=f>=0?f:f+e;f=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
- TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/j)*j+g[0];f=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;j=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/j)*j+g[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.mouseX=
- a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),f=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,f);a.position.set(0,10,0);this.animation=
- b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&g(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,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.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
- a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=
- 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
- this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
- case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),e=b.size[0]/2,h=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-e)/e;this.moveState.pitchDown=(a.clientY-
- b.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff*
- this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward||
- this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
- document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
- this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
- THREE.RollCamera=function(a,b,c,g){THREE.Camera.call(this,a,b,c,g);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,o=0,n=0,t=0,v=0,y=window.innerWidth/2,u=window.innerHeight/2;this.update=
- function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*t),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*o);this.translateY(a*n);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
- else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);h.set(0,1,0);e.cross(h,f).normalize();h.cross(f,e).normalize();this.matrix.n11=e.x;this.matrix.n12=h.x;this.matrix.n13=f.x;this.matrix.n21=e.y;this.matrix.n22=h.y;this.matrix.n23=f.y;this.matrix.n31=e.z;this.matrix.n32=h.z;this.matrix.n33=f.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
- this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
- this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){e.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);e.multiplyScalar(a);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(a){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(a);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
- function(a){t=(a.clientX-y)/window.innerWidth;v=(a.clientY-u)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:o=-1;break;
- case 40:case 83:m=-1;break;case 39:case 68:o=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:o=0;break;case 40:case 83:m=0;break;case 39:case 68:o=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:n=0;break;case 70:n=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
- THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
- THREE.TrackballCamera=function(a){function b(a,c){return function(){c.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
- !1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,g=this.STATE.NONE,e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-
- this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=b.length();f>1?b.normalize():b.z=Math.sqrt(1-f*f);e=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(b.y);f.addSelf(this.up.clone().crossSelf(e).setLength(b.x));f.addSelf(e.setLength(b.z));return f};
- this.rotateCamera=function(){var a=Math.acos(h.dot(f)/h.length()/f.length());if(a){var c=(new THREE.Vector3).cross(h,f).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(e);b.multiplyVector3(this.up);b.multiplyVector3(f);this.staticMoving?h=f:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};
- this.panCamera=function(){var a=m.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(e.length()*this.panSpeed);var c=e.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?l=m:l.addSelf(a.sub(m,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
- e.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,e.setLength(this.minDistance))};this.update=function(a,c,b){e=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,e);this.checkDistances();this.supr.update.call(this,a,c,b)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
- b(this,function(a){c&&(h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);g!==this.STATE.NONE&&(g===this.STATE.ROTATE?f=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):g===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
- a.stopPropagation();if(g===this.STATE.NONE)g=a.button,g===this.STATE.ROTATE?h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?j=k=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=m=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();g=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(g===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])g=
- this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)g=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)g=this.STATE.PAN;g!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(g!==this.STATE.NONE)g=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
- THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Path=function(a){this.actions=[];a&&this.fromPoints(a)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru"};THREE.Path.prototype.fromPoints=function(a){var b=0,c=a.length;this.moveTo(a[0].x,a[0].y);for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};
- THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};THREE.Path.prototype.lineTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.LINE_TO,args:a})};THREE.Path.prototype.quadraticCurveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:a})};
- THREE.Path.prototype.bezierCurveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:a})};THREE.Path.prototype.splineThru=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:a})};
- THREE.Path.prototype.getPoints=function(a){var a=a||12,b=[],c,g,e,h,f,j,k,l,m,o,n,t,v;c=0;for(g=this.actions.length;c<g;c++)switch(e=this.actions[c],h=e.action,e=e.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];f=e[3];l=e[0];m=e[1];b.length>0?(n=b[b.length-1],o=n.x,n=n.y):(n=this.actions[c-1].args,o=n[n.length-2],n=n[n.length-1]);for(e=1;e<=a;e++)t=e/a,v=THREE.FontUtils.b2(t,o,l,h),t=THREE.FontUtils.b2(t,n,m,f),b.push(new THREE.Vector2(v,
- t));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];f=e[5];l=e[0];m=e[1];j=e[2];k=e[3];b.length>0?(n=b[b.length-1],o=n.x,n=n.y):(n=this.actions[c-1].args,o=n[n.length-2],n=n[n.length-1]);for(e=1;e<=a;e++)t=e/a,v=THREE.FontUtils.b3(t,o,l,j,h),t=THREE.FontUtils.b3(t,n,m,k,f),b.push(new THREE.Vector2(v,t));break;case THREE.PathActions.CSPLINE_THRU:n=this.actions[c-1].args;j=new THREE.Vector2(n[n.length-2],n[n.length-1]);h=e[0];f=a*h.length;h.unshift(j);j=new Spline2;for(e=0;e<f;e++)b.push(j.get2DPoint(h,
- e/f))}return b};var Spline2=function(){function a(a,c,b,e,g){var a=(b-a)*0.5,e=(e-c)*0.5,h=g*g;return(2*c-2*b+a+e)*g*h+(-3*c+3*b-2*a-e)*h+a*g+c}var b=[],c,g,e,h;this.get2DPoint=function(f,j){c=new THREE.Vector2;g=(f.length-1)*j;e=Math.floor(g);h=g-e;b[0]=e==0?e:e-1;b[1]=e;b[2]=e>f.length-2?e:e+1;b[3]=e>f.length-3?e:e+2;c.x=a(f[b[0]].x,f[b[1]].x,f[b[2]].x,f[b[3]].x,h);c.y=a(f[b[0]].y,f[b[1]].y,f[b[2]].y,f[b[3]].y,h);return c}};
- THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),b,c,g,e;b=c=Number.NEGATIVE_INFINITY;g=e=Number.POSITIVE_INFINITY;var h,f,j;f=0;for(j=a.length;f<j;f++){h=a[f];if(h.x>b)b=h.x;else if(h.x<g)g=h.x;if(h.y>c)c=h.y;else if(h.y<c)e=h.y}return{minX:g,minY:e,maxX:b,maxY:c}};
- THREE.Path.prototype.debug=function(a){var b=this.getMinAndMax();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,g,e,a=0;for(c=this.actions.length;a<c;a++)g=this.actions[a],e=g.args,g=g.action,g!=THREE.PathActions.CSPLINE_THRU&&b[g].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";g=this.getPoints();
- a=0;for(c=g.length;a<c;a++)e=g[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.triangulate=function(){var a=this.getPoints();THREE.FontUtils.Triangulate.area(a)>0&&(a=a.reverse());return THREE.FontUtils.Triangulate(a,!0)};
- THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
- THREE.CubeGeometry=function(a,b,c,g,e,h,f,j,k){function l(a,c,b,f,j,k,l,o){var t,n,v=g||1,y=e||1,C=j/2,J=k/2,L=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")t="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")t="y",y=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")t="x",v=h||1;var H=v+1,N=y+1;j/=v;var O=k/y;for(n=0;n<N;n++)for(k=0;k<H;k++){var B=new THREE.Vector3;B[a]=(k*j-C)*b;B[c]=(n*O-J)*f;B[t]=l;m.vertices.push(new THREE.Vertex(B))}for(n=0;n<y;n++)for(k=0;k<v;k++)m.faces.push(new THREE.Face4(k+H*n+
- L,k+H*(n+1)+L,k+1+H*(n+1)+L,k+1+H*n+L,null,null,o)),m.faceVertexUvs[0].push([new THREE.UV(k/v,n/y),new THREE.UV(k/v,(n+1)/y),new THREE.UV((k+1)/v,(n+1)/y),new THREE.UV((k+1)/v,n/y)])}THREE.Geometry.call(this);var m=this,o=a/2,n=b/2,t=c/2,j=j?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var y in k)this.sides[y]!=void 0&&(this.sides[y]=
- k[y]);this.sides.px&&l("z","y",1*j,-1,c,b,-o,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,o,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,n,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-n,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var a=[],c=[],b=0,f=m.vertices.length;b<f;b++){for(var e=m.vertices[b],g=!1,h=0,j=a.length;h<j;h++){var k=a[h];if(e.position.x==k.position.x&&
- e.position.y==k.position.y&&e.position.z==k.position.z){c[b]=h;g=!0;break}}if(!g)c[b]=a.length,a.push(new THREE.Vertex(e.position.clone()))}b=0;for(f=m.faces.length;b<f;b++)e=m.faces[b],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e.d=c[e.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
- THREE.CylinderGeometry=function(a,b,c,g,e,h){function f(a,c,b){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=g/2;for(k=0;k<a;k++)f(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)f(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c>0){f(0,0,-m-(h||0));for(k=a;k<a+a/2;k++)j.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b>0){f(0,0,m+
- (e||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){var b=[],c=this.faces[k],e=this.vertices[c.a],h=this.vertices[c.b],m=this.vertices[c.c],o=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/l,0.5+e.position.z/g));b.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/g));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
- g));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/l,0.5+o.position.z/g));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
- THREE.ExtrudeGeometry=function(a,b){function c(a,c,b){t.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b){y?t.faces.push(new THREE.Face3(b,c,a)):t.faces.push(new THREE.Face3(a,c,b))}function e(a,c,b,f){y?t.faces.push(new THREE.Face4(f,b,c,a)):t.faces.push(new THREE.Face4(a,c,b,f))}var h=b.amount!==void 0?b.amount:100,f=b.bezelThickness!==void 0?b.bezelThickness:10,j=b.bezelEnabled!==void 0?b.bezelEnabled:!1,k=b.steps!==void 0?b.steps:1,l=b.path!==void 0?b.path:null,m,o=!1;
- if(l)m=l.getPoints(),k=m.length,o=!0;THREE.Geometry.call(this);var l=a.getPoints(),n=a.triangulate(),t=this,v=[],y=THREE.FontUtils.Triangulate.area(l)>0,u,w,x=l.length,p,z=n.length,A=v.length;for(u=0;u<x;u++)w=l[u],c(w.x,w.y,0);for(p=1;p<=k;p++)for(u=0;u<x;u++)w=l[u],o?c(w.x,w.y+m[p-1].y,m[p-1].x):c(w.x,w.y,h/k*p);if(j){for(u=0;u<A;u++)p=v[u],c(p.x,p.y,f);for(u=0;u<A;u++)p=v[u],c(p.x,p.y,h-f)}for(u=0;u<z;u++)p=n[u],g(p[2],p[1],p[0]);for(u=0;u<z;u++)p=n[u],g(p[0]+x*k,p[1]+x*k,p[2]+x*k);for(u=l.length;--u>=
- 0;){h=u;f=u-1;f<0&&(f=l.length-1);for(p=0;p<k;p++)n=x*p,z=x*(p+1),e(h+n,f+n,f+z,h+z)}this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
- THREE.IcosahedronGeometry=function(a){function b(a,c,b){var f=Math.sqrt(a*a+c*c+b*b);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/f,c/f,b/f)))-1}function c(a,c,b,f){f.faces.push(new THREE.Face3(a,c,b))}function g(a,c){var f=e.vertices[a].position,g=e.vertices[c].position;return b((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var e=this,h=new THREE.Geometry,f;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
- -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(a=0;a<this.subdivisions;a++){f=new THREE.Geometry;for(var j in h.faces){var k=g(h.faces[j].a,h.faces[j].b),l=g(h.faces[j].b,h.faces[j].c),m=g(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,f);c(h.faces[j].b,l,k,f);
- c(h.faces[j].c,m,l,f);c(k,l,m,f)}h.faces=f.faces}e.faces=h.faces;delete h;delete f;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
- THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],g=[],e=[],h=[],f=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),g[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=f.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),e[j]=this.vertices.length-1):e=h;k==0&&(h=g);
- for(j=0;j<g.length-1;j++)this.faces.push(new THREE.Face4(e[j],e[j+1],g[j+1],g[j])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,j/a.length),new THREE.UV(1-k/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,j/a.length)]);g=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
- THREE.PlaneGeometry=function(a,b,c,g){THREE.Geometry.call(this);var e,h=a/2,f=b/2,c=c||1,g=g||1,j=c+1,k=g+1;a/=c;var l=b/g;for(e=0;e<k;e++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(e*l-f),0)));for(e=0;e<g;e++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*e,b+j*(e+1),b+1+j*(e+1),b+1+j*e)),this.faceVertexUvs[0].push([new THREE.UV(b/c,e/g),new THREE.UV(b/c,(e+1)/g),new THREE.UV((b+1)/c,(e+1)/g),new THREE.UV((b+1)/c,e/g)]);this.computeCentroids();this.computeFaceNormals()};
- THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
- THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,g,e=Math.PI,h=Math.max(3,b||8),f=Math.max(2,c||6),b=[],c=0;c<f+1;c++){g=c/f;var j=a*Math.cos(g*e),k=a*Math.sin(g*e),l=[],m=0;for(g=0;g<h;g++){var o=2*g/h,n=k*Math.sin(o*e),o=k*Math.cos(o*e);(c==0||c==f)&&g>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,j,n)))-1);l.push(m)}b.push(l)}for(var t,v,y,e=b.length,c=0;c<e;c++)if(h=b[c].length,c>0)for(g=0;g<h;g++){l=g==h-1;f=b[c][l?0:g+1];j=b[c][l?h-1:g];k=b[c-1][l?
- h-1:g];l=b[c-1][l?0:g+1];n=c/(e-1);t=(c-1)/(e-1);v=(g+1)/h;var o=g/h,m=new THREE.UV(1-v,n),n=new THREE.UV(1-o,n),o=new THREE.UV(1-o,t),u=new THREE.UV(1-v,t);c<b.length-1&&(t=this.vertices[f].position.clone(),v=this.vertices[j].position.clone(),y=this.vertices[k].position.clone(),t.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([m,n,o]));c>1&&(t=
- this.vertices[f].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),t.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([m,o,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
- THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){THREE.Geometry.call(this);this.parameters=b||{};this.set(a)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
- THREE.TextGeometry.prototype.set=function(a,b){function c(a,c,b){v.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b,f){v.faces.push(new THREE.Face4(a,c,b,f))}this.text=a;var b=b||this.parameters,e=b.height!==void 0?b.height:50,h=b.curveSegments!==void 0?b.curveSegments:4,f=b.font!==void 0?b.font:"helvetiker",j=b.weight!==void 0?b.weight:"normal",k=b.style!==void 0?b.style:"normal",l=b.bezelThickness!==void 0?b.bezelThickness:10,m=b.bezelSize!==void 0?b.bezelSize:8,o=b.bezelEnabled!==
- void 0?b.bezelEnabled:!1;THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=f;THREE.FontUtils.weight=j;THREE.FontUtils.style=k;THREE.FontUtils.bezelSize=m;var j=THREE.FontUtils.drawText(a),h=j.points,n=j.faces,f=j.contour,t=j.bezel,v=this;v.vertices=[];v.faces=[];for(var y,k=h.length,u=n.length,m=t.length,j=0;j<k;j++)y=h[j],c(y.x,y.y,0);for(j=0;j<k;j++)y=h[j],c(y.x,y.y,e);if(o){for(j=0;j<m;j++)y=t[j],c(y.x,y.y,l);for(j=0;j<m;j++)y=t[j],c(y.x,y.y,e-l)}for(j=
- 0;j<u;j++)e=n[j],v.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(j=0;j<u;j++)e=n[j],v.faces.push(new THREE.Face3(e[0]+k,e[1]+k,e[2]+k));var w;if(o)for(j=t.length;--j>0;){if(w){if(w.equals(f[j])){w=null;continue}}else w=f[j];l=k*2+j;n=l-1;g(l,n,n+m,l+m);for(o=0;o<k;o++)if(h[o].equals(f[j]))break;for(e=0;e<k;e++)if(h[e].equals(f[j-1]))break;g(o,e,n,l);g(l+m,n+m,e+k,o+k)}else for(j=f.length;--j>0;){if(w){if(w.equals(f[j])){w=null;continue}}else w=f[j];for(o=0;o<k;o++)if(h[o].equals(f[j]))break;for(e=
- 0;e<k;e++)if(h[e].equals(f[j-1]))break;g(o,e,e+k,o+k)}this.computeCentroids();this.computeFaceNormals()};
- THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a,b){if(a.length<3)return console.log("not valid polygon"),
- {points:a,faces:[]};for(var c,g,e,h,f,j=[],k=0;k<b.length;k++){f=b[k];h=[];for(c=0;c<f.length;c++)g=f[c],h.push(g.x+","+g.y);var l;c=h.slice(1).indexOf(h[0]);var m=this.Triangulate.area(f.slice(0,c+1))<0;g=[];for(c=-1;c<h.length;){l=c+1;c=h[l];c=h.slice(l+1).indexOf(c)+l;if(c<=l)break;var o=f.slice(l,c+1);m?this.Triangulate.area(o)<0?(l>0&&j.push({shape:e,holes:g}),e=o,g=[]):g.push(o):this.Triangulate.area(o)<0?(j.push({shape:o,holes:g}),g=[]):g.push(o);c++}m&&j.push({shape:e,holes:g})}var n,t,v,
- y,u,w;h=[];for(f=0;f<j.length;f++){k=j[f];e=k.shape;g=k.holes;for(l=0;l<g.length;l++){m=g[l];v=Number.POSITIVE_INFINITY;for(o=0;o<m.length;o++){u=m[o];for(c=0;c<e.length;c++)y=e[c],y=u.distanceTo(y),y<v&&(v=y,n=o,t=c)}c=t-1>=0?t-1:e.length-1;var o=n-1>=0?n-1:m.length-1,x=[];x.push(m[n]);x.push(e[t]);x.push(e[c]);v=this.Triangulate.area(x);var p=[];p.push(m[n]);p.push(m[o]);p.push(e[t]);u=this.Triangulate.area(p);y=t;w=n;t+=1;n+=-1;t<0&&(t+=e.length);t%=e.length;n<0&&(n+=m.length);n%=e.length;c=t-
- 1>=0?t-1:e.length-1;o=n-1>=0?n-1:m.length-1;x=[];x.push(m[n]);x.push(e[t]);x.push(e[c]);x=this.Triangulate.area(x);p=[];p.push(m[n]);p.push(m[o]);p.push(e[t]);p=this.Triangulate.area(p);v+u>x+p&&(t=y,n=w,t<0&&(t+=e.length),t%=e.length,n<0&&(n+=m.length),n%=e.length,c=t-1>=0?t-1:e.length-1,o=n-1>=0?n-1:m.length-1);v=e.slice(0,t);u=e.slice(t);y=m.slice(n);w=m.slice(0,n);h.push(m[n]);h.push(e[t]);h.push(e[c]);h.push(m[n]);h.push(m[o]);h.push(e[t]);e=v.concat(y).concat(w).concat(u)}k.shape=e}n=[];t=[];
- for(f=l=0;f<j.length;f++){k=j[f];e=k.shape;n=n.concat(e);m=THREE.FontUtils.Triangulate(e,!0);for(g=0;g<m.length;g++)k=m[g],k[0]+=l,k[1]+=l,k[2]+=l;t=t.concat(m);l+=e.length}var z;for(g=0;g<h.length/3;g++){k=[];for(j=0;j<3;j++){f=!1;for(e=0;e<n.length&&!f;e++)z=g*3+j,n[e].equals(h[z])&&(k.push(e),f=!0);f||(n.push(h[z]),k.push(n.length-1),console.log("not found"))}t.push(k)}return{points:n,faces:t}},drawText:function(a){var b=[],c=[],g,e=this.getFace(),h=this.size/e.resolution,f=0;g=String(a).split("");
- for(var j=g.length,k=[],a=0;a<j;a++){var l=this.extractGlyphPoints(g[a],e,h,f);f+=l.offset;b.push(l.points);c=c.concat(l.points);k.push(l.path)}a=f/2;for(g=0;g<c.length;g++)c[g].x-=a;b=this.extractPoints(c,b);b.contour=c;e=[];h=[];g=[];for(var f=[],j=new THREE.Vector2,m,a=c.length;--a>=0;){if(m){if(m.equals(c[a])){m=null;k=this.Triangulate.area(g)>0;f.push(k);h.push(j.divideScalar(g.length));g=[];j=new THREE.Vector2;continue}}else m=c[a];j.addSelf(c[a]);g.push(c[a])}a=c.length;for(g=0;--a>=0;)k=c[a],
- j=h[g],k=k.clone().subSelf(j),l=this.bezelSize/k.length(),f[g]?l+=1:l=1-l,l=k.multiplyScalar(l).addSelf(j),e.unshift(l),m?m.equals(c[a])&&(m=null,g++):m=c[a];b.bezel=e;return b},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,g){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,g)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,
- b){return a*a*a*b},b3:function(a,b,c,g,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,g)+this.b3p3(a,e)},extractGlyphPoints:function(a,b,c,g){var e=[],h=new THREE.Path,f,j,k,l,m,o,n,t,v,y,u=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+g;l=b[a++]*c;e.push(new THREE.Vector2(j,l));h.moveTo(j,l);break;case "l":j=b[a++]*c+g;l=b[a++]*c;e.push(new THREE.Vector2(j,
- l));h.lineTo(j,l);break;case "q":j=b[a++]*c+g;l=b[a++]*c;n=b[a++]*c+g;t=b[a++]*c;h.quadraticCurveTo(n,t,j,l);if(f=e[e.length-1]){m=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var w=f/divisions,x=THREE.FontUtils.b2(w,m,n,j),w=THREE.FontUtils.b2(w,o,t,l);e.push(new THREE.Vector2(x,w))}}break;case "b":if(j=b[a++]*c+g,l=b[a++]*c,n=b[a++]*c+g,t=b[a++]*-c,v=b[a++]*c+g,y=b[a++]*-c,h.quadraticCurveTo(j,l,n,t,v,y),f=e[e.length-1]){m=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)w=
- f/divisions,x=THREE.FontUtils.b3(w,m,n,v,j),w=THREE.FontUtils.b3(w,o,t,y,l),e.push(new THREE.Vector2(x,w))}}}h.debug(document.getElementById("boo"));console.log(h);return{offset:u.ha*c,points:e,path:h}}}};
- (function(a){var b=function(a){for(var b=a.length,e=0,h=b-1,f=0;f<b;h=f++)e+=a[h].x*a[f].y-a[f].x*a[h].y;return e*0.5};a.Triangulate=function(a,g){var e=a.length;if(e<3)return null;var h=[],f=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(g)return j;return h}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);m=l+1;e<=m&&(m=0);var n;a:{n=a;var t=k,v=l,y=m,u=e,w=f,x=void 0,p=void 0,z=void 0,
- A=void 0,E=void 0,F=void 0,G=void 0,D=void 0,K=void 0,p=n[w[t]].x,z=n[w[t]].y,A=n[w[v]].x,E=n[w[v]].y,F=n[w[y]].x,G=n[w[y]].y;if(1.0E-10>(A-p)*(G-z)-(E-z)*(F-p))n=!1;else{for(x=0;x<u;x++)if(!(x==t||x==v||x==y)){var D=n[w[x]].x,K=n[w[x]].y,I=void 0,C=void 0,J=void 0,L=void 0,H=void 0,N=void 0,O=void 0,B=void 0,P=void 0,M=void 0,R=void 0,S=void 0,I=J=H=void 0,I=F-A,C=G-E,J=p-F,L=z-G,H=A-p,N=E-z,O=D-p,B=K-z,P=D-A,M=K-E,R=D-F,S=K-G,I=I*M-C*P,H=H*B-N*O,J=J*S-L*R;if(I>=0&&J>=0&&H>=0){n=!1;break a}}n=!0}}if(n){o=
- f[k];n=f[l];t=f[m];h.push(a[o]);h.push(a[n]);h.push(a[t]);j.push([f[k],f[l],f[m]]);k=l;for(m=l+1;m<e;k++,m++)f[k]=f[m];e--;o=2*e}}if(g)return j;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
- THREE.TorusGeometry=function(a,b,c,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=g||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var g=c/this.segmentsT*2*Math.PI,e=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(g),(this.radius+this.tube*Math.cos(e))*Math.sin(g),this.tube*Math.sin(e))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
- 1;c<=this.segmentsT;++c){var g=(this.segmentsT+1)*b+c,e=(this.segmentsT+1)*b+c-1,h=(this.segmentsT+1)*(b-1)+c-1,f=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(g,e,h,f));this.faceVertexUvs[0].push([new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[f][0],a[f][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
- THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
- THREE.TorusKnotGeometry=function(a,b,c,g,e,h,f){function j(a,c,b,f,e,g){c=b/f*a;b=Math.cos(c);return new THREE.Vector3(e*(2+b)*0.5*Math.cos(a),e*(2+b)*Math.sin(a)*0.5,g*e*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=g||8;this.p=e||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;g=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
- this.segmentsT;++b){var k=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=j(k,f,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=k.x-e.x;c.y=k.y-e.y;c.z=k.z-e.z;g.x=k.x+e.x;g.y=k.y+e.y;g.z=k.z+e.z;h.cross(c,g);g.cross(h,c);h.normalize();g.normalize();k=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=k*g.x+f*h.x;e.y+=k*g.y+f*h.y;e.z+=k*g.z+f*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
- e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var g=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[g][b],g=this.grid[g][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,g,h));this.faceVertexUvs[0].push([f,k,l,m])}this.computeCentroids();
- this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
- this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var g=0;g<b.length;++g)a.materials[g]=[THREE.Loader.prototype.createMaterial(b[g],c)]},hasNormals:function(a){var b,c,g=a.materials.length;for(c=0;c<g;c++)if(b=a.materials[c][0],b instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function g(a,b){var f=
- new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=!0};f.src=b}function e(a,c,f,e,h,j){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=f;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=
- 1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[c].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[c].wrapT=e[j[1]]}g(a[c],b+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,j,k;j="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?j="MeshPhongMaterial":a.shading=="Basic"&&(j="MeshBasicMaterial"));
- if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
- else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
- a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),o=f.color;j=f.specular;k=f.ambient;var n=f.shininess;m.tNormal.texture=f.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(f.map)m.tDiffuse.texture=f.map,m.enableDiffuse.value=!0;if(f.specularMap)m.tSpecular.texture=f.specularMap,m.enableSpecular.value=!0;if(f.lightMap)m.tAO.texture=
- f.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(o);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=n;if(f.opacity)m.uOpacity.value=f.opacity;f=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else f=new THREE[j](f);return f}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
- THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,g=a.callback,e=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,g,e);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
- THREE.JSONLoader.prototype.createModel=function(a,b,c){var g=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.init_materials(g,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,e,k,l,m,o,n,t,v,y,u,w,x,p,z=a.faces;o=a.vertices;var A=a.normals,E=a.colors,F=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&F++;for(b=0;b<F;b++)g.faceUvs[b]=[],g.faceVertexUvs[b]=[];l=0;for(m=o.length;l<m;)n=new THREE.Vertex,n.position.x=o[l++]*c,n.position.y=
- o[l++]*c,n.position.z=o[l++]*c,g.vertices.push(n);l=0;for(m=z.length;l<m;){c=z[l++];o=c&1;k=c&2;b=c&4;e=c&8;t=c&16;n=c&32;y=c&64;c&=128;o?(u=new THREE.Face4,u.a=z[l++],u.b=z[l++],u.c=z[l++],u.d=z[l++],o=4):(u=new THREE.Face3,u.a=z[l++],u.b=z[l++],u.c=z[l++],o=3);if(k)k=z[l++],u.materials=g.materials[k];k=g.faces.length;if(b)for(b=0;b<F;b++)w=a.uvs[b],v=z[l++],p=w[v*2],v=w[v*2+1],g.faceUvs[b][k]=new THREE.UV(p,v);if(e)for(b=0;b<F;b++){w=a.uvs[b];x=[];for(e=0;e<o;e++)v=z[l++],p=w[v*2],v=w[v*2+1],x[e]=
- new THREE.UV(p,v);g.faceVertexUvs[b][k]=x}if(t)t=z[l++]*3,e=new THREE.Vector3,e.x=A[t++],e.y=A[t++],e.z=A[t],u.normal=e;if(n)for(b=0;b<o;b++)t=z[l++]*3,e=new THREE.Vector3,e.x=A[t++],e.y=A[t++],e.z=A[t],u.vertexNormals.push(e);if(y)n=z[l++],n=new THREE.Color(E[n]),u.color=n;if(c)for(b=0;b<o;b++)n=z[l++],n=new THREE.Color(E[n]),u.vertexColors.push(n);g.faces.push(u)}}})(e);(function(){var c,b,e,k;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)e=a.skinWeights[c],k=a.skinWeights[c+1],g.skinWeights.push(new THREE.Vector4(e,
- k,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)e=a.skinIndices[c],k=a.skinIndices[c+1],g.skinIndices.push(new THREE.Vector4(e,k,0,0))}g.bones=a.bones;g.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,e,k,l,m,o,n,t,v;b=0;for(e=a.morphTargets.length;b<e;b++){g.morphTargets[b]={};g.morphTargets[b].name=a.morphTargets[b].name;g.morphTargets[b].vertices=[];t=g.morphTargets[b].vertices;v=a.morphTargets[b].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*c,o=v[k+1]*
- c,n=v[k+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(m,o,n)))}}if(a.morphColors!==void 0){b=0;for(e=a.morphColors.length;b<e;b++){g.morphColors[b]={};g.morphColors[b].name=a.morphColors[b].name;g.morphColors[b].colors=[];l=g.morphColors[b].colors;m=a.morphColors[b].colors;c=0;for(k=m.length;c<k;c+=3)o=new THREE.Color(16755200),o.setRGB(m[c],m[c+1],m[c+2]),l.push(o)}}})(e);(function(){if(a.edges!==void 0){var c,b,e;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],e=a.edges[c+1],g.edges.push(new THREE.Edge(g.vertices[b],
- g.vertices[e],b,e))}})();g.computeCentroids();g.computeFaceNormals();this.hasNormals(g)&&g.computeTangents();b(g)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
- THREE.BinaryLoader.prototype={load:function(a){var b=a.model,c=a.callback,g=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,e,g,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
- b.postMessage(a)},loadAjaxBuffers:function(a,b,c,g,e,h){var f=new XMLHttpRequest,j=g+"/"+a,k=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,e,b):alert("Couldn't load ["+j+"] ["+f.status+"]"):f.readyState==3?h&&(k==0&&(k=f.getResponseHeader("Content-Length")),h({total:k,loaded:f.responseText.length})):f.readyState==2&&(k=f.getResponseHeader("Content-Length"))};f.open("GET",j,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
- f.setRequestHeader("Content-Type","text/plain");f.send(null)},createBinModel:function(a,b,c,g){var e=function(c){function b(a,c){var e=m(a,c),g=m(a,c+1),f=m(a,c+2),h=m(a,c+3),j=(h<<1&255|f>>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function e(a,c){var b=m(a,c),g=m(a,c+1),f=m(a,c+2);return(m(a,c+3)<<24)+(f<<16)+(g<<8)+b}function k(a,c){var b=m(a,c);return(m(a,c+1)<<8)+b}function l(a,c){var b=m(a,c);return b>127?b-256:b}function m(a,
- c){return a.charCodeAt(c)&255}function o(c){var b,g,f;b=e(a,c);g=e(a,c+E);f=e(a,c+F);c=k(a,c+G);THREE.BinaryLoader.prototype.f3(w,b,g,f,c)}function n(c){var b,g,f,h,l,m;b=e(a,c);g=e(a,c+E);f=e(a,c+F);h=k(a,c+G);l=e(a,c+D);m=e(a,c+K);c=e(a,c+I);THREE.BinaryLoader.prototype.f3n(w,z,b,g,f,h,l,m,c)}function t(c){var b,g,f,h;b=e(a,c);g=e(a,c+C);f=e(a,c+J);h=e(a,c+L);c=k(a,c+H);THREE.BinaryLoader.prototype.f4(w,b,g,f,h,c)}function v(c){var b,g,f,h,l,m,n,o;b=e(a,c);g=e(a,c+C);f=e(a,c+J);h=e(a,c+L);l=k(a,
- c+H);m=e(a,c+N);n=e(a,c+O);o=e(a,c+B);c=e(a,c+P);THREE.BinaryLoader.prototype.f4n(w,z,b,g,f,h,l,m,n,o,c)}function y(c){var b,g;b=e(a,c);g=e(a,c+M);c=e(a,c+R);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],A[b*2],A[b*2+1],A[g*2],A[g*2+1],A[c*2],A[c*2+1])}function u(c){var b,g,f;b=e(a,c);g=e(a,c+S);f=e(a,c+Y);c=e(a,c+Z);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],A[b*2],A[b*2+1],A[g*2],A[g*2+1],A[f*2],A[f*2+1],A[c*2],A[c*2+1])}var w=this,x=0,p,z=[],A=[],E,F,G,D,K,I,C,J,L,H,N,O,B,P,M,R,
- S,Y,Z,T,U,V,W,X,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,g,c);p={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:e(a,x+16),nnormals:e(a,x+16+4),nuvs:e(a,x+16+8),ntri_flat:e(a,x+16+12),ntri_smooth:e(a,x+16+16),ntri_flat_uv:e(a,x+16+20),ntri_smooth_uv:e(a,x+
- 16+24),nquad_flat:e(a,x+16+28),nquad_smooth:e(a,x+16+32),nquad_flat_uv:e(a,x+16+36),nquad_smooth_uv:e(a,x+16+40)};x+=p.header_bytes;E=p.vertex_index_bytes;F=p.vertex_index_bytes*2;G=p.vertex_index_bytes*3;D=p.vertex_index_bytes*3+p.material_index_bytes;K=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;I=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;C=p.vertex_index_bytes;J=p.vertex_index_bytes*2;L=p.vertex_index_bytes*3;H=p.vertex_index_bytes*4;N=p.vertex_index_bytes*
- 4+p.material_index_bytes;O=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;B=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;P=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;M=p.uv_index_bytes;R=p.uv_index_bytes*2;S=p.uv_index_bytes;Y=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;c=p.vertex_index_bytes*3+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes;T=p.ntri_flat*c;U=p.ntri_smooth*(c+p.normal_index_bytes*3);V=p.ntri_flat_uv*
- (c+p.uv_index_bytes*3);W=p.ntri_smooth_uv*(c+p.normal_index_bytes*3+p.uv_index_bytes*3);X=p.nquad_flat*Q;c=p.nquad_smooth*(Q+p.normal_index_bytes*4);Q=p.nquad_flat_uv*(Q+p.uv_index_bytes*4);x+=function(c){for(var e,g,h,j=p.vertex_coordinate_bytes*3,k=c+p.nvertices*j;c<k;c+=j)e=b(a,c),g=b(a,c+p.vertex_coordinate_bytes),h=b(a,c+p.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(w,e,g,h);return p.nvertices*j}(x);x+=function(c){for(var b,e,g,f=p.normal_coordinate_bytes*3,h=c+p.nnormals*f;c<h;c+=
- f)b=l(a,c),e=l(a,c+p.normal_coordinate_bytes),g=l(a,c+p.normal_coordinate_bytes*2),z.push(b/127,e/127,g/127);return p.nnormals*f}(x);x+=function(c){for(var e,g,h=p.uv_coordinate_bytes*2,j=c+p.nuvs*h;c<j;c+=h)e=b(a,c),g=b(a,c+p.uv_coordinate_bytes),A.push(e,g);return p.nuvs*h}(x);T=x+T;U=T+U;V=U+V;W=V+W;X=W+X;c=X+c;Q=c+Q;(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes,e=b+p.uv_index_bytes*3,g=a+p.ntri_flat_uv*e;for(c=a;c<g;c+=e)o(c),y(c+b);return g-a})(U);(function(a){var c,b=p.vertex_index_bytes*
- 3+p.material_index_bytes+p.normal_index_bytes*3,e=b+p.uv_index_bytes*3,g=a+p.ntri_smooth_uv*e;for(c=a;c<g;c+=e)n(c),y(c+b);return g-a})(V);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,e=b+p.uv_index_bytes*4,g=a+p.nquad_flat_uv*e;for(c=a;c<g;c+=e)t(c),u(c+b);return g-a})(c);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=b+p.uv_index_bytes*4,g=a+p.nquad_smooth_uv*e;for(c=a;c<g;c+=e)v(c),u(c+b);return g-a})(Q);(function(a){var c,b=p.vertex_index_bytes*
- 3+p.material_index_bytes,e=a+p.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(x);(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,e=a+p.ntri_smooth*b;for(c=a;c<e;c+=b)n(c);return e-a})(T);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,e=a+p.nquad_flat*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=a+p.nquad_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})(X);
- this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))},v:function(a,b,c,g){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,g)))},f3:function(a,b,c,g,e){a.faces.push(new THREE.Face3(b,c,g,null,null,a.materials[e]))},f4:function(a,b,c,g,e,h){a.faces.push(new THREE.Face4(b,c,g,e,null,null,a.materials[h]))},f3n:function(a,b,c,g,e,h,f,j,k){var h=a.materials[h],l=b[j*
- 3],m=b[j*3+1],j=b[j*3+2],o=b[k*3],n=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,g,e,[new THREE.Vector3(b[f*3],b[f*3+1],b[f*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(o,n,k)],null,h))},f4n:function(a,b,c,g,e,h,f,j,k,l,m){var f=a.materials[f],o=b[k*3],n=b[k*3+1],k=b[k*3+2],t=b[l*3],v=b[l*3+1],l=b[l*3+2],y=b[m*3],u=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,g,e,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(t,v,l),new THREE.Vector3(y,u,
- m)],null,f))},uv3:function(a,b,c,g,e,h,f){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(g,e));j.push(new THREE.UV(h,f));a.push(j)},uv4:function(a,b,c,g,e,h,f,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(g,e));l.push(new THREE.UV(h,f));l.push(new THREE.UV(j,k));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
- THREE.SceneLoader.prototype={load:function(a,b){var c=this,g=new Worker(a);g.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);g.onmessage=function(a){function g(a,c){return c=="relativeToHTML"?a:e+"/"+a}function j(){for(t in C.objects)if(!B.objects[t])if(x=C.objects[t],x.geometry!==void 0){if(E=B.geometries[x.geometry]){var a=!1;K=[];for(M=0;M<x.materials.length;M++)K[M]=B.materials[x.materials[M]],a=K[M]instanceof THREE.MeshShaderMaterial;a&&E.computeTangents();p=x.position;r=x.rotation;
- q=x.quaternion;s=x.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,K);object.name=t;object.position.set(p[0],p[1],p[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;B.scene.addObject(object);B.objects[t]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),B.scene.collisions.colliders.push(a));
- if(x.castsShadow)a=new THREE.ShadowVolume(E),B.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},B.triggers[object.name]=a)}}else p=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(p[0],p[1],p[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
- s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,B.scene.addObject(object),B.objects[t]=object,B.empties[t]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},B.triggers[object.name]=a)}function k(a){return function(b){B.geometries[a]=b;j();L-=1;c.onLoadComplete();m()}}function l(a){return function(c){B.geometries[a]=c}}function m(){c.callbackProgress({totalModels:N,totalTextures:O,loadedModels:N-L,loadedTextures:O-H},B);c.onLoadProgress();L==0&&H==0&&b(B)}var o,
- n,t,v,y,u,w,x,p,z,A,E,F,G,D,K,I,C,J,L,H,N,O,B;C=a.data;D=new THREE.BinaryLoader;J=new THREE.JSONLoader;H=L=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in C.objects)if(x=C.objects[t],x.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(C.transform){a=C.transform.position;z=C.transform.rotation;var P=C.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);z&&B.scene.rotation.set(z[0],
- z[1],z[2]);P&&B.scene.scale.set(P[0],P[1],P[2]);(a||z||P)&&B.scene.updateMatrix()}a=function(){H-=1;m();c.onLoadComplete()};for(y in C.cameras){z=C.cameras[y];if(z.type=="perspective")F=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);p=z.position;z=z.target;F.position.set(p[0],p[1],p[2]);F.target.position.set(z[0],z[1],z[2]);B.cameras[y]=F}for(v in C.lights)y=C.lights[v],
- F=y.color!==void 0?y.color:16777215,z=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(p=y.direction,I=new THREE.DirectionalLight(F,z),I.position.set(p[0],p[1],p[2]),I.position.normalize()):y.type=="point"?(p=y.position,d=y.distance,I=new THREE.PointLight(F,z,d),I.position.set(p[0],p[1],p[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(F)),B.scene.addLight(I),B.lights[v]=I;for(u in C.fogs)v=C.fogs[u],v.type=="linear"?G=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(G=new THREE.FogExp2(0,
- v.density)),z=v.color,G.color.setRGB(z[0],z[1],z[2]),B.fogs[u]=G;if(B.cameras&&C.defaults.camera)B.currentCamera=B.cameras[C.defaults.camera];if(B.fogs&&C.defaults.fog)B.scene.fog=B.fogs[C.defaults.fog];z=C.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(z[0],z[1],z[2]);B.bgColorAlpha=C.defaults.bgalpha;for(o in C.geometries)if(u=C.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();N=L;for(o in C.geometries)u=C.geometries[o],u.type=="cube"?(E=new THREE.CubeGeometry(u.width,
- u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),B.geometries[o]=E):u.type=="plane"?(E=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),B.geometries[o]=E):u.type=="sphere"?(E=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),B.geometries[o]=E):u.type=="cylinder"?(E=new THREE.CylinderGeometry(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),B.geometries[o]=E):u.type=="torus"?(E=new THREE.TorusGeometry(u.radius,
- u.tube,u.segmentsR,u.segmentsT),B.geometries[o]=E):u.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(u.subdivisions),B.geometries[o]=E):u.type=="bin_mesh"?D.load({model:g(u.url,C.urlBaseType),callback:k(o)}):u.type=="ascii_mesh"?J.load({model:g(u.url,C.urlBaseType),callback:k(o)}):u.type=="embedded_mesh"&&(u=C.embeds[u.id])&&J.createModel(u,l(o),"");for(w in C.textures)if(o=C.textures[w],o.url instanceof Array){H+=o.url.length;for(D=0;D<o.url.length;D++)c.onLoadStart()}else H+=1,c.onLoadStart();
- O=H;for(w in C.textures){o=C.textures[w];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){D=[];for(var M=0;M<o.url.length;M++)D[M]=g(o.url[M],C.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,o.mapping,a)}else{D=THREE.ImageUtils.loadTexture(g(o.url,C.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)D.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)D.magFilter=THREE[o.magFilter];if(o.repeat){D.repeat.set(o.repeat[0],o.repeat[1]);
- if(o.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}o.offset&&D.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)D.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)D.wrapT=J[o.wrap[1]]}}B.textures[w]=D}for(n in C.materials){w=C.materials[n];for(A in w.parameters)if(A=="envMap"||A=="map"||A=="lightMap")w.parameters[A]=B.textures[w.parameters[A]];else if(A=="shading")w.parameters[A]=
- w.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")w.parameters[A]=THREE[w.parameters[A]]?THREE[w.parameters[A]]:THREE.NormalBlending;else if(A=="combine")w.parameters[A]=w.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(w.parameters[A]=="face")w.parameters[A]=THREE.FaceColors;else if(w.parameters[A])w.parameters[A]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=
- !0;if(w.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);D=w.parameters.color;J=w.parameters.specular;u=w.parameters.ambient;G=w.parameters.shininess;a.tNormal.texture=B.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)a.uNormalScale.value=w.parameters.normalMapFactor;if(w.parameters.map)a.tDiffuse.texture=w.parameters.map,a.enableDiffuse.value=!0;if(w.parameters.lightMap)a.tAO.texture=w.parameters.lightMap,a.enableAO.value=!0;if(w.parameters.specularMap)a.tSpecular.texture=
- B.textures[w.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(u);a.uShininess.value=G;if(w.parameters.opacity)a.uOpacity.value=w.parameters.opacity;w=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else w=new THREE[w.type](w.parameters);B.materials[n]=w}j();c.callbackSync(B)}}};
- THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
- 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,h,f,j,k,l,m,o){f=(f-m)/(o-m);m=this.normal_cache;b[h]=j+f*this.delta;b[h+1]=k;b[h+2]=l;e[h]=this.lerp(m[a],m[a+3],f);e[h+1]=this.lerp(m[a+1],m[a+4],f);e[h+2]=this.lerp(m[a+2],m[a+5],f)};this.VIntY=function(a,b,e,h,f,j,k,l,m,o){f=(f-m)/(o-m);m=this.normal_cache;b[h]=j;b[h+1]=k+f*this.delta;b[h+
- 2]=l;b=a+this.yd*3;e[h]=this.lerp(m[a],m[b],f);e[h+1]=this.lerp(m[a+1],m[b+1],f);e[h+2]=this.lerp(m[a+2],m[b+2],f)};this.VIntZ=function(a,b,e,h,f,j,k,l,m,o){f=(f-m)/(o-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+f*this.delta;b=a+this.zd*3;e[h]=this.lerp(m[a],m[b],f);e[h+1]=this.lerp(m[a+1],m[b+1],f);e[h+2]=this.lerp(m[a+2],m[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
- this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,h,f,j){var k=h+1,l=h+this.yd,m=h+this.zd,o=k+this.yd,n=k+this.zd,t=h+this.yd+this.zd,v=k+this.yd+this.zd,y=0,u=this.field[h],w=this.field[k],x=this.field[l],p=this.field[o],z=this.field[m],A=this.field[n],E=this.field[t],F=this.field[v];u<f&&(y|=1);w<f&&(y|=2);x<f&&(y|=8);p<f&&(y|=4);z<f&&(y|=16);A<f&&(y|=32);E<f&&(y|=128);F<f&&(y|=64);var G=THREE.edgeTable[y];if(G==0)return 0;var D=this.delta,
- K=a+D,I=b+D,D=e+D;G&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,b,e,u,w));G&2&&(this.compNorm(k),this.compNorm(o),this.VIntY(k*3,this.vlist,this.nlist,3,f,K,b,e,w,p));G&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,I,e,x,p));G&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,b,e,u,x));G&16&&(this.compNorm(m),this.compNorm(n),this.VIntX(m*3,this.vlist,this.nlist,12,f,a,b,D,z,A));G&32&&(this.compNorm(n),
- this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,15,f,K,b,D,A,F));G&64&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,18,f,a,I,D,E,F));G&128&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,21,f,a,b,D,z,E));G&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,e,u,z));G&512&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,27,f,K,b,e,w,A));G&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
- 3,this.vlist,this.nlist,30,f,K,I,e,p,F));G&2048&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,I,e,x,E));y<<=4;for(f=h=0;THREE.triTable[y+f]!=-1;)a=y+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],j),f+=3,h++;return h};this.posnormtriv=function(a,b,e,h,f,j){var k=this.count*3;this.positionArray[k]=a[e];this.positionArray[k+1]=a[e+1];this.positionArray[k+2]=a[e+2];this.positionArray[k+3]=a[h];this.positionArray[k+
- 4]=a[h+1];this.positionArray[k+5]=a[h+2];this.positionArray[k+6]=a[f];this.positionArray[k+7]=a[f+1];this.positionArray[k+8]=a[f+2];this.normalArray[k]=b[e];this.normalArray[k+1]=b[e+1];this.normalArray[k+2]=b[e+2];this.normalArray[k+3]=b[h];this.normalArray[k+4]=b[h+1];this.normalArray[k+5]=b[h+2];this.normalArray[k+6]=b[f];this.normalArray[k+7]=b[f+1];this.normalArray[k+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;
- this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,h,f){var j=this.size*Math.sqrt(h/f),k=e*this.size,l=b*this.size,m=a*this.size,o=Math.floor(k-j);o<1&&(o=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-j);n<1&&(n=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-j);t<1&&(t=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
- 1);for(var v,y,u,w,x,p;o<k;o++){m=this.size2*o;y=o/this.size-e;x=y*y;for(y=n;y<l;y++){u=m+this.size*y;v=y/this.size-b;p=v*v;for(v=t;v<j;v++)w=v/this.size-a,w=h/(1.0E-6+w*w+p+x)-f,w>0&&(this.field[u+v]+=w)}}};this.addPlaneX=function(a,b){var e,h,f,j,k,l=this.size,m=this.yd,o=this.zd,n=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(e=0;e<t;e++)if(h=e/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=e+h*m;for(f=0;f<l;f++)n[o*f+k]+=j}};this.addPlaneY=function(a,b){var e,h,f,j,k,l,m=this.size,o=this.yd,n=
- this.zd,t=this.field,v=m*Math.sqrt(a/b);v>m&&(v=m);for(h=0;h<v;h++)if(e=h/m,e*=e,j=a/(1.0E-4+e)-b,j>0){k=h*o;for(e=0;e<m;e++){l=k+e;for(f=0;f<m;f++)t[n*f+l]+=j}}};this.addPlaneZ=function(a,b){var e,h,f,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(f=0;f<dist;f++)if(e=f/size,e*=e,j=a/(1.0E-4+e)-b,j>0){k=zd*f;for(h=0;h<size;h++){l=k+h*yd;for(e=0;e<size;e++)field[l+e]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
- 3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,e,h,f,j,k,l,m,o,n=this.size-2;for(f=1;f<n;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(h=1;h<n;h++){m=o+this.size*h;k=(h-this.halfsize)/this.halfsize;for(e=1;e<n;e++)j=(e-this.halfsize)/this.halfsize,b=m+e,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(h){var f,j,k,l,m,o,n,t;for(f=0;f<h.count;f++)n=f*3,m=n+1,t=n+2,j=h.positionArray[n],
- k=h.positionArray[m],l=h.positionArray[t],o=new THREE.Vector3(j,k,l),j=h.normalArray[n],k=h.normalArray[m],l=h.normalArray[t],n=new THREE.Vector3(j,k,l),n.normalize(),m=new THREE.Vertex(o),b.vertices.push(m),e.push(n);nfaces=h.count/3;for(f=0;f<nfaces;f++)n=(a+f)*3,m=n+1,t=n+2,o=e[n],j=e[m],k=e[t],n=new THREE.Face3(n,m,t,[o,j,k]),b.faces.push(n);a+=nfaces;h.count=0});return b};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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,-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.Trident=function(a){function b(b){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:b}))}function c(a,b){var c=new THREE.Geometry;c.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(c,new THREE.LineBasicMaterial({color:b}))}THREE.Object3D.call(this);var g=Math.PI/2,e,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(e in THREE.Trident.defaultParams)a.hasOwnProperty(e)||(a[e]=THREE.Trident.defaultParams[e]);
- this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(c(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(c(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(c(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)e=b(a.xAxisColor),e.rotation.y=-g,e.position.x=a.length,this.addChild(e),e=b(a.yAxisColor),e.rotation.x=g,e.position.y=a.length,this.addChild(e),e=b(a.zAxisColor),e.rotation.y=Math.PI,e.position.z=a.length,this.addChild(e)};
- THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};
- THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
- THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,g,e,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(e=this.colliders[b],g=this.rayCast(a,e),g<Number.MAX_VALUE)e.distance=g,g>h?this.hits.push(e):this.hits.unshift(e),h=g;return this.hits};
- THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var g=this.rayMesh(a,b[c]);if(g.dist<Number.MAX_VALUE){b[c].distance=g.dist;b[c].faceIndex=g.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
- THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
- THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),g=Number.MAX_VALUE,e,h=0;h<b.numFaces;h++){var f=b.mesh.geometry.faces[h],j=b.mesh.geometry.vertices[f.a].position,k=b.mesh.geometry.vertices[f.b].position,l=b.mesh.geometry.vertices[f.c].position,m=f instanceof THREE.Face4?b.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(c,j,k,l,g,this.collisionNormal,b.mesh),f<g&&(g=f,e=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
- f instanceof THREE.Face4&&(f=this.rayTriangle(c,j,k,m,g,this.collisionNormal,b.mesh),f<g&&(g=f,e=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),f=this.rayTriangle(c,k,l,m,g,this.collisionNormal,b.mesh),f<g&&(g=f,e=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:g,faceIndex:e}};
- THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,g,e,h,f){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(c,b);k.sub(g,c);h.cross(j,k);j=h.dot(a.direction);if(!(j<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;f=h.dot(b)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=j*e))return Number.MAX_VALUE;f/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(f);j.addSelf(a.origin);Math.abs(h.x)>
- Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=j.y-b.y,h=c.y-b.y,e=g.y-b.y,j=j.z-b.z,c=c.z-b.z,g=g.z-b.z):(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.y-b.y,c=c.y-b.y,g=g.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.z-b.z,c=c.z-b.z,g=g.z-b.z):(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.y-b.y,c=c.y-b.y,g=g.y-b.y);b=h*g-c*e;if(b==0)return Number.MAX_VALUE;b=1/b;g=(a*g-j*e)*b;if(!(g>=0))return Number.MAX_VALUE;b*=h*j-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-g-b>=0))return Number.MAX_VALUE;return f};
- THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var g=THREE.CollisionSystem.__r;g.origin.copy(a.origin);g.direction.copy(a.direction);c.multiplyVector3(g.origin);c.rotateAxis(g.direction);g.direction.normalize();return g};
- THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var g=0,e=0,h=0,f=0,j=0,k=0,l=!0;c.origin.x<b.min.x?(g=b.min.x-c.origin.x,g/=c.direction.x,l=!1,f=-1):c.origin.x>b.max.x&&(g=b.max.x-c.origin.x,g/=c.direction.x,l=!1,f=1);c.origin.y<b.min.y?(e=b.min.y-c.origin.y,e/=c.direction.y,l=!1,j=-1):c.origin.y>b.max.y&&(e=b.max.y-c.origin.y,e/=c.direction.y,
- l=!1,j=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,l=!1,k=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,l=!1,k=1);if(l)return-1;l=0;e>g&&(l=1,g=e);h>g&&(l=2,g=h);switch(l){case 0:j=c.origin.y+c.direction.y*g;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*g;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(f,0,0);break;case 1:f=c.origin.x+c.direction.x*g;if(f<b.min.x||f>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
- g;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,j,0);break;case 2:f=c.origin.x+c.direction.x*g;if(f<b.min.x||f>b.max.x)return Number.MAX_VALUE;j=c.origin.y+c.direction.y*g;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,k)}return g};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),g=b.point.dot(b.normal);if(c<0)c=(g-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
- THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var g=c.dot(a.direction.clone());if(g<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-g*g);if(c>=0)return Math.abs(g)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
- THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
- THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
- if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,g=this.render,e=new THREE.Camera,h=new THREE.Camera,f=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;e.useTarget=h.useTarget=!1;e.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.Camera(53,1,1,1E4);t.position.z=
- 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
- var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;n.width=a;n.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||l!==c.near||m!==c.fov){k=c.aspect;l=c.near;m=c.fov;var w=c.projectionMatrix.clone(),x=125/30*0.5,p=x*l/125,z=l*Math.tan(m*Math.PI/360),A;f.n14=x;j.n14=-x;x=-z*k+p;A=z*k+p;w.n11=2*l/(A-x);w.n13=(A+x)/(A-x);e.projectionMatrix=w.clone();x=-z*k-p;A=z*k-p;w.n11=2*l/(A-x);
- w.n13=(A+x)/(A-x);h.projectionMatrix=w.clone()}e.matrix=c.matrixWorld.clone().multiplySelf(j);e.update(null,!0);e.position.copy(c.position);e.near=l;e.far=c.far;g.call(b,a,e,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;g.call(b,a,h,n,!0);g.call(b,v,t)}};
- if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,g=this.render,e,h,f=new THREE.Camera,j=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,f){c.call(b,a,f);e=a/2;h=f};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far;
- f.updateProjectionMatrix();f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(b.separation);j.projectionMatrix=f.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,e,h);g.call(b,a,f);this.setViewport(e,0,e,h);g.call(b,a,j,!1)}};
|