|
@@ -1,12 +1,12 @@
|
|
|
// ThreeExtras.js r42 - http://github.com/mrdoob/three.js
|
|
|
-THREE.ColorUtils={adjustHSV:function(a,c,b,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+b,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,f=a.g,g=a.b,h=Math.max(Math.max(b,f),g),e=Math.min(Math.min(b,f),g);if(e==h)e=b=0;else{var j=h-e,e=j/h,b=b==h?(f-g)/j:f==h?2+(g-b)/j:4+(b-f)/j;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=h;return c},
|
|
|
-clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,f=a.vertices.length,g=b?c.geometry:c,h=a.vertices,e=g.vertices,j=a.faces,k=g.faces,l=a.faceVertexUvs[0],g=g.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var m=0,n=e.length;m<n;m++){var p=new THREE.Vertex(e[m].position.clone());b&&c.matrix.multiplyVector3(p.position);h.push(p)}m=0;for(n=k.length;m<n;m++){var e=k[m],o,x,w=e.vertexNormals,p=e.vertexColors;e instanceof THREE.Face3?o=new THREE.Face3(e.a+f,e.b+f,e.c+
|
|
|
-f):e instanceof THREE.Face4&&(o=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));o.normal.copy(e.normal);b=0;for(h=w.length;b<h;b++)x=w[b],o.vertexNormals.push(x.clone());o.color.copy(e.color);b=0;for(h=p.length;b<h;b++)x=p[b],o.vertexColors.push(x.clone());o.materials=e.materials.slice();o.centroid.copy(e.centroid);j.push(o)}m=0;for(n=g.length;m<n;m++){f=g[m];j=[];b=0;for(h=f.length;b<h;b++)j.push(new THREE.UV(f[b].u,f[b].v));l.push(j)}},clone:function(a){var c=new THREE.Geometry,b,f=a.vertices,g=a.faces,
|
|
|
-h=a.faceVertexUvs[0],a=0;for(b=f.length;a<b;a++){var e=new THREE.Vertex(f[a].position.clone());c.vertices.push(e)}a=0;for(b=g.length;a<b;a++){var j=g[a],k,l,m=j.vertexNormals,n=j.vertexColors;j instanceof THREE.Face3?k=new THREE.Face3(j.a,j.b,j.c):j instanceof THREE.Face4&&(k=new THREE.Face4(j.a,j.b,j.c,j.d));k.normal.copy(j.normal);f=0;for(e=m.length;f<e;f++)l=m[f],k.vertexNormals.push(l.clone());k.color.copy(j.color);f=0;for(e=n.length;f<e;f++)l=n[f],k.vertexColors.push(l.clone());k.materials=j.materials.slice();
|
|
|
-k.centroid.copy(j.centroid);c.faces.push(k)}a=0;for(b=h.length;a<b;a++){g=h[a];k=[];f=0;for(e=g.length;f<e;f++)k.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(k)}return c}};
|
|
|
-THREE.ImageUtils={loadTexture:function(a,c,b){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;b&&b(this)};f.crossOrigin="";f.src=a;return g},loadTextureCube:function(a,c,b){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=a.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h}};
|
|
|
-THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,f,g=a.children.length;for(f=0;f<g;f++)b=a.children[f],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
|
|
|
+THREE.ColorUtils={adjustHSV:function(a,b,c,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.ColorUtils.clamp(g.h+b,0,1);g.s=THREE.ColorUtils.clamp(g.s+c,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,b){var c=a.r,f=a.g,g=a.b,h=Math.max(Math.max(c,f),g),e=Math.min(Math.min(c,f),g);if(e==h)e=c=0;else{var j=h-e,e=j/h,c=c==h?(f-g)/j:f==h?2+(g-c)/j:4+(c-f)/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=e;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};
|
|
|
+THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,f=a.vertices.length,g=c?b.geometry:b,h=a.vertices,e=g.vertices,j=a.faces,k=g.faces,l=a.faceVertexUvs[0],g=g.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=e.length;m<n;m++){var p=new THREE.Vertex(e[m].position.clone());c&&b.matrix.multiplyVector3(p.position);h.push(p)}m=0;for(n=k.length;m<n;m++){var e=k[m],o,x,w=e.vertexNormals,p=e.vertexColors;e instanceof THREE.Face3?o=new THREE.Face3(e.a+f,e.b+f,e.c+
|
|
|
+f):e instanceof THREE.Face4&&(o=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));o.normal.copy(e.normal);c=0;for(h=w.length;c<h;c++)x=w[c],o.vertexNormals.push(x.clone());o.color.copy(e.color);c=0;for(h=p.length;c<h;c++)x=p[c],o.vertexColors.push(x.clone());o.materials=e.materials.slice();o.centroid.copy(e.centroid);j.push(o)}m=0;for(n=g.length;m<n;m++){f=g[m];j=[];c=0;for(h=f.length;c<h;c++)j.push(new THREE.UV(f[c].u,f[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,f=a.vertices,g=a.faces,
|
|
|
+h=a.faceVertexUvs[0],a=0;for(c=f.length;a<c;a++){var e=new THREE.Vertex(f[a].position.clone());b.vertices.push(e)}a=0;for(c=g.length;a<c;a++){var j=g[a],k,l,m=j.vertexNormals,n=j.vertexColors;j instanceof THREE.Face3?k=new THREE.Face3(j.a,j.b,j.c):j instanceof THREE.Face4&&(k=new THREE.Face4(j.a,j.b,j.c,j.d));k.normal.copy(j.normal);f=0;for(e=m.length;f<e;f++)l=m[f],k.vertexNormals.push(l.clone());k.color.copy(j.color);f=0;for(e=n.length;f<e;f++)l=n[f],k.vertexColors.push(l.clone());k.materials=j.materials.slice();
|
|
|
+k.centroid.copy(j.centroid);b.faces.push(k)}a=0;for(c=h.length;a<c;a++){g=h[a];k=[];f=0;for(e=g.length;f<e;f++)k.push(new THREE.UV(g[f].u,g[f].v));b.faceVertexUvs[0].push(k)}return b}};
|
|
|
+THREE.ImageUtils={loadTexture:function(a,b,c){var f=new Image,g=new THREE.Texture(f,b);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.crossOrigin="";f.src=a;return g},loadTextureCube:function(a,b,c){var f,g=[],h=new THREE.Texture(g,b),b=g.loadCount=0;for(f=a.length;b<f;++b)g[b]=new Image,g[b].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)},g[b].crossOrigin="",g[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,f,g=a.children.length;for(f=0;f<g;f++)c=a.children[f],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;",
|
|
@@ -16,55 +16,55 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,f,g,h=2*Math.ceil(a*3)+1;h>25&&(h=25);g=(h-1)*0.5;b=Array(h);for(c=f=0;c<h;++c)b[c]=Math.exp(-((c-g)*(c-g))/(2*a*a)),f+=b[c];for(c=0;c<h;++c)b[c]/=f;return b}};
|
|
|
-THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
|
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var f=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(f[0],f[1],f[2],f[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){f={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var k=0;k<a.hierarchy[b].keys[e].morphTargets.length;k++){var l=a.hierarchy[b].keys[e].morphTargets[k];f[l]=-1}a.hierarchy[b].usedMorphTargets=f;for(e=0;e<a.hierarchy[b].keys.length;e++){var m=
|
|
|
-{};for(l in f){for(k=0;k<a.hierarchy[b].keys[e].morphTargets.length;k++)if(a.hierarchy[b].keys[e].morphTargets[k]===l){m[l]=a.hierarchy[b].keys[e].morphTargetsInfluences[k];break}k===a.hierarchy[b].keys[e].morphTargets.length&&(m[l]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=m}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
|
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else f(a,b);return b}},f=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)f(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
|
-2;return b}();THREE.Animation=function(a,c,b,f){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,f=this.hierarchy.length,g;for(b=0;b<f;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
|
|
|
-THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,f,g,h=2*Math.ceil(a*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(b=f=0;b<h;++b)c[b]=Math.exp(-((b-g)*(b-g))/(2*a*a)),f+=c[b];for(b=0;b<h;++b)c[b]/=f;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 e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
|
|
|
+0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var f=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(f[0],f[1],f[2],f[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){f={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var k=0;k<a.hierarchy[c].keys[e].morphTargets.length;k++){var l=a.hierarchy[c].keys[e].morphTargets[k];f[l]=-1}a.hierarchy[c].usedMorphTargets=f;for(e=0;e<a.hierarchy[c].keys.length;e++){var m=
|
|
|
+{};for(l in f){for(k=0;k<a.hierarchy[c].keys[e].morphTargets.length;k++)if(a.hierarchy[c].keys[e].morphTargets[k]===l){m[l]=a.hierarchy[c].keys[e].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[e].morphTargets.length&&(m[l]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=m}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
|
|
|
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));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 f(a,c);return c}},f=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)f(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
|
|
|
+2;return c}();THREE.Animation=function(a,b,c,f){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=f!==void 0?f:!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,f=this.hierarchy.length,g;for(c=0;c<f;c++){g=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
|
|
|
+THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.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];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.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 c=["pos","rot","scl"],b,f,g,h,e,j,k,l,m=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,x=this.hierarchy.length;o<x;o++)if(a=this.hierarchy[o],k=a.animationCache,this.JITCompile&&m[o][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=m[o][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 w=0;w<3;w++){b=c[w];e=k.prevKey[b];j=k.nextKey[b];if(j.time<=p){if(n<p)if(this.loop){e=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(b,o,1);j.time<n;)e=j,j=this.getNextKeyWith(b,o,j.index+1)}else{this.stop();return}else{do e=j,j=this.getNextKeyWith(b,o,j.index+1);while(j.time<
|
|
|
-n)}k.prevKey[b]=e;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(n-e.time)/(j.time-e.time);g=e[b];h=j[b];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+o),f=f<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*f,b.y=g[1]+(h[1]-g[1])*f,b.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",o,e.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,f,0)}else if(b===
|
|
|
-"rot")THREE.Quaternion.slerp(g,h,a.quaternion,f);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*f,b.y=g[1]+(h[1]-g[1])*f,b.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)m[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],f=[],g,h,e,j,k,l;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];j=a[b[1]];k=a[b[2]];l=a[b[3]];b=g*g;e=g*b;f[0]=this.interpolate(h[0],j[0],k[0],l[0],g,b,e);f[1]=this.interpolate(h[1],j[1],k[1],l[1],g,b,e);f[2]=this.interpolate(h[2],j[2],k[2],l[2],g,b,e);return f};
|
|
|
-THREE.Animation.prototype.interpolate=function(a,c,b,f,g,h,e){a=(b-a)*0.5;f=(f-c)*0.5;return(2*(c-b)+a+f)*e+(-3*(c-b)-2*a-f)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<f.length-1?b:f.length-1:b%=f.length;b<f.length;b++)if(f[b][a]!==void 0)return f[b];return this.data.hierarchy[c].keys[0]};
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var f=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+f.length;b>=0;b--)if(f[b][a]!==void 0)return f[b];return this.data.hierarchy[c].keys[f.length-1]};
|
|
|
-THREE.FirstPersonCamera=function(a){function c(a,c){return function(){c.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=
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,f,g,h,e,j,k,l,m=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,x=this.hierarchy.length;o<x;o++)if(a=this.hierarchy[o],k=a.animationCache,this.JITCompile&&m[o][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=m[o][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 w=0;w<3;w++){c=b[w];e=k.prevKey[c];j=k.nextKey[c];if(j.time<=p){if(n<p)if(this.loop){e=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(c,o,1);j.time<n;)e=j,j=this.getNextKeyWith(c,o,j.index+1)}else{this.stop();return}else{do e=j,j=this.getNextKeyWith(c,o,j.index+1);while(j.time<
|
|
|
+n)}k.prevKey[c]=e;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(n-e.time)/(j.time-e.time);g=e[c];h=j[c];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+o),f=f<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=g[0]+(h[0]-g[0])*f,c.y=g[1]+(h[1]-g[1])*f,c.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",o,e.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),c.x=g[0],c.y=g[1],c.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,f,0)}else if(c===
|
|
|
+"rot")THREE.Quaternion.slerp(g,h,a.quaternion,f);else if(c==="scl")c=a.scale,c.x=g[0]+(h[0]-g[0])*f,c.y=g[1]+(h[1]-g[1])*f,c.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)m[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],f=[],g,h,e,j,k,l;g=(a.length-1)*b;h=Math.floor(g);g-=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=g*g;e=g*c;f[0]=this.interpolate(h[0],j[0],k[0],l[0],g,c,e);f[1]=this.interpolate(h[1],j[1],k[1],l[1],g,c,e);f[2]=this.interpolate(h[2],j[2],k[2],l[2],g,c,e);return f};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,b,c,f,g,h,e){a=(c-a)*0.5;f=(f-b)*0.5;return(2*(b-c)+a+f)*e+(-3*(b-c)-2*a-f)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<f.length-1?c:f.length-1:c%=f.length;c<f.length;c++)if(f[c][a]!==void 0)return f[c];return this.data.hierarchy[b].keys[0]};
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var f=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+f.length;c>=0;c--)if(f[c][a]!==void 0)return f[c];return this.data.hierarchy[b].keys[f.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 82:this.moveUp=!0;break;case 70:this.moveDown=!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;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!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 c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);
|
|
|
-this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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,g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=
|
|
|
-this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.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",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;
|
|
|
-THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
|
|
|
-THREE.PathCamera=function(a){function c(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),j=b.getLength(),k=g.length,y=0;h=k-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)y=e*j.chunks[h]/j.total,b.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(a,b){var c,
|
|
|
-e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function f(a,c){var e=b(c,10),f=b(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,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);f=new THREE.SphereGeometry(1,
|
|
|
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(c.points[i]),e.updateMatrix(),a.addChild(e)}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=
|
|
|
+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);this.moveUp&&this.translateY(b);this.moveDown&&this.translateY(-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,g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
|
|
|
+1;this.constrainVertical&&(a=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);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;g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.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,e){var f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),j=c.getLength(),k=g.length,y=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)y=e*j.chunks[h]/j.total,c.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
|
|
|
+e,f=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),f.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function f(a,b){var e=c(b,10),f=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,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);f=new THREE.SphereGeometry(1,
|
|
|
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}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 g=Math.PI*2,h=Math.PI/180;this.update=function(a,b,c){var e,f;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;e=this.phi%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var j=f[1]-f[0];this.phi=
|
|
|
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/j)*j+f[0];e=this.horizontalAngleMap.srcRange;f=this.horizontalAngleMap.dstRange;j=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/j)*j+f[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,b,c)};this.onMouseMove=function(a){this.mouseX=
|
|
|
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,f;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;e=this.phi%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var j=f[1]-f[0];this.phi=
|
|
|
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/j)*j+f[0];e=this.horizontalAngleMap.srcRange;f=this.horizontalAngleMap.dstRange;j=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/j)*j+f[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.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}),e=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,e);a.position.set(0,10,0);this.animation=
|
|
|
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,b){return function(){b.apply(a,arguments)}}(this,this.onMouseMove),
|
|
|
+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&&f(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 c(a,c){return function(){c.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=
|
|
|
+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 c=this.getContainerDimensions(),g=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(a.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(a.clientY-
|
|
|
-c.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,c=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*c,this.rotationVector.y*c,this.rotationVector.z*c,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||
|
|
|
+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(),g=b.size[0]/2,h=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-g)/g;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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
|
+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,c,b,f){THREE.Camera.call(this,a,c,b,f);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 g=new THREE.Vector3,h=new THREE.Vector3,e=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,p=0,o=0,x=0,w=window.innerWidth/2,u=window.innerHeight/2;this.update=
|
|
|
+THREE.RollCamera=function(a,b,c,f){THREE.Camera.call(this,a,b,c,f);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 g=new THREE.Vector3,h=new THREE.Vector3,e=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,p=0,o=0,x=0,w=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*o),this.rotateVertically(a*x));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*p);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();e.copy(this.forward);h.set(0,1,0);g.cross(h,e).normalize();h.cross(e,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=e.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=e.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=e.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-=
|
|
@@ -72,148 +72,148 @@ this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=fu
|
|
|
function(a){o=(a.clientX-w)/window.innerWidth;x=(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:n=-1;break;
|
|
|
case 40:case 83:m=-1;break;case 39:case 68:n=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:n=0;break;case 40:case 83:m=0;break;case 39:case 68:n=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:p=0;break;case 70:p=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 c(a,b){return function(){b.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 b=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,e=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,b){return new THREE.Vector2((a-
|
|
|
-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);g=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(c.y);e.addSelf(this.up.clone().crossSelf(g).setLength(c.x));e.addSelf(g.setLength(c.z));return e};
|
|
|
-this.rotateCamera=function(){var a=Math.acos(h.dot(e)/h.length()/e.length());if(a){var b=(new THREE.Vector3).cross(h,e).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(e);this.staticMoving?h=e:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(g.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(g.length()*this.panSpeed);var b=g.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);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),
|
|
|
-g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(a,b,c){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,a,b,c)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-c(this,function(a){b&&(h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),b=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?e=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();
|
|
|
-a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===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",c(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
-this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(b=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=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.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheLengths&&this.cacheLengths.length==a)return this.cacheLengths;var c=[],b,f=this.getPoint(0),g,h=0;for(g=1;g<=a;g++)b=this.getPoint(g/a),h+=b.distanceTo(f),c.push(h),f=b;return this.cacheLengths=c};
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),f=0,g=b.length,h;for(h=c?c:a*b[g-1];f<g;){if(b[f]>h)break;f++}return f/g};THREE.LineCurve=function(a,c,b,f){this.x1=a;this.y1=c;this.x2=b;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){return new THREE.Vector2(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a)};
|
|
|
-THREE.QuadraticBezierCurve=function(a,c,b,f,g,h){this.x0=a;this.y0=c;this.x1=b;this.y1=f;this.x2=g;this.y2=h};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.x0,this.x1,this.x2);a=THREE.Shape.Utils.b2(a,this.y0,this.y1,this.y2);return new THREE.Vector2(c,a)};
|
|
|
-THREE.QuadraticBezierCurve.prototype.getNormalVector=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.x0,this.x1,this.x2);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.y0,this.y1,this.y2);return(new THREE.Vector2(-a,c)).unit()};THREE.CubicBezierCurve=function(a,c,b,f,g,h,e,j){this.x0=a;this.y0=c;this.x1=b;this.y1=f;this.x2=g;this.y2=h;this.x3=e;this.y3=j};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
-THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.x0,this.x1,this.x2,this.x3);a=THREE.Shape.Utils.b3(a,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,a)};THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
-THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],f=this.points,g;g=(f.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>f.length-2?a:a+1;b[3]=a>f.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(f[b[0]].x,f[b[1]].x,f[b[2]].x,f[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[b[0]].y,f[b[1]].y,f[b[2]].y,f[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,f,g,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=h};
|
|
|
-THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
|
|
|
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,f){return 2*(1-a)*(b-c)+2*a*(f-b)},tangentSpline:function(){},interpolate:function(a,c,b,f,g){var a=(b-a)*0.5,f=(f-c)*0.5,h=g*g;return(2*c-2*b+a+f)*g*h+(-3*c+3*b-2*a-f)*h+a*g+c}};THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};
|
|
|
-THREE.LineCurve3=THREE.Curve.create(function(a,c,b,f,g,h){this.x1=a;this.y1=c;this.z1=b;this.x2=f;this.y2=g;this.z2=h},function(a){return new THREE.Vector3(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a,this.z1+(this.z2-this.z1)*a)});
|
|
|
-THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b,f,g,h,e,j,k){this.x0=a;this.y0=c;this.z0=b;this.x1=f;this.y1=g;this.z1=h;this.x2=e;this.y2=j;this.z2=k},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.x0,this.x1,this.x2);b=THREE.Shape.Utils.b2(a,this.y0,this.y1,this.y2);a=THREE.Shape.Utils.b2(a,this.z0,this.z1,this.z2);return new THREE.Vector2(c,b,a)});THREE.Path=function(a){this.actions=[];this.curves=[];a&&this.fromPoints(a)};
|
|
|
-THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].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(a,c){var b=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],a,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:b,curve:f})};
|
|
|
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.QuadraticBezierCurve(h[h.length-2],h[h.length-1],a,c,b,f);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:h})};
|
|
|
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,f,g,h){var e=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.CubicBezierCurve(j[j.length-2],j[j.length-1],a,c,b,f,g,h);this.curves.push(j);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e,curve:j})};
|
|
|
-THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])],b=b.concat(a),b=new THREE.SplineCurve(b);this.curves.push(b);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:b})};
|
|
|
-THREE.Path.prototype.arc=function(a,c,b,f,g,h){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a,c){a||(a=40);for(var b=[],f=0;f<a;f++)b.push(this.getPoint(f/a));c&&b.push(b[0]);return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],f,g,h,e,j,k,l,m,n,p,o,x,w;f=0;for(g=this.actions.length;f<g;f++)switch(h=this.actions[f],e=h.action,h=h.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=h[2];k=h[3];n=h[0];p=h[1];b.length>0?(e=b[b.length-1],o=e.x,x=e.y):(e=this.actions[f-1].args,o=e[e.length-2],x=e[e.length-1]);for(e=1;e<=a;e++)w=e/a,h=THREE.Shape.Utils.b2(w,o,n,j),w=THREE.Shape.Utils.b2(w,x,p,
|
|
|
-k),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];p=h[1];l=h[2];m=h[3];b.length>0?(e=b[b.length-1],o=e.x,x=e.y):(e=this.actions[f-1].args,o=e[e.length-2],x=e[e.length-1]);for(e=1;e<=a;e++)w=e/a,h=THREE.Shape.Utils.b3(w,o,n,l,j),w=THREE.Shape.Utils.b3(w,x,p,m,k),b.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[f-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];w=a*h[0].length;e=e.concat(h[0]);h=new THREE.SplineCurve(e);
|
|
|
-for(e=1;e<=w;e++)b.push(h.getPointAt(e/w));break;case THREE.PathActions.ARC:e=this.actions[f-1].args;j=h[0];k=h[1];l=h[2];n=h[3];w=h[4];p=!!h[5];m=e[e.length-2];o=e[e.length-1];e.length==0&&(m=o=0);x=w-n;var u=a*2;for(e=1;e<=u;e++)w=e/u,p||(w=1-w),w=n+w*x,h=m+j+l*Math.cos(w),w=o+k+l*Math.sin(w),b.push(new THREE.Vector2(h,w))}c&&b.push(b[0]);return b};
|
|
|
-THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),c,b,f,g;c=b=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,e,j;e=0;for(j=a.length;e<j;e++){h=a[e];if(h.x>c)c=h.x;else if(h.x<f)f=h.x;if(h.y>b)b=h.y;else if(h.y<b)g=h.y}return{minX:f,minY:g,maxX:c,maxY:b}};THREE.Path.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.sums,a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};
|
|
|
-THREE.Path.prototype.getLength=function(){var a=[],c=0,b,f=this.curves.length;for(b=0;b<f;b++)c+=this.curves[b].getLength(),a.push(c);this.sums=a;return c};THREE.Path.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};THREE.Path.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};
|
|
|
-THREE.Path.prototype.createGeometry=function(a){for(var c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};
|
|
|
-THREE.Path.prototype.transform=function(a){a=new THREE.Path;a.moveTo(0,0);a.quadraticCurveTo(100,20,140,80);console.log(a.cacheArcLengths());var c=this.getMinAndMax(),b=this.getPoints(),f,g,h,e,j,k;f=0;for(g=b.length;f<g;f++)h=b[f],e=h.x,j=h.y,k=e/c.maxX,e=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),h.x=e.x+j.x,h.y=e.y+j.y;return b};
|
|
|
-THREE.Path.prototype.nltransform=function(a,c,b,f,g,h){var e=this.getPoints(),j,k,l,m,n;j=0;for(k=e.length;j<k;j++)l=e[j],m=l.x,n=l.y,l.x=a*m+c*n+b,l.y=f*n+g*m+h;return e};
|
|
|
-THREE.Path.prototype.debug=function(a){var c=this.getMinAndMax();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,f,g,a=0;for(b=this.actions.length;a<b;a++)f=this.actions[a],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.getPoints();
|
|
|
-a=0;for(b=f.length;a<b;a++)g=f[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
-THREE.Path.prototype.toShapes=function(){var a,c,b,f,g=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],f=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[b].apply(h,f);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var e;f=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)h=g[a],THREE.Shape.Utils.isClockWise(h.getPoints())?(e&&f.push(e),e=new THREE.Shape,e.actions=h.actions,e.curves=
|
|
|
-h.curves):e.holes.push(h);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)h=g[a],THREE.Shape.Utils.isClockWise(h.getPoints())?(e.actions=h.actions,e.curves=h.curves,f.push(e),e=new THREE.Shape):e.holes.push(h)}return f};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.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
-THREE.Shape.prototype.getPointsHoles=function(){var a,c=this.holes.length,b=[];for(a=0;a<c;a++)b[a]=this.holes[a].getPoints();return b};THREE.Shape.prototype.getSpacedPointsHoles=function(){var a,c=this.holes.length,b=[];for(a=0;a<c;a++)b[a]=this.holes[a].getSpacedPoints();return b};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),f=b.concat(),g,h,e,j,k,l,m,n,p,o,x=[];for(k=0;k<c.length;k++){l=c[k];f=f.concat(l);h=Number.POSITIVE_INFINITY;for(g=0;g<l.length;g++){p=l[g];o=[];for(n=0;n<b.length;n++)m=b[n],m=p.distanceTo(m),o.push(m),m<h&&(h=m,e=g,j=n)}g=j-1>=0?j-1:b.length-1;h=e-1>=0?e-1:l.length-1;var w=[l[e],b[j],b[g]];n=THREE.FontUtils.Triangulate.area(w);var u=[l[e],l[h],b[j]];p=THREE.FontUtils.Triangulate.area(u);o=j;m=e;j+=1;e+=-1;j<0&&(j+=b.length);j%=b.length;
|
|
|
-e<0&&(e+=l.length);e%=l.length;g=j-1>=0?j-1:b.length-1;h=e-1>=0?e-1:l.length-1;w=[l[e],b[j],b[g]];w=THREE.FontUtils.Triangulate.area(w);u=[l[e],l[h],b[j]];u=THREE.FontUtils.Triangulate.area(u);n+p>w+u&&(j=o,e=m,j<0&&(j+=b.length),j%=b.length,e<0&&(e+=l.length),e%=l.length,g=j-1>=0?j-1:b.length-1,h=e-1>=0?e-1:l.length-1);n=b.slice(0,j);p=b.slice(j);o=l.slice(e);m=l.slice(0,e);h=[l[e],l[h],b[j]];x.push([l[e],b[j],b[g]]);x.push(h);b=n.concat(o).concat(m).concat(p)}return{shape:b,isolatedPts:x,allpoints:f}},
|
|
|
-triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),f=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,e,j,k;for(h=0;h<b.length;h++){k=b[h];for(e=0;e<3;e++)for(j=0;j<f.length;j++)f[j].equals(k[e])&&(k[e]=j)}for(h=0;h<g.length;h++){k=g[h];for(e=0;e<3;e++)for(j=0;j<f.length;j++)f[j].equals(k[e])&&(k[e]=j)}return b.concat(g)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*
|
|
|
-(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,f){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,f)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,f,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,f)+this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};
|
|
|
-THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
|
|
|
-THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,f=a.length;b<f;b++)c=c.concat(a[b].toShapes());return c};
|
|
|
-THREE.CubeGeometry=function(a,c,b,f,g,h,e,j,k){function l(a,b,c,e,j,k,l,n){var o,p,x=f||1,w=g||1,E=j/2,L=k/2,H=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")o="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")o="y",w=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")o="x",x=h||1;var I=x+1,O=w+1;j/=x;var Q=k/w;for(p=0;p<O;p++)for(k=0;k<I;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*c;C[b]=(p*Q-L)*e;C[o]=l;m.vertices.push(new THREE.Vertex(C))}for(p=0;p<w;p++)for(k=0;k<x;k++)m.faces.push(new THREE.Face4(k+I*p+
|
|
|
-H,k+I*(p+1)+H,k+1+I*(p+1)+H,k+1+I*p+H,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/x,p/w),new THREE.UV(k/x,(p+1)/w),new THREE.UV((k+1)/x,(p+1)/w),new THREE.UV((k+1)/x,p/w)])}THREE.Geometry.call(this);var m=this,n=a/2,p=c/2,o=b/2,j=j?-1:1;if(e!==void 0)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=void 0&&(this.sides[w]=
|
|
|
-k[w]);this.sides.px&&l("z","y",1*j,-1,b,c,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,b,c,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,c,o,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,c,-o,this.materials[5]);(function(){for(var a=[],b=[],c=0,e=m.vertices.length;c<e;c++){for(var f=m.vertices[c],h=!1,g=0,j=a.length;g<j;g++){var k=a[g];if(f.position.x==k.position.x&&
|
|
|
-f.position.y==k.position.y&&f.position.z==k.position.z){b[c]=g;h=!0;break}}if(!h)b[c]=a.length,a.push(new THREE.Vertex(f.position.clone()))}c=0;for(e=m.faces.length;c<e;c++)f=m.faces[c],f.a=b[f.a],f.b=b[f.b],f.c=b[f.c],f.d=b[f.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,c,b,f,g,h){function e(a,b,c){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=f/2;for(k=0;k<a;k++)e(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,-m);for(k=0;k<a;k++)e(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b>0){e(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(c>0){e(0,0,m+
|
|
|
-(g||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 c=[],b=this.faces[k],g=this.vertices[b.a],h=this.vertices[b.b],m=this.vertices[b.c],n=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/l,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
|
|
|
-f));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,c){if(typeof a!="undefined"){THREE.Geometry.call(this);for(var a=a instanceof Array?a:[a],b=0,f=a.length,g;b<f;b++)g=a[b],this.addShape(g,c)}};
|
|
|
+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,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,e=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),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);g=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(g).setLength(b.x));e.addSelf(g.setLength(b.z));return e};
|
|
|
+this.rotateCamera=function(){var a=Math.acos(h.dot(e)/h.length()/e.length());if(a){var c=(new THREE.Vector3).cross(h,e).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(g);b.multiplyVector3(this.up);b.multiplyVector3(e);this.staticMoving?h=e:(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&&(g.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(g.length()*this.panSpeed);var c=g.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),
|
|
|
+g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(a,c,b){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);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=e=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?e=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):f===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(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===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();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
+this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(f!==this.STATE.NONE)f=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.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
+THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheLengths&&this.cacheLengths.length==a)return this.cacheLengths;var b=[],c,f=this.getPoint(0),g,h=0;for(g=1;g<=a;g++)c=this.getPoint(g/a),h+=c.distanceTo(f),b.push(h),f=c;return this.cacheLengths=b};
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),f=0,g=c.length,h;for(h=b?b:a*c[g-1];f<g;){if(c[f]>h)break;f++}return f/g};THREE.LineCurve=function(a,b,c,f){this.x1=a;this.y1=b;this.x2=c;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){return new THREE.Vector2(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a)};
|
|
|
+THREE.QuadraticBezierCurve=function(a,b,c,f,g,h){this.x0=a;this.y0=b;this.x1=c;this.y1=f;this.x2=g;this.y2=h};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.x0,this.x1,this.x2);a=THREE.Shape.Utils.b2(a,this.y0,this.y1,this.y2);return new THREE.Vector2(b,a)};
|
|
|
+THREE.QuadraticBezierCurve.prototype.getNormalVector=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.x0,this.x1,this.x2);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.y0,this.y1,this.y2);return(new THREE.Vector2(-a,b)).unit()};THREE.CubicBezierCurve=function(a,b,c,f,g,h,e,j){this.x0=a;this.y0=b;this.x1=c;this.y1=f;this.x2=g;this.y2=h;this.x3=e;this.y3=j};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
|
|
|
+THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.x0,this.x1,this.x2,this.x3);a=THREE.Shape.Utils.b3(a,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(b,a)};THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
|
|
|
+THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],f=this.points,g;g=(f.length-1)*a;a=Math.floor(g);g-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>f.length-2?a:a+1;c[3]=a>f.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(f[c[0]].x,f[c[1]].x,f[c[2]].x,f[c[3]].x,g);b.y=THREE.Curve.Utils.interpolate(f[c[0]].y,f[c[1]].y,f[c[2]].y,f[c[3]].y,g);return b};THREE.ArcCurve=function(a,b,c,f,g,h){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=h};
|
|
|
+THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*b;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
|
|
|
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,f){return 2*(1-a)*(c-b)+2*a*(f-c)},tangentSpline:function(){},interpolate:function(a,b,c,f,g){var a=(c-a)*0.5,f=(f-b)*0.5,h=g*g;return(2*b-2*c+a+f)*g*h+(-3*b+3*c-2*a-f)*h+a*g+b}};THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};
|
|
|
+THREE.LineCurve3=THREE.Curve.create(function(a,b,c,f,g,h){this.x1=a;this.y1=b;this.z1=c;this.x2=f;this.y2=g;this.z2=h},function(a){return new THREE.Vector3(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a,this.z1+(this.z2-this.z1)*a)});
|
|
|
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c,f,g,h,e,j,k){this.x0=a;this.y0=b;this.z0=c;this.x1=f;this.y1=g;this.z1=h;this.x2=e;this.y2=j;this.z2=k},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.x0,this.x1,this.x2);c=THREE.Shape.Utils.b2(a,this.y0,this.y1,this.y2);a=THREE.Shape.Utils.b2(a,this.z0,this.z1,this.z2);return new THREE.Vector2(b,c,a)});THREE.Path=function(a){this.actions=[];this.curves=[];a&&this.fromPoints(a)};
|
|
|
+THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;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(a,b){var c=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],a,b);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:c,curve:f})};
|
|
|
+THREE.Path.prototype.quadraticCurveTo=function(a,b,c,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.QuadraticBezierCurve(h[h.length-2],h[h.length-1],a,b,c,f);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:h})};
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(a,b,c,f,g,h){var e=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.CubicBezierCurve(j[j.length-2],j[j.length-1],a,b,c,f,g,h);this.curves.push(j);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e,curve:j})};
|
|
|
+THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])],c=c.concat(a),c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b,curve:c})};
|
|
|
+THREE.Path.prototype.arc=function(a,b,c,f,g,h){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],f=0;f<a;f++)c.push(this.getPoint(f/a));b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],f,g,h,e,j,k,l,m,n,p,o,x,w;f=0;for(g=this.actions.length;f<g;f++)switch(h=this.actions[f],e=h.action,h=h.args,e){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=h[2];k=h[3];n=h[0];p=h[1];c.length>0?(e=c[c.length-1],o=e.x,x=e.y):(e=this.actions[f-1].args,o=e[e.length-2],x=e[e.length-1]);for(e=1;e<=a;e++)w=e/a,h=THREE.Shape.Utils.b2(w,o,n,j),w=THREE.Shape.Utils.b2(w,x,p,
|
|
|
+k),c.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];p=h[1];l=h[2];m=h[3];c.length>0?(e=c[c.length-1],o=e.x,x=e.y):(e=this.actions[f-1].args,o=e[e.length-2],x=e[e.length-1]);for(e=1;e<=a;e++)w=e/a,h=THREE.Shape.Utils.b3(w,o,n,l,j),w=THREE.Shape.Utils.b3(w,x,p,m,k),c.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[f-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];w=a*h[0].length;e=e.concat(h[0]);h=new THREE.SplineCurve(e);
|
|
|
+for(e=1;e<=w;e++)c.push(h.getPointAt(e/w));break;case THREE.PathActions.ARC:e=this.actions[f-1].args;j=h[0];k=h[1];l=h[2];n=h[3];w=h[4];p=!!h[5];m=e[e.length-2];o=e[e.length-1];e.length==0&&(m=o=0);x=w-n;var u=a*2;for(e=1;e<=u;e++)w=e/u,p||(w=1-w),w=n+w*x,h=m+j+l*Math.cos(w),w=o+k+l*Math.sin(w),c.push(new THREE.Vector2(h,w))}b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),b,c,f,g;b=c=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,e,j;e=0;for(j=a.length;e<j;e++){h=a[e];if(h.x>b)b=h.x;else if(h.x<f)f=h.x;if(h.y>c)c=h.y;else if(h.y<c)g=h.y}return{minX:f,minY:g,maxX:b,maxY:c}};THREE.Path.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.sums,a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};
|
|
|
+THREE.Path.prototype.getLength=function(){var a=[],b=0,c,f=this.curves.length;for(c=0;c<f;c++)b+=this.curves[c].getLength(),a.push(b);this.sums=a;return b};THREE.Path.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};THREE.Path.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};
|
|
|
+THREE.Path.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};
|
|
|
+THREE.Path.prototype.transform=function(a){a=new THREE.Path;a.moveTo(0,0);a.quadraticCurveTo(100,20,140,80);console.log(a.cacheArcLengths());var b=this.getMinAndMax(),c=this.getPoints(),f,g,h,e,j,k;f=0;for(g=c.length;f<g;f++)h=c[f],e=h.x,j=h.y,k=e/b.maxX,e=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),h.x=e.x+j.x,h.y=e.y+j.y;return c};
|
|
|
+THREE.Path.prototype.nltransform=function(a,b,c,f,g,h){var e=this.getPoints(),j,k,l,m,n;j=0;for(k=e.length;j<k;j++)l=e[j],m=l.x,n=l.y,l.x=a*m+b*n+c,l.y=f*n+g*m+h;return e};
|
|
|
+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,f,g,a=0;for(c=this.actions.length;a<c;a++)f=this.actions[a],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&b[f].apply(b,g);b.stroke();b.closePath();b.strokeStyle="red";f=this.getPoints();
|
|
|
+a=0;for(c=f.length;a<c;a++)g=f[a],b.beginPath(),b.arc(g.x,g.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
|
+THREE.Path.prototype.toShapes=function(){var a,b,c,f,g=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],f=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[c].apply(h,f);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var e,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(b=g.length;a<b;a++)f=g[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(e&&h.push(e),e=new THREE.Shape,e.actions=f.actions,e.curves=
|
|
|
+f.curves):e.holes.push(f);h.push(e)}else{e=new THREE.Shape;a=0;for(b=g.length;a<b;a++)f=g[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(e.actions=f.actions,e.curves=f.curves,h.push(e),e=new THREE.Shape):e.holes.push(f)}return h};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.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
+THREE.Shape.prototype.getPointsHoles=function(){var a,b=this.holes.length,c=[];for(a=0;a<b;a++)c[a]=this.holes[a].getPoints();return c};THREE.Shape.prototype.getSpacedPointsHoles=function(){var a,b=this.holes.length,c=[];for(a=0;a<b;a++)c[a]=this.holes[a].getSpacedPoints();return c};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),f=c.concat(),g,h,e,j,k,l,m,n,p,o,x=[];for(k=0;k<b.length;k++){l=b[k];f=f.concat(l);h=Number.POSITIVE_INFINITY;for(g=0;g<l.length;g++){p=l[g];o=[];for(n=0;n<c.length;n++)m=c[n],m=p.distanceTo(m),o.push(m),m<h&&(h=m,e=g,j=n)}g=j-1>=0?j-1:c.length-1;h=e-1>=0?e-1:l.length-1;var w=[l[e],c[j],c[g]];n=THREE.FontUtils.Triangulate.area(w);var u=[l[e],l[h],c[j]];p=THREE.FontUtils.Triangulate.area(u);o=j;m=e;j+=1;e+=-1;j<0&&(j+=c.length);j%=c.length;
|
|
|
+e<0&&(e+=l.length);e%=l.length;g=j-1>=0?j-1:c.length-1;h=e-1>=0?e-1:l.length-1;w=[l[e],c[j],c[g]];w=THREE.FontUtils.Triangulate.area(w);u=[l[e],l[h],c[j]];u=THREE.FontUtils.Triangulate.area(u);n+p>w+u&&(j=o,e=m,j<0&&(j+=c.length),j%=c.length,e<0&&(e+=l.length),e%=l.length,g=j-1>=0?j-1:c.length-1,h=e-1>=0?e-1:l.length-1);n=c.slice(0,j);p=c.slice(j);o=l.slice(e);m=l.slice(0,e);h=[l[e],l[h],c[j]];x.push([l[e],c[j],c[g]]);x.push(h);c=n.concat(o).concat(m).concat(p)}return{shape:c,isolatedPts:x,allpoints:f}},
|
|
|
+triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),f=c.allpoints,g=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,e,j,k;for(h=0;h<c.length;h++){k=c[h];for(e=0;e<3;e++)for(j=0;j<f.length;j++)f[j].equals(k[e])&&(k[e]=j)}for(h=0;h<g.length;h++){k=g[h];for(e=0;e<3;e++)for(j=0;j<f.length;j++)f[j].equals(k[e])&&(k[e]=j)}return c.concat(g)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},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,f){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,f)},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,f,g){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,f)+this.b3p3(a,g)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};
|
|
|
+THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,f=b.font!==void 0?b.font:"helvetiker",g=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
|
|
|
+THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,f=a.length;c<f;c++)b=b.concat(a[c].toShapes());return b};
|
|
|
+THREE.CubeGeometry=function(a,b,c,f,g,h,e,j,k){function l(a,c,b,e,j,k,l,o){var n,p,x=f||1,w=g||1,E=j/2,L=k/2,H=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")n="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")n="y",w=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")n="x",x=h||1;var I=x+1,O=w+1;j/=x;var Q=k/w;for(p=0;p<O;p++)for(k=0;k<I;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*b;C[c]=(p*Q-L)*e;C[n]=l;m.vertices.push(new THREE.Vertex(C))}for(p=0;p<w;p++)for(k=0;k<x;k++)m.faces.push(new THREE.Face4(k+I*p+
|
|
|
+H,k+I*(p+1)+H,k+1+I*(p+1)+H,k+1+I*p+H,null,null,o)),m.faceVertexUvs[0].push([new THREE.UV(k/x,p/w),new THREE.UV(k/x,(p+1)/w),new THREE.UV((k+1)/x,(p+1)/w),new THREE.UV((k+1)/x,p/w)])}THREE.Geometry.call(this);var m=this,n=a/2,p=b/2,o=c/2,j=j?-1:1;if(e!==void 0)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=void 0&&(this.sides[w]=
|
|
|
+k[w]);this.sides.px&&l("z","y",1*j,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,p,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-p,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,o,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-o,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=m.vertices.length;b<e;b++){for(var f=m.vertices[b],h=!1,g=0,j=a.length;g<j;g++){var k=a[g];if(f.position.x==k.position.x&&
|
|
|
+f.position.y==k.position.y&&f.position.z==k.position.z){c[b]=g;h=!0;break}}if(!h)c[b]=a.length,a.push(new THREE.Vertex(f.position.clone()))}b=0;for(e=m.faces.length;b<e;b++)f=m.faces[b],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.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,f,g,h){function e(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=f/2;for(k=0;k<a;k++)e(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)e(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){e(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){e(0,0,m+
|
|
|
+(g||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],g=this.vertices[c.a],h=this.vertices[c.b],m=this.vertices[c.c],n=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/l,0.5+g.position.z/f));b.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/f));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
|
|
|
+f));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/f));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){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,f=a.length,g;for(c=0;c<f;c++)g=a[c],this.addShape(g,b)}};
|
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){return a.clone().addSelf(b.clone().multiplyScalar(c))}function f(a,b,c){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a+=Math.PI*2);anglec=(b+a)/2;return(new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec))).normalize()}function g(a){for(z=a.length;--z>=0;){M=z;N=z-1;N<0&&(N=a.length-1);for(var b=0,b=0;b<p+n*2;b++){var c=I*b,e=I*(b+1),f=R+M+c,c=R+N+c,h=R+N+e,e=R+M+e;f+=A;c+=A;h+=A;e+=A;t.faces.push(new THREE.Face4(f,
|
|
|
-c,h,e))}}}function h(a,b,c){t.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=A;b+=A;c+=A;t.faces.push(new THREE.Face3(a,b,c))}var j=c.amount!==void 0?c.amount:100,k=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:k-2,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,n=c.bevelSegments!==void 0?c.bevelSegments:3;m||(n=0);var p=c.steps!==void 0?c.steps:1,o=c.path!==void 0?c.path:null,x,w=!1;if(o)x=o.getPoints(),p=x.length,w=!0;var u,v,y,t=this,
|
|
|
-A=this.vertices.length,o=a.extractAllPoints(),B=o.shape,o=o.holes,G=!THREE.Shape.Utils.isClockWise(B);if(G){B=B.reverse();v=0;for(y=o.length;v<y;v++)u=o[v],THREE.Shape.Utils.isClockWise(u)&&(o[v]=u.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(B,o),F=B;v=0;for(y=o.length;v<y;v++)u=o[v],B=B.concat(u);var z,D,J=new THREE.Vector2;z=0;for(D=F.length;z<D;z++)J.addSelf(F[z]);J.divideScalar(F.length);v=0;for(y=o.length;v<y;v++){J=new THREE.Vector2;u=o[v];z=0;for(D=u.length;z<D;z++)J.addSelf(u[z]);
|
|
|
-J.divideScalar(u.length)}var K,E,L,H,I=B.length,J=G.length,O=[];z=0;D=F.length;M=D-1;for(N=z+1;z<D;z++,M++,N++)M==D&&(M=0),N==D&&(N=0),O[z]=f(F[z],F[M],F[N]);var Q=[],C,P=O.concat();v=0;for(y=o.length;v<y;v++){u=o[v];C=[];z=0;D=u.length;M=D-1;for(N=z+1;z<D;z++,M++,N++)M==D&&(M=0),N==D&&(N=0),C[z]=f(u[z],u[M],u[N]);Q.push(C);P=P.concat(C)}for(K=0;K<n;K++){u=K/n;L=k*(1-u);E=l*Math.sin(u*Math.PI/2);z=0;for(D=F.length;z<D;z++)H=b(F[z],O[z],E),h(H.x,H.y,-L);v=0;for(y=o.length;v<y;v++){u=o[v];C=Q[v];z=
|
|
|
-0;for(D=u.length;z<D;z++)H=b(u[z],C[z],E),h(H.x,H.y,-L)}}E=l;for(z=0;z<I;z++)H=b(B[z],P[z],E),w?h(H.x,H.y+x[0].y,x[0].x):h(H.x,H.y,0);for(u=1;u<=p;u++)for(z=0;z<I;z++)H=b(B[z],P[z],E),w?h(H.x,H.y+x[u-1].y,x[u-1].x):h(H.x,H.y,j/p*u);for(K=n-1;K>=0;K--){u=K/n;L=k*(1-u);E=l*Math.sin(u*Math.PI/2);z=0;for(D=F.length;z<D;z++)H=b(F[z],O[z],E),h(H.x,H.y,j+L);v=0;for(y=o.length;v<y;v++){u=o[v];C=Q[v];z=0;for(D=u.length;z<D;z++)H=b(u[z],C[z],E),w?h(H.x,H.y+x[p-1].y,x[p-1].x+L):h(H.x,H.y,j+L)}}if(m){k=I*0;for(z=
|
|
|
-0;z<J;z++)j=G[z],e(j[2]+k,j[1]+k,j[0]+k);k=I*(p+n*2);for(z=0;z<J;z++)j=G[z],e(j[0]+k,j[1]+k,j[2]+k)}else{for(z=0;z<J;z++)j=G[z],e(j[2],j[1],j[0]);for(z=0;z<J;z++)j=G[z],e(j[0]+I*p,j[1]+I*p,j[2]+I*p)}var M,N,R=0;g(F);R+=F.length;v=0;for(y=o.length;v<y;v++)u=o[v],g(u),R+=u.length;this.computeCentroids();this.computeFaceNormals()};
|
|
|
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function f(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var j in h.faces){var k=f(h.faces[j].a,h.faces[j].b),l=f(h.faces[j].b,h.faces[j].c),m=f(h.faces[j].c,h.faces[j].a);b(h.faces[j].a,k,m,e);b(h.faces[j].b,l,k,e);
|
|
|
-b(h.faces[j].c,m,l,e);b(k,l,m,e)}h.faces=e.faces}g.faces=h.faces;delete h;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],f=[],g=[],h=[],e=(new THREE.Matrix4).setRotationZ(c),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),b[j]=a[j].clone(),f[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=c){for(j=0;j<b.length;j++)k<this.angle?(b[j]=e.multiplyVector3(b[j].clone()),this.vertices.push(new THREE.Vertex(b[j])),g[j]=this.vertices.length-1):g=h;k==0&&(h=f);
|
|
|
-for(j=0;j<f.length-1;j++)this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[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-c)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-c)/this.angle,j/a.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,c,b,f){THREE.Geometry.call(this);var g,h=a/2,e=c/2,b=b||1,f=f||1,j=b+1,k=f+1;a/=b;var l=c/f;for(g=0;g<k;g++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*l-e),0)));for(g=0;g<f;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+j*g,c+j*(g+1),c+1+j*(g+1),c+1+j*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/f),new THREE.UV(c/b,(g+1)/f),new THREE.UV((c+1)/b,(g+1)/f),new THREE.UV((c+1)/b,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){return a.clone().addSelf(c.clone().multiplyScalar(b))}function f(a,c,b){c=Math.atan2(c.y-a.y,c.x-a.x);a=Math.atan2(b.y-a.y,b.x-a.x);c>a&&(a+=Math.PI*2);anglec=(c+a)/2;return(new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec))).normalize()}function g(a){for(z=a.length;--z>=0;){M=z;N=z-1;N<0&&(N=a.length-1);for(var c=0,c=0;c<p+m*2;c++){var b=I*c,e=I*(c+1),f=R+M+b,b=R+N+b,h=R+N+e,e=R+M+e;f+=A;b+=A;h+=A;e+=A;t.faces.push(new THREE.Face4(f,
|
|
|
+b,h,e))}}}function h(a,c,b){t.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function e(a,c,b){a+=A;c+=A;b+=A;t.faces.push(new THREE.Face3(a,c,b))}var j=b.amount!==void 0?b.amount:100,k=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:k-2,m=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:!0;n||(l=k=m=0);var p=b.steps!==void 0?b.steps:1,o=b.path!==void 0?b.path:null,x,w=!1;if(o)x=o.getPoints(),p=x.length,w=!0;var u,v,y,t=
|
|
|
+this,A=this.vertices.length,o=a.extractAllPoints(),B=o.shape,o=o.holes,G=!THREE.Shape.Utils.isClockWise(B);if(G){B=B.reverse();v=0;for(y=o.length;v<y;v++)u=o[v],THREE.Shape.Utils.isClockWise(u)&&(o[v]=u.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(B,o),F=B;v=0;for(y=o.length;v<y;v++)u=o[v],B=B.concat(u);var z,D,J=new THREE.Vector2;z=0;for(D=F.length;z<D;z++)J.addSelf(F[z]);J.divideScalar(F.length);v=0;for(y=o.length;v<y;v++){J=new THREE.Vector2;u=o[v];z=0;for(D=u.length;z<D;z++)J.addSelf(u[z]);
|
|
|
+J.divideScalar(u.length)}var K,E,L,H,I=B.length,J=G.length,O=[];z=0;D=F.length;M=D-1;for(N=z+1;z<D;z++,M++,N++)M==D&&(M=0),N==D&&(N=0),O[z]=f(F[z],F[M],F[N]);var Q=[],C,P=O.concat();v=0;for(y=o.length;v<y;v++){u=o[v];C=[];z=0;D=u.length;M=D-1;for(N=z+1;z<D;z++,M++,N++)M==D&&(M=0),N==D&&(N=0),C[z]=f(u[z],u[M],u[N]);Q.push(C);P=P.concat(C)}for(K=0;K<m;K++){u=K/m;L=k*(1-u);E=l*Math.sin(u*Math.PI/2);z=0;for(D=F.length;z<D;z++)H=c(F[z],O[z],E),h(H.x,H.y,-L);v=0;for(y=o.length;v<y;v++){u=o[v];C=Q[v];z=
|
|
|
+0;for(D=u.length;z<D;z++)H=c(u[z],C[z],E),h(H.x,H.y,-L)}}E=l;for(z=0;z<I;z++)H=c(B[z],P[z],E),w?h(H.x,H.y+x[0].y,x[0].x):h(H.x,H.y,0);for(u=1;u<=p;u++)for(z=0;z<I;z++)H=c(B[z],P[z],E),w?h(H.x,H.y+x[u-1].y,x[u-1].x):h(H.x,H.y,j/p*u);for(K=m-1;K>=0;K--){u=K/m;L=k*(1-u);E=l*Math.sin(u*Math.PI/2);z=0;for(D=F.length;z<D;z++)H=c(F[z],O[z],E),h(H.x,H.y,j+L);v=0;for(y=o.length;v<y;v++){u=o[v];C=Q[v];z=0;for(D=u.length;z<D;z++)H=c(u[z],C[z],E),w?h(H.x,H.y+x[p-1].y,x[p-1].x+L):h(H.x,H.y,j+L)}}if(n){k=I*0;for(z=
|
|
|
+0;z<J;z++)j=G[z],e(j[2]+k,j[1]+k,j[0]+k);k=I*(p+m*2);for(z=0;z<J;z++)j=G[z],e(j[0]+k,j[1]+k,j[2]+k)}else{for(z=0;z<J;z++)j=G[z],e(j[2],j[1],j[0]);for(z=0;z<J;z++)j=G[z],e(j[0]+I*p,j[1]+I*p,j[2]+I*p)}var M,N,R=0;g(F);R+=F.length;v=0;for(y=o.length;v<y;v++)u=o[v],g(u),R+=u.length;this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function f(a,c){var e=g.vertices[a].position,f=g.vertices[c].position;return b((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry,e;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++){e=new THREE.Geometry;for(var j in h.faces){var k=f(h.faces[j].a,h.faces[j].b),l=f(h.faces[j].b,h.faces[j].c),m=f(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,e);c(h.faces[j].b,l,k,e);
|
|
|
+c(h.faces[j].c,m,l,e);c(k,l,m,e)}h.faces=e.faces}g.faces=h.faces;delete h;delete e;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=[],f=[],g=[],h=[],e=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),f[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]=e.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),g[j]=this.vertices.length-1):g=h;k==0&&(h=f);
|
|
|
+for(j=0;j<f.length-1;j++)this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[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)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
+THREE.PlaneGeometry=function(a,b,c,f){THREE.Geometry.call(this);var g,h=a/2,e=b/2,c=c||1,f=f||1,j=c+1,k=f+1;a/=c;var l=b/f;for(g=0;g<k;g++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(g*l-e),0)));for(g=0;g<f;g++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*g,b+j*(g+1),b+1+j*(g+1),b+1+j*g)),this.faceVertexUvs[0].push([new THREE.UV(b/c,g/f),new THREE.UV(b/c,(g+1)/f),new THREE.UV((b+1)/c,(g+1)/f),new THREE.UV((b+1)/c,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,f,g=Math.PI,h=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){f=b/e;var j=a*Math.cos(f*g),k=a*Math.sin(f*g),l=[],m=0;for(f=0;f<h;f++){var n=2*f/h,p=k*Math.sin(n*g),n=k*Math.cos(n*g);(b==0||b==e)&&f>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,p)))-1);l.push(m)}c.push(l)}for(var o,x,w,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(f=0;f<h;f++){l=f==h-1;e=c[b][l?0:f+1];j=c[b][l?h-1:f];k=c[b-1][l?
|
|
|
-h-1:f];l=c[b-1][l?0:f+1];p=b/(g-1);o=(b-1)/(g-1);x=(f+1)/h;var n=f/h,m=new THREE.UV(1-x,p),p=new THREE.UV(1-n,p),n=new THREE.UV(1-n,o),u=new THREE.UV(1-x,o);b<c.length-1&&(o=this.vertices[e].position.clone(),x=this.vertices[j].position.clone(),w=this.vertices[k].position.clone(),o.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(e,j,k,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,p,n]));b>1&&(o=
|
|
|
+THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,f,g=Math.PI,h=Math.max(3,b||8),e=Math.max(2,c||6),b=[],c=0;c<e+1;c++){f=c/e;var j=a*Math.cos(f*g),k=a*Math.sin(f*g),l=[],m=0;for(f=0;f<h;f++){var n=2*f/h,p=k*Math.sin(n*g),n=k*Math.cos(n*g);(c==0||c==e)&&f>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,p)))-1);l.push(m)}b.push(l)}for(var o,x,w,g=b.length,c=0;c<g;c++)if(h=b[c].length,c>0)for(f=0;f<h;f++){l=f==h-1;e=b[c][l?0:f+1];j=b[c][l?h-1:f];k=b[c-1][l?
|
|
|
+h-1:f];l=b[c-1][l?0:f+1];p=c/(g-1);o=(c-1)/(g-1);x=(f+1)/h;var n=f/h,m=new THREE.UV(1-x,p),p=new THREE.UV(1-n,p),n=new THREE.UV(1-n,o),u=new THREE.UV(1-x,o);c<b.length-1&&(o=this.vertices[e].position.clone(),x=this.vertices[j].position.clone(),w=this.vertices[k].position.clone(),o.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(e,j,k,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,p,n]));c>1&&(o=
|
|
|
this.vertices[e].position.clone(),x=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),o.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(e,k,l,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,n,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,c){var b=(new THREE.TextPath(a,c)).toShapes();THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
|
-this.getFace(),b=this.size/c.resolution,f=0,g=String(a).split(""),h=g.length,e=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(g[a],c,b,f,j);f+=j.offset;e.push(j.path)}return{paths:e,offset:f/2}},extractGlyphPoints:function(a,c,b,f,g){var h=[],e,j,k,l,m,n,p,o,x,w,u=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(u){if(u.o){c=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=c.length;for(a=0;a<k;)switch(j=c[a++],j){case "m":j=c[a++]*b+f;l=c[a++]*b;h.push(new THREE.Vector2(j,
|
|
|
-l));g.moveTo(j,l);break;case "l":j=c[a++]*b+f;l=c[a++]*b;h.push(new THREE.Vector2(j,l));g.lineTo(j,l);break;case "q":j=c[a++]*b+f;l=c[a++]*b;p=c[a++]*b+f;o=c[a++]*b;g.quadraticCurveTo(p,o,j,l);if(e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++){var v=e/divisions,y=THREE.Shape.Utils.b2(v,m,p,j),v=THREE.Shape.Utils.b2(v,n,o,l);h.push(new THREE.Vector2(y,v))}}break;case "b":if(j=c[a++]*b+f,l=c[a++]*b,p=c[a++]*b+f,o=c[a++]*-b,x=c[a++]*b+f,w=c[a++]*-b,g.bezierCurveTo(j,l,
|
|
|
-p,o,x,w),e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++)v=e/divisions,y=THREE.Shape.Utils.b3(v,m,p,x,j),v=THREE.Shape.Utils.b3(v,n,o,w,l),h.push(new THREE.Vector2(y,v))}}}return{offset:u.ha*b,points:h,path:g}}}};
|
|
|
-(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,e=0;e<c;h=e++)g+=a[h].x*a[e].y-a[e].x*a[h].y;return g*0.5};a.Triangulate=function(a,f){var g=a.length;if(g<3)return null;var h=[],e=[],j=[],k,l,m;if(c(a)>0)for(l=0;l<g;l++)e[l]=l;else for(l=0;l<g;l++)e[l]=g-1-l;var n=2*g;for(l=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return j;return h}k=l;g<=k&&(k=0);l=k+1;g<=l&&(l=0);m=l+1;g<=m&&(m=0);var p;a:{p=a;var o=k,x=l,w=m,u=g,v=e,y=void 0,t=void 0,A=void 0,
|
|
|
+THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},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},drawText:function(a){for(var b=
|
|
|
+this.getFace(),c=this.size/b.resolution,f=0,g=String(a).split(""),h=g.length,e=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(g[a],b,c,f,j);f+=j.offset;e.push(j.path)}return{paths:e,offset:f/2}},extractGlyphPoints:function(a,b,c,f,g){var h=[],e,j,k,l,m,n,p,o,x,w,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+f;l=b[a++]*c;h.push(new THREE.Vector2(j,
|
|
|
+l));g.moveTo(j,l);break;case "l":j=b[a++]*c+f;l=b[a++]*c;h.push(new THREE.Vector2(j,l));g.lineTo(j,l);break;case "q":j=b[a++]*c+f;l=b[a++]*c;p=b[a++]*c+f;o=b[a++]*c;g.quadraticCurveTo(p,o,j,l);if(e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++){var v=e/divisions,y=THREE.Shape.Utils.b2(v,m,p,j),v=THREE.Shape.Utils.b2(v,n,o,l);h.push(new THREE.Vector2(y,v))}}break;case "b":if(j=b[a++]*c+f,l=b[a++]*c,p=b[a++]*c+f,o=b[a++]*-c,x=b[a++]*c+f,w=b[a++]*-c,g.bezierCurveTo(j,l,
|
|
|
+p,o,x,w),e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++)v=e/divisions,y=THREE.Shape.Utils.b3(v,m,p,x,j),v=THREE.Shape.Utils.b3(v,n,o,w,l),h.push(new THREE.Vector2(y,v))}}}return{offset:u.ha*c,points:h,path:g}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,e=0;e<b;h=e++)g+=a[h].x*a[e].y-a[e].x*a[h].y;return g*0.5};a.Triangulate=function(a,f){var g=a.length;if(g<3)return null;var h=[],e=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<g;l++)e[l]=l;else for(l=0;l<g;l++)e[l]=g-1-l;var n=2*g;for(l=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return j;return h}k=l;g<=k&&(k=0);l=k+1;g<=l&&(l=0);m=l+1;g<=m&&(m=0);var p;a:{p=a;var o=k,x=l,w=m,u=g,v=e,y=void 0,t=void 0,A=void 0,
|
|
|
B=void 0,G=void 0,F=void 0,z=void 0,D=void 0,J=void 0,t=p[v[o]].x,A=p[v[o]].y,B=p[v[x]].x,G=p[v[x]].y,F=p[v[w]].x,z=p[v[w]].y;if(1.0E-10>(B-t)*(z-A)-(G-A)*(F-t))p=!1;else{for(y=0;y<u;y++)if(!(y==o||y==x||y==w)){var D=p[v[y]].x,J=p[v[y]].y,K=void 0,E=void 0,L=void 0,H=void 0,I=void 0,O=void 0,Q=void 0,C=void 0,P=void 0,M=void 0,N=void 0,R=void 0,K=L=I=void 0,K=F-B,E=z-G,L=t-F,H=A-z,I=B-t,O=G-A,Q=D-t,C=J-A,P=D-B,M=J-G,N=D-F,R=J-z,K=K*M-E*P,I=I*C-O*Q,L=L*R-H*N;if(K>=0&&L>=0&&I>=0){p=!1;break a}}p=!0}}if(p){h.push([a[e[k]],
|
|
|
-a[e[l]],a[e[m]]]);j.push([e[k],e[l],e[m]]);k=l;for(m=l+1;m<g;k++,m++)e[k]=e[m];g--;n=2*g}}if(f)return j;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
-THREE.TorusGeometry=function(a,c,b,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=f||6;a=[];for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){var f=b/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
|
|
|
-1;b<=this.segmentsT;++b){var f=(this.segmentsT+1)*c+b,g=(this.segmentsT+1)*c+b-1,h=(this.segmentsT+1)*(c-1)+b-1,e=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(f,g,h,e));this.faceVertexUvs[0].push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
+a[e[l]],a[e[m]]]);j.push([e[k],e[l],e[m]]);k=l;for(m=l+1;m<g;k++,m++)e[k]=e[m];g--;n=2*g}}if(f)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,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=f||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var f=c/this.segmentsT*2*Math.PI,g=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
|
|
|
+1;c<=this.segmentsT;++c){var f=(this.segmentsT+1)*b+c,g=(this.segmentsT+1)*b+c-1,h=(this.segmentsT+1)*(b-1)+c-1,e=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(f,g,h,e));this.faceVertexUvs[0].push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[e][0],a[e][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,c,b,f,g,h,e){function j(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
|
-this.segmentsT;++c){var k=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=j(k,e,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=k.x-g.x;b.y=k.y-g.y;b.z=k.z-g.z;f.x=k.x+g.x;f.y=k.y+g.y;f.z=k.z+g.z;h.cross(b,f);f.cross(h,b);h.normalize();f.normalize();k=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=k*f.x+e*h.x;g.y+=k*f.y+e*h.y;g.z+=k*f.z+e*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var f=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[f][c],f=this.grid[f][h],h=this.grid[a][h],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,f,h));this.faceVertexUvs[0].push([e,k,l,m])}this.computeCentroids();
|
|
|
+THREE.TorusKnotGeometry=function(a,b,c,f,g,h,e){function j(a,c,b,e,f,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(f*(2+b)*0.5*Math.cos(a),f*(2+b)*Math.sin(a)*0.5,h*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=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,e=b/this.segmentsT*2*Math.PI,g=j(k,e,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,e,this.q,this.p,this.radius,this.heightScale);c.x=k.x-g.x;c.y=k.y-g.y;c.z=k.z-g.z;f.x=k.x+g.x;f.y=k.y+g.y;f.z=k.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();k=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=k*f.x+e*h.x;g.y+=k*f.y+e*h.y;g.z+=k*f.z+e*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,g=this.grid[a][b],c=this.grid[f][b],f=this.grid[f][h],h=this.grid[a][h],e=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(g,c,f,h));this.faceVertexUvs[0].push([e,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 c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
|
|
|
-this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var f=0;f<c.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],b)]},hasNormals:function(a){var c,b,f=a.materials.length;for(b=0;b<f;b++)if(c=a.materials[b][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function f(a,c){var e=
|
|
|
-new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,e,h,g,j){var k=document.createElement("canvas");a[b]=new THREE.Texture(k);a[b].sourceFile=e;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;if(h[1]!=
|
|
|
-1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(j){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[j[0]]!==void 0)a[b].wrapS=h[j[0]];if(h[j[1]]!==void 0)a[b].wrapT=h[j[1]]}f(a[b],c+"/"+e)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,j,k;j="MeshLambertMaterial";e={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"));
|
|
|
+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 f=0;f<b.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(b[f],c)]},hasNormals:function(a){var b,c,f=a.materials.length;for(c=0;c<f;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 f(a,b){var e=
|
|
|
+new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}function g(a,c,e,h,g,j){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=e;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(h[1]!=
|
|
|
+1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(j){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[j[0]]!==void 0)a[c].wrapS=h[j[0]];if(h[j[1]]!==void 0)a[c].wrapT=h[j[1]]}f(a[c],b+"/"+e)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,j,k;j="MeshLambertMaterial";e={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")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=h(a.colorDiffuse);
|
|
|
-else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=h(a.colorSpecular);if(a.colorAmbient)e.ambient=h(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
-a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),n=e.color;j=e.specular;k=e.ambient;var p=e.shininess;m.tNormal.texture=e.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(e.map)m.tDiffuse.texture=e.map,m.enableDiffuse.value=!0;if(e.specularMap)m.tSpecular.texture=e.specularMap,m.enableSpecular.value=!0;if(e.lightMap)m.tAO.texture=
|
|
|
+else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=h(a.colorSpecular);if(a.colorAmbient)e.ambient=h(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&b&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
+a.mapSpecular&&b&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),n=e.color;j=e.specular;k=e.ambient;var p=e.shininess;m.tNormal.texture=e.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(e.map)m.tDiffuse.texture=e.map,m.enableDiffuse.value=!0;if(e.specularMap)m.tSpecular.texture=e.specularMap,m.enableSpecular.value=!0;if(e.lightMap)m.tAO.texture=
|
|
|
e.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(n);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=p;if(e.opacity)m.uOpacity.value=e.opacity;e=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else e=new THREE[j](e);return e}};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 c=this,b=a.model,f=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(b),a=new Worker(b);a.onmessage=function(a){c.createModel(a.data,f,g);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var f=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(f,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,k,l,m,n,p,o,x,w,u,v,y,t,A=a.faces;n=a.vertices;var B=a.normals,G=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)p=new THREE.Vertex,p.position.x=n[l++]*b,p.position.y=
|
|
|
-n[l++]*b,p.position.z=n[l++]*b,f.vertices.push(p);l=0;for(m=A.length;l<m;){b=A[l++];n=b&1;k=b&2;c=b&4;g=b&8;o=b&16;p=b&32;w=b&64;b&=128;n?(u=new THREE.Face4,u.a=A[l++],u.b=A[l++],u.c=A[l++],u.d=A[l++],n=4):(u=new THREE.Face3,u.a=A[l++],u.b=A[l++],u.c=A[l++],n=3);if(k)k=A[l++],u.materials=f.materials[k];k=f.faces.length;if(c)for(c=0;c<F;c++)v=a.uvs[c],x=A[l++],t=v[x*2],x=v[x*2+1],f.faceUvs[c][k]=new THREE.UV(t,x);if(g)for(c=0;c<F;c++){v=a.uvs[c];y=[];for(g=0;g<n;g++)x=A[l++],t=v[x*2],x=v[x*2+1],y[g]=
|
|
|
-new THREE.UV(t,x);f.faceVertexUvs[c][k]=y}if(o)o=A[l++]*3,g=new THREE.Vector3,g.x=B[o++],g.y=B[o++],g.z=B[o],u.normal=g;if(p)for(c=0;c<n;c++)o=A[l++]*3,g=new THREE.Vector3,g.x=B[o++],g.y=B[o++],g.z=B[o],u.vertexNormals.push(g);if(w)p=A[l++],p=new THREE.Color(G[p]),u.color=p;if(b)for(c=0;c<n;c++)p=A[l++],p=new THREE.Color(G[p]),u.vertexColors.push(p);f.faces.push(u)}}})(g);(function(){var b,c,g,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],k=a.skinWeights[b+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
-k,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],k=a.skinIndices[b+1],f.skinIndices.push(new THREE.Vector4(g,k,0,0))}f.bones=a.bones;f.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,k,l,m,n,p,o,x;c=0;for(g=a.morphTargets.length;c<g;c++){f.morphTargets[c]={};f.morphTargets[c].name=a.morphTargets[c].name;f.morphTargets[c].vertices=[];o=f.morphTargets[c].vertices;x=a.morphTargets[c].vertices;k=0;for(l=x.length;k<l;k+=3)m=x[k]*b,n=x[k+1]*
|
|
|
-b,p=x[k+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){f.morphColors[c]={};f.morphColors[c].name=a.morphColors[c].name;f.morphColors[c].colors=[];l=f.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(k=m.length;b<k;b+=3)n=new THREE.Color(16755200),n.setRGB(m[b],m[b+1],m[b+2]),l.push(n)}}})(g);(function(){if(a.edges!==void 0){var b,c,g;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],g=a.edges[b+1],f.edges.push(new THREE.Edge(f.vertices[c],
|
|
|
-f.vertices[g],c,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};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 c=a.model,b=a.callback,f=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,g,f,h)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
|
|
|
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,f,g,h){var e=new XMLHttpRequest,j=f+"/"+a,k=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,g,c):alert("Couldn't load ["+j+"] ["+e.status+"]"):e.readyState==3?h&&(k==0&&(k=e.getResponseHeader("Content-Length")),h({total:k,loaded:e.responseText.length})):e.readyState==2&&(k=e.getResponseHeader("Content-Length"))};e.open("GET",j,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
-e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,c,b,f){var g=function(b){function c(a,b){var f=m(a,b),e=m(a,b+1),g=m(a,b+2),h=m(a,b+3),j=(h<<1&255|g>>7)-127;f|=(g&127)<<16|e<<8;if(f==0&&j==-127)return 0;return(1-2*(h>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,j)}function g(a,b){var c=m(a,b),f=m(a,b+1),e=m(a,b+2);return(m(a,b+3)<<24)+(e<<16)+(f<<8)+c}function k(a,b){var c=m(a,b);return(m(a,b+1)<<8)+c}function l(a,b){var c=m(a,b);return c>127?c-256:c}function m(a,
|
|
|
-b){return a.charCodeAt(b)&255}function n(b){var c,f,e;c=g(a,b);f=g(a,b+G);e=g(a,b+F);b=k(a,b+z);THREE.BinaryLoader.prototype.f3(v,c,f,e,b)}function p(b){var c,f,e,h,l,m;c=g(a,b);f=g(a,b+G);e=g(a,b+F);h=k(a,b+z);l=g(a,b+D);m=g(a,b+J);b=g(a,b+K);THREE.BinaryLoader.prototype.f3n(v,A,c,f,e,h,l,m,b)}function o(b){var c,f,e,h;c=g(a,b);f=g(a,b+E);e=g(a,b+L);h=g(a,b+H);b=k(a,b+I);THREE.BinaryLoader.prototype.f4(v,c,f,e,h,b)}function x(b){var c,f,e,h,l,m,n,o;c=g(a,b);f=g(a,b+E);e=g(a,b+L);h=g(a,b+H);l=k(a,
|
|
|
-b+I);m=g(a,b+O);n=g(a,b+Q);o=g(a,b+C);b=g(a,b+P);THREE.BinaryLoader.prototype.f4n(v,A,c,f,e,h,l,m,n,o,b)}function w(b){var c,f;c=g(a,b);f=g(a,b+M);b=g(a,b+N);THREE.BinaryLoader.prototype.uv3(v.faceVertexUvs[0],B[c*2],B[c*2+1],B[f*2],B[f*2+1],B[b*2],B[b*2+1])}function u(b){var c,f,e;c=g(a,b);f=g(a,b+R);e=g(a,b+Y);b=g(a,b+Z);THREE.BinaryLoader.prototype.uv4(v.faceVertexUvs[0],B[c*2],B[c*2+1],B[f*2],B[f*2+1],B[e*2],B[e*2+1],B[b*2],B[b*2+1])}var v=this,y=0,t,A=[],B=[],G,F,z,D,J,K,E,L,H,I,O,Q,C,P,M,N,
|
|
|
-R,Y,Z,T,U,V,W,X,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,f,b);t={signature:a.substr(y,8),header_bytes:m(a,y+8),vertex_coordinate_bytes:m(a,y+9),normal_coordinate_bytes:m(a,y+10),uv_coordinate_bytes:m(a,y+11),vertex_index_bytes:m(a,y+12),normal_index_bytes:m(a,y+13),uv_index_bytes:m(a,y+14),material_index_bytes:m(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+
|
|
|
+THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,f=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,f,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var f=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(f,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,k,l,m,n,p,o,x,w,u,v,y,t,A=a.faces;n=a.vertices;var B=a.normals,G=a.colors,F=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&F++;for(b=0;b<F;b++)f.faceUvs[b]=[],f.faceVertexUvs[b]=[];l=0;for(m=n.length;l<m;)p=new THREE.Vertex,p.position.x=n[l++]*c,p.position.y=
|
|
|
+n[l++]*c,p.position.z=n[l++]*c,f.vertices.push(p);l=0;for(m=A.length;l<m;){c=A[l++];n=c&1;k=c&2;b=c&4;g=c&8;o=c&16;p=c&32;w=c&64;c&=128;n?(u=new THREE.Face4,u.a=A[l++],u.b=A[l++],u.c=A[l++],u.d=A[l++],n=4):(u=new THREE.Face3,u.a=A[l++],u.b=A[l++],u.c=A[l++],n=3);if(k)k=A[l++],u.materials=f.materials[k];k=f.faces.length;if(b)for(b=0;b<F;b++)v=a.uvs[b],x=A[l++],t=v[x*2],x=v[x*2+1],f.faceUvs[b][k]=new THREE.UV(t,x);if(g)for(b=0;b<F;b++){v=a.uvs[b];y=[];for(g=0;g<n;g++)x=A[l++],t=v[x*2],x=v[x*2+1],y[g]=
|
|
|
+new THREE.UV(t,x);f.faceVertexUvs[b][k]=y}if(o)o=A[l++]*3,g=new THREE.Vector3,g.x=B[o++],g.y=B[o++],g.z=B[o],u.normal=g;if(p)for(b=0;b<n;b++)o=A[l++]*3,g=new THREE.Vector3,g.x=B[o++],g.y=B[o++],g.z=B[o],u.vertexNormals.push(g);if(w)p=A[l++],p=new THREE.Color(G[p]),u.color=p;if(c)for(b=0;b<n;b++)p=A[l++],p=new THREE.Color(G[p]),u.vertexColors.push(p);f.faces.push(u)}}})(g);(function(){var c,b,g,k;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],k=a.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
+k,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)g=a.skinIndices[c],k=a.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,k,0,0))}f.bones=a.bones;f.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,g,k,l,m,n,p,o,x;b=0;for(g=a.morphTargets.length;b<g;b++){f.morphTargets[b]={};f.morphTargets[b].name=a.morphTargets[b].name;f.morphTargets[b].vertices=[];o=f.morphTargets[b].vertices;x=a.morphTargets[b].vertices;k=0;for(l=x.length;k<l;k+=3)m=x[k]*c,n=x[k+1]*
|
|
|
+c,p=x[k+2]*c,o.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){f.morphColors[b]={};f.morphColors[b].name=a.morphColors[b].name;f.morphColors[b].colors=[];l=f.morphColors[b].colors;m=a.morphColors[b].colors;c=0;for(k=m.length;c<k;c+=3)n=new THREE.Color(16755200),n.setRGB(m[c],m[c+1],m[c+2]),l.push(n)}}})(g);(function(){if(a.edges!==void 0){var c,b,g;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],g=a.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[b],
|
|
|
+f.vertices[g],b,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();b(f)};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,f=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),g=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,g,f,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
|
|
|
+b.postMessage(a)},loadAjaxBuffers:function(a,b,c,f,g,h){var e=new XMLHttpRequest,j=f+"/"+a,k=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,c,g,b):alert("Couldn't load ["+j+"] ["+e.status+"]"):e.readyState==3?h&&(k==0&&(k=e.getResponseHeader("Content-Length")),h({total:k,loaded:e.responseText.length})):e.readyState==2&&(k=e.getResponseHeader("Content-Length"))};e.open("GET",j,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,b,c,f){var g=function(c){function b(a,c){var f=m(a,c),e=m(a,c+1),g=m(a,c+2),h=m(a,c+3),j=(h<<1&255|g>>7)-127;f|=(g&127)<<16|e<<8;if(f==0&&j==-127)return 0;return(1-2*(h>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,j)}function g(a,c){var b=m(a,c),f=m(a,c+1),e=m(a,c+2);return(m(a,c+3)<<24)+(e<<16)+(f<<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 n(c){var b,f,e;b=g(a,c);f=g(a,c+G);e=g(a,c+F);c=k(a,c+z);THREE.BinaryLoader.prototype.f3(v,b,f,e,c)}function p(c){var b,f,e,h,l,m;b=g(a,c);f=g(a,c+G);e=g(a,c+F);h=k(a,c+z);l=g(a,c+D);m=g(a,c+J);c=g(a,c+K);THREE.BinaryLoader.prototype.f3n(v,A,b,f,e,h,l,m,c)}function o(c){var b,f,e,h;b=g(a,c);f=g(a,c+E);e=g(a,c+L);h=g(a,c+H);c=k(a,c+I);THREE.BinaryLoader.prototype.f4(v,b,f,e,h,c)}function x(c){var b,f,e,h,l,m,n,o;b=g(a,c);f=g(a,c+E);e=g(a,c+L);h=g(a,c+H);l=k(a,
|
|
|
+c+I);m=g(a,c+O);n=g(a,c+Q);o=g(a,c+C);c=g(a,c+P);THREE.BinaryLoader.prototype.f4n(v,A,b,f,e,h,l,m,n,o,c)}function w(c){var b,f;b=g(a,c);f=g(a,c+M);c=g(a,c+N);THREE.BinaryLoader.prototype.uv3(v.faceVertexUvs[0],B[b*2],B[b*2+1],B[f*2],B[f*2+1],B[c*2],B[c*2+1])}function u(c){var b,f,e;b=g(a,c);f=g(a,c+R);e=g(a,c+Y);c=g(a,c+Z);THREE.BinaryLoader.prototype.uv4(v.faceVertexUvs[0],B[b*2],B[b*2+1],B[f*2],B[f*2+1],B[e*2],B[e*2+1],B[c*2],B[c*2+1])}var v=this,y=0,t,A=[],B=[],G,F,z,D,J,K,E,L,H,I,O,Q,C,P,M,N,
|
|
|
+R,Y,Z,T,U,V,W,X,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,f,c);t={signature:a.substr(y,8),header_bytes:m(a,y+8),vertex_coordinate_bytes:m(a,y+9),normal_coordinate_bytes:m(a,y+10),uv_coordinate_bytes:m(a,y+11),vertex_index_bytes:m(a,y+12),normal_index_bytes:m(a,y+13),uv_index_bytes:m(a,y+14),material_index_bytes:m(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+
|
|
|
16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=t.header_bytes;G=t.vertex_index_bytes;F=t.vertex_index_bytes*2;z=t.vertex_index_bytes*3;D=t.vertex_index_bytes*3+t.material_index_bytes;J=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;E=t.vertex_index_bytes;L=t.vertex_index_bytes*2;H=t.vertex_index_bytes*3;I=t.vertex_index_bytes*4;O=t.vertex_index_bytes*
|
|
|
-4+t.material_index_bytes;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;C=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;M=t.uv_index_bytes;N=t.uv_index_bytes*2;R=t.uv_index_bytes;Y=t.uv_index_bytes*2;Z=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;S=t.vertex_index_bytes*4+t.material_index_bytes;T=t.ntri_flat*b;U=t.ntri_smooth*(b+t.normal_index_bytes*3);V=t.ntri_flat_uv*
|
|
|
-(b+t.uv_index_bytes*3);W=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);X=t.nquad_flat*S;b=t.nquad_smooth*(S+t.normal_index_bytes*4);S=t.nquad_flat_uv*(S+t.uv_index_bytes*4);y+=function(b){for(var f,g,h,j=t.vertex_coordinate_bytes*3,k=b+t.nvertices*j;b<k;b+=j)f=c(a,b),g=c(a,b+t.vertex_coordinate_bytes),h=c(a,b+t.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(v,f,g,h);return t.nvertices*j}(y);y+=function(b){for(var c,f,e,g=t.normal_coordinate_bytes*3,h=b+t.nnormals*g;b<h;b+=
|
|
|
-g)c=l(a,b),f=l(a,b+t.normal_coordinate_bytes),e=l(a,b+t.normal_coordinate_bytes*2),A.push(c/127,f/127,e/127);return t.nnormals*g}(y);y+=function(b){for(var f,g,h=t.uv_coordinate_bytes*2,j=b+t.nuvs*h;b<j;b+=h)f=c(a,b),g=c(a,b+t.uv_coordinate_bytes),B.push(f,g);return t.nuvs*h}(y);T=y+T;U=T+U;V=U+V;W=V+W;X=W+X;b=X+b;S=b+S;(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,f=c+t.uv_index_bytes*3,e=a+t.ntri_flat_uv*f;for(b=a;b<e;b+=f)n(b),w(b+c);return e-a})(U);(function(a){var b,c=t.vertex_index_bytes*
|
|
|
-3+t.material_index_bytes+t.normal_index_bytes*3,f=c+t.uv_index_bytes*3,e=a+t.ntri_smooth_uv*f;for(b=a;b<e;b+=f)p(b),w(b+c);return e-a})(V);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,f=c+t.uv_index_bytes*4,e=a+t.nquad_flat_uv*f;for(b=a;b<e;b+=f)o(b),u(b+c);return e-a})(b);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,f=c+t.uv_index_bytes*4,e=a+t.nquad_smooth_uv*f;for(b=a;b<e;b+=f)x(b),u(b+c);return e-a})(S);(function(a){var b,c=t.vertex_index_bytes*
|
|
|
-3+t.material_index_bytes,f=a+t.ntri_flat*c;for(b=a;b<f;b+=c)n(b);return f-a})(y);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,f=a+t.ntri_smooth*c;for(b=a;b<f;b+=c)p(b);return f-a})(T);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,f=a+t.nquad_flat*c;for(b=a;b<f;b+=c)o(b);return f-a})(W);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,f=a+t.nquad_smooth*c;for(b=a;b<f;b+=c)x(b);return f-a})(X);
|
|
|
-this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))},v:function(a,c,b,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,f)))},f3:function(a,c,b,f,g){a.faces.push(new THREE.Face3(c,b,f,null,null,a.materials[g]))},f4:function(a,c,b,f,g,h){a.faces.push(new THREE.Face4(c,b,f,g,null,null,a.materials[h]))},f3n:function(a,c,b,f,g,h,e,j,k){var h=a.materials[h],l=c[j*
|
|
|
-3],m=c[j*3+1],j=c[j*3+2],n=c[k*3],p=c[k*3+1],k=c[k*3+2];a.faces.push(new THREE.Face3(b,f,g,[new THREE.Vector3(c[e*3],c[e*3+1],c[e*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,p,k)],null,h))},f4n:function(a,c,b,f,g,h,e,j,k,l,m){var e=a.materials[e],n=c[k*3],p=c[k*3+1],k=c[k*3+2],o=c[l*3],x=c[l*3+1],l=c[l*3+2],w=c[m*3],u=c[m*3+1],m=c[m*3+2];a.faces.push(new THREE.Face4(b,f,g,h,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(o,x,l),new THREE.Vector3(w,u,
|
|
|
-m)],null,e))},uv3:function(a,c,b,f,g,h,e){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(f,g));j.push(new THREE.UV(h,e));a.push(j)},uv4:function(a,c,b,f,g,h,e,j,k){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,e));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,c){var b=this,f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(a){function f(a,b){return b=="relativeToHTML"?a:g+"/"+a}function j(){for(o in E.objects)if(!C.objects[o])if(y=E.objects[o],y.geometry!==void 0){if(G=C.geometries[y.geometry]){var a=!1;J=[];for(M=0;M<y.materials.length;M++)J[M]=C.materials[y.materials[M]],a=J[M]instanceof THREE.MeshShaderMaterial;a&&G.computeTangents();t=y.position;r=y.rotation;
|
|
|
+4+t.material_index_bytes;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;C=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;M=t.uv_index_bytes;N=t.uv_index_bytes*2;R=t.uv_index_bytes;Y=t.uv_index_bytes*2;Z=t.uv_index_bytes*3;c=t.vertex_index_bytes*3+t.material_index_bytes;S=t.vertex_index_bytes*4+t.material_index_bytes;T=t.ntri_flat*c;U=t.ntri_smooth*(c+t.normal_index_bytes*3);V=t.ntri_flat_uv*
|
|
|
+(c+t.uv_index_bytes*3);W=t.ntri_smooth_uv*(c+t.normal_index_bytes*3+t.uv_index_bytes*3);X=t.nquad_flat*S;c=t.nquad_smooth*(S+t.normal_index_bytes*4);S=t.nquad_flat_uv*(S+t.uv_index_bytes*4);y+=function(c){for(var f,g,h,j=t.vertex_coordinate_bytes*3,k=c+t.nvertices*j;c<k;c+=j)f=b(a,c),g=b(a,c+t.vertex_coordinate_bytes),h=b(a,c+t.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(v,f,g,h);return t.nvertices*j}(y);y+=function(c){for(var b,f,e,g=t.normal_coordinate_bytes*3,h=c+t.nnormals*g;c<h;c+=
|
|
|
+g)b=l(a,c),f=l(a,c+t.normal_coordinate_bytes),e=l(a,c+t.normal_coordinate_bytes*2),A.push(b/127,f/127,e/127);return t.nnormals*g}(y);y+=function(c){for(var f,g,h=t.uv_coordinate_bytes*2,j=c+t.nuvs*h;c<j;c+=h)f=b(a,c),g=b(a,c+t.uv_coordinate_bytes),B.push(f,g);return t.nuvs*h}(y);T=y+T;U=T+U;V=U+V;W=V+W;X=W+X;c=X+c;S=c+S;(function(a){var c,b=t.vertex_index_bytes*3+t.material_index_bytes,f=b+t.uv_index_bytes*3,e=a+t.ntri_flat_uv*f;for(c=a;c<e;c+=f)n(c),w(c+b);return e-a})(U);(function(a){var c,b=t.vertex_index_bytes*
|
|
|
+3+t.material_index_bytes+t.normal_index_bytes*3,f=b+t.uv_index_bytes*3,e=a+t.ntri_smooth_uv*f;for(c=a;c<e;c+=f)p(c),w(c+b);return e-a})(V);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes,f=b+t.uv_index_bytes*4,e=a+t.nquad_flat_uv*f;for(c=a;c<e;c+=f)o(c),u(c+b);return e-a})(c);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,f=b+t.uv_index_bytes*4,e=a+t.nquad_smooth_uv*f;for(c=a;c<e;c+=f)x(c),u(c+b);return e-a})(S);(function(a){var c,b=t.vertex_index_bytes*
|
|
|
+3+t.material_index_bytes,f=a+t.ntri_flat*b;for(c=a;c<f;c+=b)n(c);return f-a})(y);(function(a){var c,b=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,f=a+t.ntri_smooth*b;for(c=a;c<f;c+=b)p(c);return f-a})(T);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes,f=a+t.nquad_flat*b;for(c=a;c<f;c+=b)o(c);return f-a})(W);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,f=a+t.nquad_smooth*b;for(c=a;c<f;c+=b)x(c);return f-a})(X);
|
|
|
+this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))},v:function(a,b,c,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,f)))},f3:function(a,b,c,f,g){a.faces.push(new THREE.Face3(b,c,f,null,null,a.materials[g]))},f4:function(a,b,c,f,g,h){a.faces.push(new THREE.Face4(b,c,f,g,null,null,a.materials[h]))},f3n:function(a,b,c,f,g,h,e,j,k){var h=a.materials[h],l=b[j*
|
|
|
+3],m=b[j*3+1],j=b[j*3+2],n=b[k*3],p=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(b[e*3],b[e*3+1],b[e*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,p,k)],null,h))},f4n:function(a,b,c,f,g,h,e,j,k,l,m){var e=a.materials[e],n=b[k*3],p=b[k*3+1],k=b[k*3+2],o=b[l*3],x=b[l*3+1],l=b[l*3+2],w=b[m*3],u=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(o,x,l),new THREE.Vector3(w,u,
|
|
|
+m)],null,e))},uv3:function(a,b,c,f,g,h,e){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(f,g));j.push(new THREE.UV(h,e));a.push(j)},uv4:function(a,b,c,f,g,h,e,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,e));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,f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(a){function f(a,c){return c=="relativeToHTML"?a:g+"/"+a}function j(){for(o in E.objects)if(!C.objects[o])if(y=E.objects[o],y.geometry!==void 0){if(G=C.geometries[y.geometry]){var a=!1;J=[];for(M=0;M<y.materials.length;M++)J[M]=C.materials[y.materials[M]],a=J[M]instanceof THREE.MeshShaderMaterial;a&&G.computeTangents();t=y.position;r=y.rotation;
|
|
|
q=y.quaternion;s=y.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);J.length>1&&(J=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,J);object.name=o;object.position.set(t[0],t[1],t[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=y.visible;C.scene.addObject(object);C.objects[o]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
|
|
|
if(y.castsShadow)a=new THREE.ShadowVolume(G),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}}else t=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(t[0],t[1],t[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=y.visible!==void 0?y.visible:!1,C.scene.addObject(object),C.objects[o]=object,C.empties[o]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}function k(a){return function(c){C.geometries[a]=c;j();H-=1;b.onLoadComplete();m()}}function l(a){return function(b){C.geometries[a]=b}}function m(){b.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-H,loadedTextures:Q-I},C);b.onLoadProgress();H==0&&I==0&&c(C)}var n,
|
|
|
+s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,C.scene.addObject(object),C.objects[o]=object,C.empties[o]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}function k(a){return function(b){C.geometries[a]=b;j();H-=1;c.onLoadComplete();m()}}function l(a){return function(c){C.geometries[a]=c}}function m(){c.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-H,loadedTextures:Q-I},C);c.onLoadProgress();H==0&&I==0&&b(C)}var n,
|
|
|
p,o,x,w,u,v,y,t,A,B,G,F,z,D,J,K,E,L,H,I,O,Q,C;E=a.data;D=new THREE.BinaryLoader;L=new THREE.JSONLoader;I=H=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in E.objects)if(y=E.objects[o],y.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(E.transform){a=E.transform.position;A=E.transform.rotation;var P=E.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);A&&C.scene.rotation.set(A[0],
|
|
|
-A[1],A[2]);P&&C.scene.scale.set(P[0],P[1],P[2]);(a||A||P)&&C.scene.updateMatrix()}a=function(){I-=1;m();b.onLoadComplete()};for(w in E.cameras){A=E.cameras[w];if(A.type=="perspective")F=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);t=A.position;A=A.target;F.position.set(t[0],t[1],t[2]);F.target.position.set(A[0],A[1],A[2]);C.cameras[w]=F}for(x in E.lights)w=E.lights[x],
|
|
|
+A[1],A[2]);P&&C.scene.scale.set(P[0],P[1],P[2]);(a||A||P)&&C.scene.updateMatrix()}a=function(){I-=1;m();c.onLoadComplete()};for(w in E.cameras){A=E.cameras[w];if(A.type=="perspective")F=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);t=A.position;A=A.target;F.position.set(t[0],t[1],t[2]);F.target.position.set(A[0],A[1],A[2]);C.cameras[w]=F}for(x in E.lights)w=E.lights[x],
|
|
|
F=w.color!==void 0?w.color:16777215,A=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(t=w.direction,K=new THREE.DirectionalLight(F,A),K.position.set(t[0],t[1],t[2]),K.position.normalize()):w.type=="point"?(t=w.position,d=w.distance,K=new THREE.PointLight(F,A,d),K.position.set(t[0],t[1],t[2])):w.type=="ambient"&&(K=new THREE.AmbientLight(F)),C.scene.addLight(K),C.lights[x]=K;for(u in E.fogs)x=E.fogs[u],x.type=="linear"?z=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(z=new THREE.FogExp2(0,
|
|
|
-x.density)),A=x.color,z.color.setRGB(A[0],A[1],A[2]),C.fogs[u]=z;if(C.cameras&&E.defaults.camera)C.currentCamera=C.cameras[E.defaults.camera];if(C.fogs&&E.defaults.fog)C.scene.fog=C.fogs[E.defaults.fog];A=E.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(A[0],A[1],A[2]);C.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(u=E.geometries[n],u.type=="bin_mesh"||u.type=="ascii_mesh")H+=1,b.onLoadStart();O=H;for(n in E.geometries)u=E.geometries[n],u.type=="cube"?(G=new THREE.CubeGeometry(u.width,
|
|
|
+x.density)),A=x.color,z.color.setRGB(A[0],A[1],A[2]),C.fogs[u]=z;if(C.cameras&&E.defaults.camera)C.currentCamera=C.cameras[E.defaults.camera];if(C.fogs&&E.defaults.fog)C.scene.fog=C.fogs[E.defaults.fog];A=E.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(A[0],A[1],A[2]);C.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(u=E.geometries[n],u.type=="bin_mesh"||u.type=="ascii_mesh")H+=1,c.onLoadStart();O=H;for(n in E.geometries)u=E.geometries[n],u.type=="cube"?(G=new THREE.CubeGeometry(u.width,
|
|
|
u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),C.geometries[n]=G):u.type=="plane"?(G=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),C.geometries[n]=G):u.type=="sphere"?(G=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),C.geometries[n]=G):u.type=="cylinder"?(G=new THREE.CylinderGeometry(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),C.geometries[n]=G):u.type=="torus"?(G=new THREE.TorusGeometry(u.radius,
|
|
|
-u.tube,u.segmentsR,u.segmentsT),C.geometries[n]=G):u.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(u.subdivisions),C.geometries[n]=G):u.type=="bin_mesh"?D.load({model:f(u.url,E.urlBaseType),callback:k(n)}):u.type=="ascii_mesh"?L.load({model:f(u.url,E.urlBaseType),callback:k(n)}):u.type=="embedded_mesh"&&(u=E.embeds[u.id])&&L.createModel(u,l(n),"");for(v in E.textures)if(n=E.textures[v],n.url instanceof Array){I+=n.url.length;for(D=0;D<n.url.length;D++)b.onLoadStart()}else I+=1,b.onLoadStart();
|
|
|
+u.tube,u.segmentsR,u.segmentsT),C.geometries[n]=G):u.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(u.subdivisions),C.geometries[n]=G):u.type=="bin_mesh"?D.load({model:f(u.url,E.urlBaseType),callback:k(n)}):u.type=="ascii_mesh"?L.load({model:f(u.url,E.urlBaseType),callback:k(n)}):u.type=="embedded_mesh"&&(u=E.embeds[u.id])&&L.createModel(u,l(n),"");for(v in E.textures)if(n=E.textures[v],n.url instanceof Array){I+=n.url.length;for(D=0;D<n.url.length;D++)c.onLoadStart()}else I+=1,c.onLoadStart();
|
|
|
Q=I;for(v in E.textures){n=E.textures[v];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){D=[];for(var M=0;M<n.url.length;M++)D[M]=f(n.url[M],E.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,n.mapping,a)}else{D=THREE.ImageUtils.loadTexture(f(n.url,E.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)D.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)D.magFilter=THREE[n.magFilter];if(n.repeat){D.repeat.set(n.repeat[0],n.repeat[1]);
|
|
|
if(n.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}n.offset&&D.offset.set(n.offset[0],n.offset[1]);if(n.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[n.wrap[0]]!==void 0)D.wrapS=L[n.wrap[0]];if(L[n.wrap[1]]!==void 0)D.wrapT=L[n.wrap[1]]}}C.textures[v]=D}for(p in E.materials){v=E.materials[p];for(B in v.parameters)if(B=="envMap"||B=="map"||B=="lightMap")v.parameters[B]=C.textures[v.parameters[B]];else if(B=="shading")v.parameters[B]=
|
|
|
v.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")v.parameters[B]=THREE[v.parameters[B]]?THREE[v.parameters[B]]:THREE.NormalBlending;else if(B=="combine")v.parameters[B]=v.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(v.parameters[B]=="face")v.parameters[B]=THREE.FaceColors;else if(v.parameters[B])v.parameters[B]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=
|
|
|
!0;if(v.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);D=v.parameters.color;L=v.parameters.specular;u=v.parameters.ambient;z=v.parameters.shininess;a.tNormal.texture=C.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=
|
|
|
-C.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(u);a.uShininess.value=z;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;v=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);C.materials[p]=v}j();b.callbackSync(C)}}};
|
|
|
-THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];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,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;c[h]=j+e*this.delta;c[h+1]=k;c[h+2]=l;g[h]=this.lerp(m[a],m[a+3],e);g[h+1]=this.lerp(m[a+1],m[a+4],e);g[h+2]=this.lerp(m[a+2],m[a+5],e)};this.VIntY=function(a,c,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;c[h]=j;c[h+1]=k+e*this.delta;c[h+
|
|
|
-2]=l;c=a+this.yd*3;g[h]=this.lerp(m[a],m[c],e);g[h+1]=this.lerp(m[a+1],m[c+1],e);g[h+2]=this.lerp(m[a+2],m[c+2],e)};this.VIntZ=function(a,c,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;c[h]=j;c[h+1]=k;c[h+2]=l+e*this.delta;c=a+this.zd*3;g[h]=this.lerp(m[a],m[c],e);g[h+1]=this.lerp(m[a+1],m[c+1],e);g[h+2]=this.lerp(m[a+2],m[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
|
|
|
-this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,e,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,p=k+this.zd,o=h+this.yd+this.zd,x=k+this.yd+this.zd,w=0,u=this.field[h],v=this.field[k],y=this.field[l],t=this.field[n],A=this.field[m],B=this.field[p],G=this.field[o],F=this.field[x];u<e&&(w|=1);v<e&&(w|=2);y<e&&(w|=8);t<e&&(w|=4);A<e&&(w|=16);B<e&&(w|=32);G<e&&(w|=128);F<e&&(w|=64);var z=THREE.edgeTable[w];if(z==0)return 0;var D=this.delta,
|
|
|
-J=a+D,K=c+D,D=g+D;z&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,e,a,c,g,u,v));z&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,e,J,c,g,v,t));z&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,e,a,K,g,y,t));z&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,e,a,c,g,u,y));z&16&&(this.compNorm(m),this.compNorm(p),this.VIntX(m*3,this.vlist,this.nlist,12,e,a,c,D,A,B));z&32&&(this.compNorm(p),
|
|
|
-this.compNorm(x),this.VIntY(p*3,this.vlist,this.nlist,15,e,J,c,D,B,F));z&64&&(this.compNorm(o),this.compNorm(x),this.VIntX(o*3,this.vlist,this.nlist,18,e,a,K,D,G,F));z&128&&(this.compNorm(m),this.compNorm(o),this.VIntY(m*3,this.vlist,this.nlist,21,e,a,c,D,A,G));z&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,e,a,c,g,u,A));z&512&&(this.compNorm(k),this.compNorm(p),this.VIntZ(k*3,this.vlist,this.nlist,27,e,J,c,g,v,B));z&1024&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*
|
|
|
-3,this.vlist,this.nlist,30,e,J,K,g,t,F));z&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(l*3,this.vlist,this.nlist,33,e,a,K,g,y,G));w<<=4;for(e=h=0;THREE.triTable[w+e]!=-1;)a=w+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],j),e+=3,h++;return h};this.posnormtriv=function(a,c,g,h,e,j){var k=this.count*3;this.positionArray[k]=a[g];this.positionArray[k+1]=a[g+1];this.positionArray[k+2]=a[g+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[e];this.positionArray[k+7]=a[e+1];this.positionArray[k+8]=a[e+2];this.normalArray[k]=c[g];this.normalArray[k+1]=c[g+1];this.normalArray[k+2]=c[g+2];this.normalArray[k+3]=c[h];this.normalArray[k+4]=c[h+1];this.normalArray[k+5]=c[h+2];this.normalArray[k+6]=c[e];this.normalArray[k+7]=c[e+1];this.normalArray[k+8]=c[e+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 c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,e){var j=this.size*Math.sqrt(h/e),k=g*this.size,l=c*this.size,m=a*this.size,n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var p=Math.floor(l-j);p<1&&(p=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var o=Math.floor(m-j);o<1&&(o=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
|
|
|
-1);for(var x,w,u,v,y,t;n<k;n++){m=this.size2*n;w=n/this.size-g;y=w*w;for(w=p;w<l;w++){u=m+this.size*w;x=w/this.size-c;t=x*x;for(x=o;x<j;x++)v=x/this.size-a,v=h/(1.0E-6+v*v+t+y)-e,v>0&&(this.field[u+x]+=v)}}};this.addPlaneX=function(a,c){var g,h,e,j,k,l=this.size,m=this.yd,n=this.zd,p=this.field,o=l*Math.sqrt(a/c);o>l&&(o=l);for(g=0;g<o;g++)if(h=g/l,h*=h,j=a/(1.0E-4+h)-c,j>0)for(h=0;h<l;h++){k=g+h*m;for(e=0;e<l;e++)p[n*e+k]+=j}};this.addPlaneY=function(a,c){var g,h,e,j,k,l,m=this.size,n=this.yd,p=
|
|
|
-this.zd,o=this.field,x=m*Math.sqrt(a/c);x>m&&(x=m);for(h=0;h<x;h++)if(g=h/m,g*=g,j=a/(1.0E-4+g)-c,j>0){k=h*n;for(g=0;g<m;g++){l=k+g;for(e=0;e<m;e++)o[p*e+l]+=j}}};this.addPlaneZ=function(a,c){var g,h,e,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(e=0;e<dist;e++)if(g=e/size,g*=g,j=a/(1.0E-4+g)-c,j>0){k=zd*e;for(h=0;h<size;h++){l=k+h*yd;for(g=0;g<size;g++)field[l+g]+=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 c,g,h,e,j,k,l,m,n,p=this.size-2;for(e=1;e<p;e++){n=this.size2*e;l=(e-this.halfsize)/this.halfsize;for(h=1;h<p;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(g=1;g<p;g++)j=(g-this.halfsize)/this.halfsize,c=m+g,this.polygonize(j,k,l,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var e,j,k,l,m,n,p,o;for(e=0;e<h.count;e++)p=e*3,m=p+1,o=p+2,j=h.positionArray[p],
|
|
|
-k=h.positionArray[m],l=h.positionArray[o],n=new THREE.Vector3(j,k,l),j=h.normalArray[p],k=h.normalArray[m],l=h.normalArray[o],p=new THREE.Vector3(j,k,l),p.normalize(),m=new THREE.Vertex(n),c.vertices.push(m),g.push(p);nfaces=h.count/3;for(e=0;e<nfaces;e++)p=(a+e)*3,m=p+1,o=p+2,n=g[p],j=g[m],k=g[o],p=new THREE.Face3(p,m,o,[n,j,k]),c.faces.push(p);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+C.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(u);a.uShininess.value=z;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;v=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);C.materials[p]=v}j();c.callbackSync(C)}}};
|
|
|
+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,g){return a+(b-a)*g};this.VIntX=function(a,b,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;b[h]=j+e*this.delta;b[h+1]=k;b[h+2]=l;g[h]=this.lerp(m[a],m[a+3],e);g[h+1]=this.lerp(m[a+1],m[a+4],e);g[h+2]=this.lerp(m[a+2],m[a+5],e)};this.VIntY=function(a,b,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k+e*this.delta;b[h+
|
|
|
+2]=l;b=a+this.yd*3;g[h]=this.lerp(m[a],m[b],e);g[h+1]=this.lerp(m[a+1],m[b+1],e);g[h+2]=this.lerp(m[a+2],m[b+2],e)};this.VIntZ=function(a,b,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+e*this.delta;b=a+this.zd*3;g[h]=this.lerp(m[a],m[b],e);g[h+1]=this.lerp(m[a+1],m[b+1],e);g[h+2]=this.lerp(m[a+2],m[b+2],e)};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,g,h,e,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,p=k+this.zd,o=h+this.yd+this.zd,x=k+this.yd+this.zd,w=0,u=this.field[h],v=this.field[k],y=this.field[l],t=this.field[n],A=this.field[m],B=this.field[p],G=this.field[o],F=this.field[x];u<e&&(w|=1);v<e&&(w|=2);y<e&&(w|=8);t<e&&(w|=4);A<e&&(w|=16);B<e&&(w|=32);G<e&&(w|=128);F<e&&(w|=64);var z=THREE.edgeTable[w];if(z==0)return 0;var D=this.delta,
|
|
|
+J=a+D,K=b+D,D=g+D;z&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,e,a,b,g,u,v));z&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,e,J,b,g,v,t));z&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,e,a,K,g,y,t));z&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,e,a,b,g,u,y));z&16&&(this.compNorm(m),this.compNorm(p),this.VIntX(m*3,this.vlist,this.nlist,12,e,a,b,D,A,B));z&32&&(this.compNorm(p),
|
|
|
+this.compNorm(x),this.VIntY(p*3,this.vlist,this.nlist,15,e,J,b,D,B,F));z&64&&(this.compNorm(o),this.compNorm(x),this.VIntX(o*3,this.vlist,this.nlist,18,e,a,K,D,G,F));z&128&&(this.compNorm(m),this.compNorm(o),this.VIntY(m*3,this.vlist,this.nlist,21,e,a,b,D,A,G));z&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,e,a,b,g,u,A));z&512&&(this.compNorm(k),this.compNorm(p),this.VIntZ(k*3,this.vlist,this.nlist,27,e,J,b,g,v,B));z&1024&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*
|
|
|
+3,this.vlist,this.nlist,30,e,J,K,g,t,F));z&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(l*3,this.vlist,this.nlist,33,e,a,K,g,y,G));w<<=4;for(e=h=0;THREE.triTable[w+e]!=-1;)a=w+e,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],j),e+=3,h++;return h};this.posnormtriv=function(a,b,g,h,e,j){var k=this.count*3;this.positionArray[k]=a[g];this.positionArray[k+1]=a[g+1];this.positionArray[k+2]=a[g+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[e];this.positionArray[k+7]=a[e+1];this.positionArray[k+8]=a[e+2];this.normalArray[k]=b[g];this.normalArray[k+1]=b[g+1];this.normalArray[k+2]=b[g+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[e];this.normalArray[k+7]=b[e+1];this.normalArray[k+8]=b[e+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,g,h,e){var j=this.size*Math.sqrt(h/e),k=g*this.size,l=b*this.size,m=a*this.size,n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var p=Math.floor(l-j);p<1&&(p=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var o=Math.floor(m-j);o<1&&(o=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
|
|
|
+1);for(var x,w,u,v,y,t;n<k;n++){m=this.size2*n;w=n/this.size-g;y=w*w;for(w=p;w<l;w++){u=m+this.size*w;x=w/this.size-b;t=x*x;for(x=o;x<j;x++)v=x/this.size-a,v=h/(1.0E-6+v*v+t+y)-e,v>0&&(this.field[u+x]+=v)}}};this.addPlaneX=function(a,b){var g,h,e,j,k,l=this.size,m=this.yd,n=this.zd,p=this.field,o=l*Math.sqrt(a/b);o>l&&(o=l);for(g=0;g<o;g++)if(h=g/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=g+h*m;for(e=0;e<l;e++)p[n*e+k]+=j}};this.addPlaneY=function(a,b){var g,h,e,j,k,l,m=this.size,n=this.yd,p=
|
|
|
+this.zd,o=this.field,x=m*Math.sqrt(a/b);x>m&&(x=m);for(h=0;h<x;h++)if(g=h/m,g*=g,j=a/(1.0E-4+g)-b,j>0){k=h*n;for(g=0;g<m;g++){l=k+g;for(e=0;e<m;e++)o[p*e+l]+=j}}};this.addPlaneZ=function(a,b){var g,h,e,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(e=0;e<dist;e++)if(g=e/size,g*=g,j=a/(1.0E-4+g)-b,j>0){k=zd*e;for(h=0;h<size;h++){l=k+h*yd;for(g=0;g<size;g++)field[l+g]+=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,g,h,e,j,k,l,m,n,p=this.size-2;for(e=1;e<p;e++){n=this.size2*e;l=(e-this.halfsize)/this.halfsize;for(h=1;h<p;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(g=1;g<p;g++)j=(g-this.halfsize)/this.halfsize,b=m+g,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,g=[];this.render(function(h){var e,j,k,l,m,n,p,o;for(e=0;e<h.count;e++)p=e*3,m=p+1,o=p+2,j=h.positionArray[p],
|
|
|
+k=h.positionArray[m],l=h.positionArray[o],n=new THREE.Vector3(j,k,l),j=h.normalArray[p],k=h.normalArray[m],l=h.normalArray[o],p=new THREE.Vector3(j,k,l),p.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),g.push(p);nfaces=h.count/3;for(e=0;e<nfaces;e++)p=(a+e)*3,m=p+1,o=p+2,n=g[p],j=g[m],k=g[o],p=new THREE.Face3(p,m,o,[n,j,k]),b.faces.push(p);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]);
|
|
@@ -238,27 +238,27 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
|
4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
|
|
|
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
|
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
|
|
|
-THREE.Trident=function(a){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:c}))}function b(a,c){var b=new THREE.Geometry;b.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(b,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,g,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)a.hasOwnProperty(g)||(a[g]=THREE.Trident.defaultParams[g]);
|
|
|
-this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(b(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(b(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(b(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)g=c(a.xAxisColor),g.rotation.y=-f,g.position.x=a.length,this.addChild(g),g=c(a.yAxisColor),g.rotation.x=f,g.position.y=a.length,this.addChild(g),g=c(a.zAxisColor),g.rotation.y=Math.PI,g.position.z=a.length,this.addChild(g)};
|
|
|
-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,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
|
|
|
-THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;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 c,b,f,g,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],f=this.rayCast(a,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
|
|
|
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var f=this.rayMesh(a,c[b]);if(f.dist<Number.MAX_VALUE){c[b].distance=f.dist;c[b].faceIndex=f.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
|
-THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var e=c.mesh.geometry.faces[h],j=c.mesh.geometry.vertices[e.a].position,k=c.mesh.geometry.vertices[e.b].position,l=c.mesh.geometry.vertices[e.c].position,m=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,j,k,l,f,this.collisionNormal,c.mesh),e<f&&(f=e,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-e instanceof THREE.Face4&&(e=this.rayTriangle(b,j,k,m,f,this.collisionNormal,c.mesh),e<f&&(f=e,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,k,l,m,f,this.collisionNormal,c.mesh),e<f&&(f=e,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,f,g,h,e){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(b,c);k.sub(f,b);h.cross(j,k);j=h.dot(a.direction);if(!(j<0))if(e.doubleSided||e.flipSided)h.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;e=h.dot(c)-h.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=j*g))return Number.MAX_VALUE;e/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(e);j.addSelf(a.origin);Math.abs(h.x)>
|
|
|
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=j.y-c.y,h=b.y-c.y,g=f.y-c.y,j=j.z-c.z,b=b.z-c.z,f=f.z-c.z):(a=j.x-c.x,h=b.x-c.x,g=f.x-c.x,j=j.y-c.y,b=b.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-c.x,h=b.x-c.x,g=f.x-c.x,j=j.z-c.z,b=b.z-c.z,f=f.z-c.z):(a=j.x-c.x,h=b.x-c.x,g=f.x-c.x,j=j.y-c.y,b=b.y-c.y,f=f.y-c.y);c=h*f-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(a*f-j*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*j-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return e};
|
|
|
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var f=THREE.CollisionSystem.__r;f.origin.copy(a.origin);f.direction.copy(a.direction);b.multiplyVector3(f.origin);b.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var f=0,g=0,h=0,e=0,j=0,k=0,l=!0;b.origin.x<c.min.x?(f=c.min.x-b.origin.x,f/=b.direction.x,l=!1,e=-1):b.origin.x>c.max.x&&(f=c.max.x-b.origin.x,f/=b.direction.x,l=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,l=!1,j=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
|
|
|
-l=!1,j=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,l=!1,k=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,l=!1,k=1);if(l)return-1;l=0;g>f&&(l=1,f=g);h>f&&(l=2,f=h);switch(l){case 0:j=b.origin.y+b.direction.y*f;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*f;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*f;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
-f;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,j,0);break;case 2:e=b.origin.x+b.direction.x*f;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;j=b.origin.y+b.direction.y*f;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,k)}return f};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),f=c.point.dot(c.normal);if(b<0)b=(f-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
|
-THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var f=b.dot(a.direction.clone());if(f<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-f*f);if(b>=0)return Math.abs(f)-Math.sqrt(b);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 c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
|
+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 f=Math.PI/2,g,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)a.hasOwnProperty(g)||(a[g]=THREE.Trident.defaultParams[g]);
|
|
|
+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)g=b(a.xAxisColor),g.rotation.y=-f,g.position.x=a.length,this.addChild(g),g=b(a.yAxisColor),g.rotation.x=f,g.position.y=a.length,this.addChild(g),g=b(a.zAxisColor),g.rotation.y=Math.PI,g.position.z=a.length,this.addChild(g)};
|
|
|
+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,f,g,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(g=this.colliders[b],f=this.rayCast(a,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;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 f=this.rayMesh(a,b[c]);if(f.dist<Number.MAX_VALUE){b[c].distance=f.dist;b[c].faceIndex=f.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),f=Number.MAX_VALUE,g,h=0;h<b.numFaces;h++){var e=b.mesh.geometry.faces[h],j=b.mesh.geometry.vertices[e.a].position,k=b.mesh.geometry.vertices[e.b].position,l=b.mesh.geometry.vertices[e.c].position,m=e instanceof THREE.Face4?b.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(c,j,k,l,f,this.collisionNormal,b.mesh),e<f&&(f=e,g=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
|
|
|
+e instanceof THREE.Face4&&(e=this.rayTriangle(c,j,k,m,f,this.collisionNormal,b.mesh),e<f&&(f=e,g=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),e=this.rayTriangle(c,k,l,m,f,this.collisionNormal,b.mesh),e<f&&(f=e,g=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,f,g,h,e){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(c,b);k.sub(f,c);h.cross(j,k);j=h.dot(a.direction);if(!(j<0))if(e.doubleSided||e.flipSided)h.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;e=h.dot(b)-h.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=j*g))return Number.MAX_VALUE;e/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(e);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,g=f.y-b.y,j=j.z-b.z,c=c.z-b.z,f=f.z-b.z):(a=j.x-b.x,h=c.x-b.x,g=f.x-b.x,j=j.y-b.y,c=c.y-b.y,f=f.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-b.x,h=c.x-b.x,g=f.x-b.x,j=j.z-b.z,c=c.z-b.z,f=f.z-b.z):(a=j.x-b.x,h=c.x-b.x,g=f.x-b.x,j=j.y-b.y,c=c.y-b.y,f=f.y-b.y);b=h*f-c*g;if(b==0)return Number.MAX_VALUE;b=1/b;f=(a*f-j*g)*b;if(!(f>=0))return Number.MAX_VALUE;b*=h*j-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-f-b>=0))return Number.MAX_VALUE;return e};
|
|
|
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var f=THREE.CollisionSystem.__r;f.origin.copy(a.origin);f.direction.copy(a.direction);c.multiplyVector3(f.origin);c.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
|
+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 f=0,g=0,h=0,e=0,j=0,k=0,l=!0;c.origin.x<b.min.x?(f=b.min.x-c.origin.x,f/=c.direction.x,l=!1,e=-1):c.origin.x>b.max.x&&(f=b.max.x-c.origin.x,f/=c.direction.x,l=!1,e=1);c.origin.y<b.min.y?(g=b.min.y-c.origin.y,g/=c.direction.y,l=!1,j=-1):c.origin.y>b.max.y&&(g=b.max.y-c.origin.y,g/=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;g>f&&(l=1,f=g);h>f&&(l=2,f=h);switch(l){case 0:j=c.origin.y+c.direction.y*f;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(e,0,0);break;case 1:e=c.origin.x+c.direction.x*f;if(e<b.min.x||e>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
|
|
|
+f;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,j,0);break;case 2:e=c.origin.x+c.direction.x*f;if(e<b.min.x||e>b.max.x)return Number.MAX_VALUE;j=c.origin.y+c.direction.y*f;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,k)}return f};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),f=b.point.dot(b.normal);if(c<0)c=(f-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 f=c.dot(a.direction.clone());if(f<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-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 c=this,b=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,e=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.Camera(53,1,1,1E4);o.position.z=
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,e=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.Camera(53,1,1,1E4);o.position.z=
|
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:p}},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 x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);n.width=a;n.height=e;p.width=a;p.height=e};this.render=function(a,b){b.update(null,!0);if(k!==b.aspect||l!==b.near||m!==b.fov){k=b.aspect;l=b.near;m=b.fov;var v=b.projectionMatrix.clone(),y=125/30*0.5,t=y*l/125,A=l*Math.tan(m*Math.PI/360),B;e.n14=y;j.n14=-y;y=-A*k+t;B=A*k+t;v.n11=2*l/(B-y);v.n13=(B+y)/(B-y);g.projectionMatrix=v.clone();y=-A*k-t;B=A*k-t;v.n11=2*l/(B-y);
|
|
|
-v.n13=(B+y)/(B-y);h.projectionMatrix=v.clone()}g.matrix=b.matrixWorld.clone().multiplySelf(j);g.update(null,!0);g.position.copy(b.position);g.near=l;g.far=b.far;f.call(c,a,g,n,!0);h.matrix=b.matrixWorld.clone().multiplySelf(e);h.update(null,!0);h.position.copy(b.position);h.near=l;h.far=b.far;f.call(c,a,h,p,!0);f.call(c,x,o)}};
|
|
|
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,f=this.render,g,h,e=new THREE.Camera,j=new THREE.Camera;c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=b.far;
|
|
|
-e.updateProjectionMatrix();e.position.copy(b.position);e.target.position.copy(b.target.position);e.translateX(c.separation);j.projectionMatrix=e.projectionMatrix;j.position.copy(b.position);j.target.position.copy(b.target.position);j.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,a,e);this.setViewport(g,0,g,h);f.call(c,a,j,!1)}};
|
|
|
+var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;p.width=a;p.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 v=c.projectionMatrix.clone(),y=125/30*0.5,t=y*l/125,A=l*Math.tan(m*Math.PI/360),B;e.n14=y;j.n14=-y;y=-A*k+t;B=A*k+t;v.n11=2*l/(B-y);v.n13=(B+y)/(B-y);g.projectionMatrix=v.clone();y=-A*k-t;B=A*k-t;v.n11=2*l/(B-y);
|
|
|
+v.n13=(B+y)/(B-y);h.projectionMatrix=v.clone()}g.matrix=c.matrixWorld.clone().multiplySelf(j);g.update(null,!0);g.position.copy(c.position);g.near=l;g.far=c.far;f.call(b,a,g,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(e);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;f.call(b,a,h,p,!0);f.call(b,x,o)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,f=this.render,g,h,e=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,e){c.call(b,a,e);g=a/2;h=e};this.render=function(a,c){this.clear();e.fov=c.fov;e.aspect=0.5*c.aspect;e.near=c.near;e.far=c.far;
|
|
|
+e.updateProjectionMatrix();e.position.copy(c.position);e.target.position.copy(c.target.position);e.translateX(b.separation);j.projectionMatrix=e.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,g,h);f.call(b,a,e);this.setViewport(g,0,g,h);f.call(b,a,j,!1)}};
|