// ThreeExtras.js r39 - http://github.com/mrdoob/three.js var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,e=c?b.geometry:b,f=a.vertices,h=e.vertices,g=a.faces,j=e.faces,l=a.faceVertexUvs[0];e=e.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var k=0,n=h.length;k= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t", value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25&&(f=25);e=(f-1)*0.5;c=Array(f);for(b=d=0;b this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var c=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 d=this.target.position,e=this.position;d.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);d.y=e.y+100*Math.cos(this.phi);d.z=e.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;d=this.target.position;e=this.position;d.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);d.y=e.y+100*Math.cos(this.phi);d.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.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(l,k,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},w,x=k.getControlPointsArray(),u=k.getLength(),B=x.length,z=0;w=B-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:x[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[w]={time:p,pos:x[w],rot:[0,0,0,1],scl:[1,1,1]};for(w=1;w=0?p:p+e;p=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange; this.phi=(this.phi-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,n)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),g=new THREE.Cube(10,10,20),j=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(g,a);a=new THREE.Mesh(j,h);a.position.set(0,10,0);this.animation=b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation= b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; THREE.Cube=function(a,b,c,d,e,f,h,g,j){function l(u,B,z,m,y,C,G,K){var J,I,E=d||1,L=e||1,P=y/2,Q=C/2,R=k.vertices.length;if(u=="x"&&B=="y"||u=="y"&&B=="x")J="z";else if(u=="x"&&B=="z"||u=="z"&&B=="x"){J="y";L=f||1}else if(u=="z"&&B=="y"||u=="y"&&B=="z"){J="x";E=f||1}var M=E+1,F=L+1;y/=E;var N=C/L;for(I=0;I0){h(0,0,-k-(f||0));for(j=a;j0){h(0,0,k+(e||0)); for(j=a+a/2;j<2*a;j++)g.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,g,p)))-1);l.push(k)}b.push(l)}var t,w,x;e=b.length;for(c=0;c0)for(d=0;d1){t=this.vertices[h].position.clone(); w=this.vertices[j].position.clone();x=this.vertices[l].position.clone();t.normalize();w.normalize();x.normalize();this.faces.push(new THREE.Face3(h,j,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)]));this.faceVertexUvs[0].push([k,n,u])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere; THREE.Torus=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var e=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c= 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;e=(this.segmentsT+1)*b+c-1;var f=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,e,f,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus; THREE.TorusKnot=function(a,b,c,d,e,f,h){function g(n,p,t,w,x,u){p=t/w*n;t=Math.cos(p);return new THREE.Vector3(x*(2+t)*0.5*Math.cos(n),x*(2+t)*Math.sin(n)*0.5,u*x*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a>7)-127;A|=(H&127)<<16|D<<8;if(A==0&&V==-127)return 0;return(1-2*(S>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,V)}function g(o,v){var A=k(o,v),D=k(o,v+1),H=k(o,v+2);return(k(o,v+3)<<24)+(H<<16)+(D<<8)+A}function j(o,v){var A=k(o,v);return(k(o,v+1)<<8)+A}function l(o,v){var A=k(o,v);return A>127?A-256:A}function k(o, v){return o.charCodeAt(v)&255}function n(o){var v,A,D;v=g(a,o);A=g(a,o+G);D=g(a,o+K);o=j(a,o+J);THREE.BinaryLoader.prototype.f3(B,v,A,D,o)}function p(o){var v,A,D,H,S,V;v=g(a,o);A=g(a,o+G);D=g(a,o+K);H=j(a,o+J);S=g(a,o+I);V=g(a,o+E);o=g(a,o+L);THREE.BinaryLoader.prototype.f3n(B,y,v,A,D,H,S,V,o)}function t(o){var v,A,D,H;v=g(a,o);A=g(a,o+P);D=g(a,o+Q);H=g(a,o+R);o=j(a,o+M);THREE.BinaryLoader.prototype.f4(B,v,A,D,H,o)}function w(o){var v,A,D,H,S,V,ca,da;v=g(a,o);A=g(a,o+P);D=g(a,o+Q);H=g(a,o+R);S=j(a, o+M);V=g(a,o+F);ca=g(a,o+N);da=g(a,o+O);o=g(a,o+T);THREE.BinaryLoader.prototype.f4n(B,y,v,A,D,H,S,V,ca,da,o)}function x(o){var v,A;v=g(a,o);A=g(a,o+U);o=g(a,o+X);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[o*2],C[o*2+1])}function u(o){var v,A,D;v=g(a,o);A=g(a,o+ea);D=g(a,o+fa);o=g(a,o+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[D*2],C[D*2+1],C[o*2],C[o*2+1])}var B=this,z=0,m,y=[],C=[],G,K,J,I,E,L,P,Q,R,M,F,N,O, T,U,X,ea,fa,ga,Y,Z,$,aa,ba,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,d,f);m={signature:a.substr(z,8),header_bytes:k(a,z+8),vertex_coordinate_bytes:k(a,z+9),normal_coordinate_bytes:k(a,z+10),uv_coordinate_bytes:k(a,z+11),vertex_index_bytes:k(a,z+12),normal_index_bytes:k(a,z+13),uv_index_bytes:k(a,z+14),material_index_bytes:k(a,z+15),nvertices:g(a,z+16),nnormals:g(a,z+16+4),nuvs:g(a,z+16+8),ntri_flat:g(a,z+16+12),ntri_smooth:g(a,z+16+16),ntri_flat_uv:g(a,z+16+20),ntri_smooth_uv:g(a, z+16+24),nquad_flat:g(a,z+16+28),nquad_smooth:g(a,z+16+32),nquad_flat_uv:g(a,z+16+36),nquad_smooth_uv:g(a,z+16+40)};z+=m.header_bytes;G=m.vertex_index_bytes;K=m.vertex_index_bytes*2;J=m.vertex_index_bytes*3;I=m.vertex_index_bytes*3+m.material_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;L=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes;Q=m.vertex_index_bytes*2;R=m.vertex_index_bytes*3;M=m.vertex_index_bytes*4;F=m.vertex_index_bytes* 4+m.material_index_bytes;N=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;O=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;T=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;U=m.uv_index_bytes;X=m.uv_index_bytes*2;ea=m.uv_index_bytes;fa=m.uv_index_bytes*2;ga=m.uv_index_bytes*3;f=m.vertex_index_bytes*3+m.material_index_bytes;W=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*f;Z=m.ntri_smooth*(f+m.normal_index_bytes*3);$=m.ntri_flat_uv* (f+m.uv_index_bytes*3);aa=m.ntri_smooth_uv*(f+m.normal_index_bytes*3+m.uv_index_bytes*3);ba=m.nquad_flat*W;f=m.nquad_smooth*(W+m.normal_index_bytes*4);W=m.nquad_flat_uv*(W+m.uv_index_bytes*4);z+=function(o){for(var v,A,D,H=m.vertex_coordinate_bytes*3,S=o+m.nvertices*H;o=this.maxCount-3&&g(this)};this.begin= function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(j=this.size-1);var p=Math.floor(l-g);p<1&&(p=1);l=Math.floor(l+g);l>this.size-1&&(l=this.size-1);var t=Math.floor(k-g);t<1&&(t=1);g=Math.floor(k+g); g>this.size-1&&(g=this.size-1);for(var w,x,u,B,z,m;n0&&(this.field[u+w]+=B)}}}};this.addPlaneX=function(c,d){var e,f,h,g,j,l=this.size,k=this.yd,n=this.zd,p=this.field,t=l*Math.sqrt(c/d);t>l&&(t=l);for(e=0;e0)for(f=0;fk&&(w=k);for(f=0;f0){j=f*n;for(e=0;esize&&(dist=size);for(h=0;h0){j=zd*h;for(f=0;ff?this.hits.push(e):this.hits.unshift(e);f=d}}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 d=this.rayMesh(a,b[c]);if(db.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),d=Number.MAX_VALUE,e=0;e=g*f))return Number.MAX_VALUE;h/=g;g=THREE.CollisionSystem.__v3;g.copy(a.direction);g.multiplyScalar(h);g.addSelf(a.origin);if(Math.abs(e.x)>Math.abs(e.y))if(Math.abs(e.x)>Math.abs(e.z)){a=g.y-b.y;e=c.y-b.y;f=d.y-b.y; g=g.z-b.z;c=c.z-b.z;d=d.z-b.z}else{a=g.x-b.x;e=c.x-b.x;f=d.x-b.x;g=g.y-b.y;c=c.y-b.y;d=d.y-b.y}else if(Math.abs(e.y)>Math.abs(e.z)){a=g.x-b.x;e=c.x-b.x;f=d.x-b.x;g=g.z-b.z;c=c.z-b.z;d=d.z-b.z}else{a=g.x-b.x;e=c.x-b.x;f=d.x-b.x;g=g.y-b.y;c=c.y-b.y;d=d.y-b.y}b=e*d-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;d=(a*d-g*f)*b;if(!(d>=0))return Number.MAX_VALUE;b*=e*g-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-d-b>=0))return Number.MAX_VALUE;return h}; THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=new THREE.Ray(a.origin.clone(),a.direction.clone()),d=THREE.Matrix4.makeInvert(b.matrixWorld);d.multiplyVector3(c.origin);d.rotateAxis(c.direction);c.direction.normalize();return c}; THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;c=b.dynamic&&b.mesh&&b.mesh.matrixWorld?this.makeRayLocal(a,b.mesh):new THREE.Ray(a.origin.clone(),a.direction.clone());var d=0,e=0,f=0,h=0,g=0,j=0,l=!0;if(c.origin.xb.max.x){d=b.max.x-c.origin.x;d/=c.direction.x;l=!1;h=1}if(c.origin.yb.max.y){e=b.max.y-c.origin.y;e/=c.direction.y;l=!1;g= 1}if(c.origin.zb.max.z){f=b.max.z-c.origin.z;f/=c.direction.z;l=!1;j=1}if(l)return-1;l=0;if(e>d){l=1;d=e}if(f>d){l=2;d=f}switch(l){case 0:g=c.origin.y+c.direction.y*d;if(gb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*d;if(cb.max.z)return Number.MAX_VALUE;b.normal=new THREE.Vector3(h,0,0);break;case 1:h=c.origin.x+c.direction.x*d;if(hb.max.x)return Number.MAX_VALUE;c=c.origin.z+ c.direction.z*d;if(cb.max.z)return Number.MAX_VALUE;b.normal=new THREE.Vector3(0,g,0);break;case 2:h=c.origin.x+c.direction.x*d;if(hb.max.x)return Number.MAX_VALUE;g=c.origin.y+c.direction.y*d;if(gb.max.y)return Number.MAX_VALUE;b.normal=new THREE.Vector3(0,0,j)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),d=b.point.dot(b.normal);if(c<0)c=(d-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=0)return Math.abs(d)-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.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){for(var b=a.geometry.vertices,c=b.length,d=a.geometry.faces,e=d.length,f=[],h=[],g=[],j=0;j