|
@@ -1,8 +1,8 @@
|
|
|
// ThreeExtras.js r44dev - http://github.com/mrdoob/three.js
|
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+b,0,1);f.s=THREE.ColorUtils.clamp(f.s+c,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),g=Math.min(Math.min(c,e),f);if(g==h)g=c=0;else{var j=h-g,g=j/h,c=c==h?(e-f)/j:e==h?2+(f-c)/j:4+(c-e)/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=g;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,e=a.vertices.length,f=c?b.geometry:b,h=a.vertices,g=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=g.length;m<n;m++){var o=new THREE.Vertex(g[m].position.clone());c&&b.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var g=k[m],p,v,t=g.vertexNormals,o=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+e,g.b+e,g.c+
|
|
|
-e):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));p.normal.copy(g.normal);c=0;for(h=t.length;c<h;c++)v=t[c],p.vertexNormals.push(v.clone());p.color.copy(g.color);c=0;for(h=o.length;c<h;c++)v=o[c],p.vertexColors.push(v.clone());p.materials=g.materials.slice();p.centroid.copy(g.centroid);j.push(p)}m=0;for(n=f.length;m<n;m++){e=f[m];j=[];c=0;for(h=e.length;c<h;c++)j.push(new THREE.UV(e[c].u,e[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,
|
|
|
+THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,h=a.vertices,g=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=g.length;m<n;m++){var o=new THREE.Vertex(g[m].position.clone());c&&b.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var g=k[m],p,v,u=g.vertexNormals,o=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+e,g.b+e,g.c+
|
|
|
+e):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));p.normal.copy(g.normal);c=0;for(h=u.length;c<h;c++)v=u[c],p.vertexNormals.push(v.clone());p.color.copy(g.color);c=0;for(h=o.length;c<h;c++)v=o[c],p.vertexColors.push(v.clone());p.materials=g.materials.slice();p.centroid.copy(g.centroid);j.push(p)}m=0;for(n=f.length;m<n;m++){e=f[m];j=[];c=0;for(h=e.length;c<h;c++)j.push(new THREE.UV(e[c].u,e[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,
|
|
|
h=a.faceVertexUvs[0],a=0;for(c=e.length;a<c;a++){var g=new THREE.Vertex(e[a].position.clone());b.vertices.push(g)}a=0;for(c=f.length;a<c;a++){var j=f[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);e=0;for(g=m.length;e<g;e++)l=m[e],k.vertexNormals.push(l.clone());k.color.copy(j.color);e=0;for(g=n.length;e<g;e++)l=n[e],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++){f=h[a];k=[];e=0;for(g=f.length;e<g;e++)k.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(k)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,g=new THREE.Vector3,j=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);j.copy(b);j.multiplyScalar(f);g.addSelf(j);j.copy(c);j.multiplyScalar(h);g.addSelf(j);return g},randomPointInFace:function(a,
|
|
|
b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),g=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(e,
|
|
@@ -10,9 +10,9 @@ f,b),g=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.rando
|
|
|
o=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(m,n,o);else if(e instanceof THREE.Face4)m=g[e.a].position,n=g[e.b].position,o=g[e.c].position,p=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(m,n,p),e._area2=THREE.GeometryUtils.triangleArea(n,o,p),e._area=e._area1+e._area2;k+=e._area;l[f]=k}e=[];g={};for(f=0;f<b;f++)j=THREE.GeometryUtils.random()*k,j=c(j),e[f]=THREE.GeometryUtils.randomPointInFace(h[j],a,!0),g[j]?g[j]+=1:g[j]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;
|
|
|
f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
-a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var j=g.getImageData(0,0,e,f).data,k=g.createImageData(e,f),l=k.data,m=0;m<e;m++)for(var n=1;n<f;n++){var o=n-1<0?f-1:n-1,p=(n+1)%f,v=m-1<0?e-1:m-1,t=(m+1)%e,w=[],y=[0,0,j[(n*e+m)*4]/255*b];w.push([-1,0,j[(n*e+v)*4]/255*b]);w.push([-1,-1,j[(o*e+v)*4]/255*b]);w.push([0,-1,j[(o*e+m)*4]/255*b]);w.push([1,-1,j[(o*e+t)*4]/255*b]);
|
|
|
-w.push([1,0,j[(n*e+t)*4]/255*b]);w.push([1,1,j[(p*e+t)*4]/255*b]);w.push([0,1,j[(p*e+m)*4]/255*b]);w.push([-1,1,j[(p*e+v)*4]/255*b]);o=[];v=w.length;for(p=0;p<v;p++){var t=w[p],x=w[(p+1)%v],t=[t[0]-y[0],t[1]-y[1],t[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];o.push(c([t[1]*x[2]-t[2]*x[1],t[2]*x[0]-t[0]*x[2],t[0]*x[1]-t[1]*x[0]]))}w=[0,0,0];for(p=0;p<o.length;p++)w[0]+=o[p][0],w[1]+=o[p][1],w[2]+=o[p][2];w[0]/=o.length;w[1]/=o.length;w[2]/=o.length;y=(n*e+m)*4;l[y]=(w[0]+1)/2*255|0;l[y+1]=(w[1]+0.5)*
|
|
|
-255|0;l[y+2]=w[2]*255|0;l[y+3]=255}g.putImageData(k,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
|
|
|
+a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var j=g.getImageData(0,0,e,f).data,k=g.createImageData(e,f),l=k.data,m=0;m<e;m++)for(var n=1;n<f;n++){var o=n-1<0?f-1:n-1,p=(n+1)%f,v=m-1<0?e-1:m-1,u=(m+1)%e,x=[],y=[0,0,j[(n*e+m)*4]/255*b];x.push([-1,0,j[(n*e+v)*4]/255*b]);x.push([-1,-1,j[(o*e+v)*4]/255*b]);x.push([0,-1,j[(o*e+m)*4]/255*b]);x.push([1,-1,j[(o*e+u)*4]/255*b]);
|
|
|
+x.push([1,0,j[(n*e+u)*4]/255*b]);x.push([1,1,j[(p*e+u)*4]/255*b]);x.push([0,1,j[(p*e+m)*4]/255*b]);x.push([-1,1,j[(p*e+v)*4]/255*b]);o=[];v=x.length;for(p=0;p<v;p++){var u=x[p],w=x[(p+1)%v],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]],w=[w[0]-y[0],w[1]-y[1],w[2]-y[2]];o.push(c([u[1]*w[2]-u[2]*w[1],u[2]*w[0]-u[0]*w[2],u[0]*w[1]-u[1]*w[0]]))}x=[0,0,0];for(p=0;p<o.length;p++)x[0]+=o[p][0],x[1]+=o[p][1],x[2]+=o[p][2];x[0]/=o.length;x[1]/=o.length;x[2]/=o.length;y=(n*e+m)*4;l[y]=(x[0]+1)/2*255|0;l[y+1]=(x[1]+0.5)*
|
|
|
+255|0;l[y+2]=x[2]*255|0;l[y+3]=255}g.putImageData(k,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],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",
|
|
@@ -30,7 +30,7 @@ THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCac
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,h,g,j,k,l,m=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=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 p=0,v=this.hierarchy.length;p<v;p++)if(a=this.hierarchy[p],k=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=m[p][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 t=0;t<3;t++){c=b[t];g=k.prevKey[c];j=k.nextKey[c];if(j.time<=o){if(n<o)if(this.loop){g=this.data.hierarchy[p].keys[0];for(j=this.getNextKeyWith(c,p,1);j.time<n;)g=j,j=this.getNextKeyWith(c,p,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,p,j.index+1);while(j.time<
|
|
|
+!1):(a.matrix=m[p][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 u=0;u<3;u++){c=b[u];g=k.prevKey[c];j=k.nextKey[c];if(j.time<=o){if(n<o)if(this.loop){g=this.data.hierarchy[p].keys[0];for(j=this.getNextKeyWith(c,p,1);j.time<n;)g=j,j=this.getNextKeyWith(c,p,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,p,j.index+1);while(j.time<
|
|
|
n)}k.prevKey[c]=g;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-g.time)/(j.time-g.time);f=g[c];h=j[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
this.getPrevKeyWith("pos",p,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,j.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
|
|
|
"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
|
|
@@ -47,7 +47,7 @@ this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown
|
|
|
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;f=this.position;a.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=f.y+100*Math.cos(this.phi);a.z=f.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 g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,x=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)x=e*j.chunks[h]/j.total,c.keys[h]={time:x,pos:f[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
|
|
|
+THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,w=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)w=e*j.chunks[h]/j.total,c.keys[h]={time:w,pos:f[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
|
|
|
e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function e(a,b){var e=c(b,10),g=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(g,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);g=new THREE.SphereGeometry(1,
|
|
|
16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,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!==
|
|
@@ -67,18 +67,18 @@ this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVec
|
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
|
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
-THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);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 f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,p=0,v=0,t=window.innerWidth/2,w=window.innerHeight/2;this.update=
|
|
|
+THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);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 f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,p=0,v=0,u=window.innerWidth/2,x=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*p),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*o);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();g.copy(this.forward);h.set(0,1,0);f.cross(h,g).normalize();h.cross(g,f).normalize();this.matrix.n11=f.x;this.matrix.n12=h.x;this.matrix.n13=g.x;this.matrix.n21=f.y;this.matrix.n22=h.y;this.matrix.n23=g.y;this.matrix.n31=f.z;this.matrix.n32=h.z;this.matrix.n33=g.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
|
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
|
|
|
this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(a);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(a){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(a);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-function(a){p=(a.clientX-t)/window.innerWidth;v=(a.clientY-w)/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;
|
|
|
+function(a){p=(a.clientX-u)/window.innerWidth;v=(a.clientY-x)/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:o=1;break;case 70:o=-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:o=0;break;case 70:o=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
-THREE.TrackballCamera=function(a){function b(a,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 c=!1,e=this.STATE.NONE,f=new THREE.Vector3,h=new THREE.Vector3,g=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);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(c.y);e.addSelf(this.up.clone().crossSelf(f).setLength(c.x));e.addSelf(f.setLength(c.z));return e};
|
|
|
-this.rotateCamera=function(){var a=Math.acos(h.dot(g)/h.length()/g.length());if(a){var b=(new THREE.Vector3).cross(h,g).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(f);c.multiplyVector3(this.up);c.multiplyVector3(g);this.staticMoving?h=g:(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&&(f.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};
|
|
|
+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,e=this.STATE.NONE,f=new THREE.Vector3,h=new THREE.Vector3,g=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);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(f).setLength(b.x));e.addSelf(f.setLength(b.z));return e};
|
|
|
+this.rotateCamera=function(){var a=Math.acos(h.dot(g)/h.length()/g.length());if(a){var c=(new THREE.Vector3).cross(h,g).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(f);b.multiplyVector3(this.up);b.multiplyVector3(g);this.staticMoving?h=g:(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&&(f.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(f.length()*this.panSpeed);var b=f.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),
|
|
|
f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(a,b,c){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,a,b,c)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
b(this,function(a){c&&(h=g=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?g=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
|
|
@@ -112,9 +112,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.sl
|
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(j[j.length-2],j[j.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
|
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);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,j,k,l,m,n,o,p,v,t;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){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];o=h[1];c.length>0?(g=c[c.length-1],p=g.x,v=g.y):(g=this.actions[e-1].args,p=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)t=g/a,h=THREE.Shape.Utils.b2(t,p,n,j),t=THREE.Shape.Utils.b2(t,v,o,
|
|
|
-k),c.push(new THREE.Vector2(h,t));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];o=h[1];l=h[2];m=h[3];c.length>0?(g=c[c.length-1],p=g.x,v=g.y):(g=this.actions[e-1].args,p=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)t=g/a,h=THREE.Shape.Utils.b3(t,p,n,l,j),t=THREE.Shape.Utils.b3(t,v,o,m,k),c.push(new THREE.Vector2(h,t));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];t=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
|
|
|
-for(g=1;g<=t;g++)c.push(h.getPointAt(g/t));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;j=h[0];k=h[1];l=h[2];n=h[3];t=h[4];o=!!h[5];m=g[g.length-2];p=g[g.length-1];g.length==0&&(m=p=0);v=t-n;var w=a*2;for(g=1;g<=w;g++)t=g/w,o||(t=1-t),t=n+t*v,h=m+j+l*Math.cos(t),t=p+k+l*Math.sin(t),c.push(new THREE.Vector2(h,t))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,j,k,l,m,n,o,p,v,u;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){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];o=h[1];c.length>0?(g=c[c.length-1],p=g.x,v=g.y):(g=this.actions[e-1].args,p=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b2(u,p,n,j),u=THREE.Shape.Utils.b2(u,v,o,
|
|
|
+k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];o=h[1];l=h[2];m=h[3];c.length>0?(g=c[c.length-1],p=g.x,v=g.y):(g=this.actions[e-1].args,p=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b3(u,p,n,l,j),u=THREE.Shape.Utils.b3(u,v,o,m,k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];u=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
|
|
|
+for(g=1;g<=u;g++)c.push(h.getPointAt(g/u));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;j=h[0];k=h[1];l=h[2];n=h[3];u=h[4];o=!!h[5];m=g[g.length-2];p=g[g.length-1];g.length==0&&(m=p=0);v=u-n;var x=a*2;for(g=1;g<=x;g++)u=g/x,o||(u=1-u),u=n+u*v,h=m+j+l*Math.cos(u),u=p+k+l*Math.sin(u),c.push(new THREE.Vector2(h,u))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var g=this.getPoints(),j,k,l,m,n;j=0;for(k=g.length;j<k;j++)l=g[j],m=l.x,n=l.y,l.x=a*m+b*n+c,l.y=e*n+f*m+h;return g};
|
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();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,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
|
|
|
this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
@@ -122,29 +122,29 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;f
|
|
|
e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.holes.push(e)}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(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,j,k,l,m,n,o,p,v=[];for(k=0;k<b.length;k++){l=b[k];e=e.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];p=[];for(n=0;n<c.length;n++)m=c[n],m=o.distanceToSquared(m),p.push(m),m<h&&(h=m,g=f,j=n)}f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;var t=[l[g],c[j],c[f]];n=THREE.FontUtils.Triangulate.area(t);var w=[l[g],l[h],c[j]];o=THREE.FontUtils.Triangulate.area(w);p=j;m=g;j+=1;g+=-1;j<0&&(j+=c.length);j%=
|
|
|
-c.length;g<0&&(g+=l.length);g%=l.length;f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;t=[l[g],c[j],c[f]];t=THREE.FontUtils.Triangulate.area(t);w=[l[g],l[h],c[j]];w=THREE.FontUtils.Triangulate.area(w);n+o>t+w&&(j=p,g=m,j<0&&(j+=c.length),j%=c.length,g<0&&(g+=l.length),g%=l.length,f=j-1>=0?j-1:c.length-1,h=g-1>=0?g-1:l.length-1);n=c.slice(0,j);o=c.slice(j);p=l.slice(g);m=l.slice(0,g);h=[l[g],l[h],c[j]];v.push([l[g],c[j],c[f]]);v.push(h);c=n.concat(p).concat(m).concat(o)}return{shape:c,isolatedPts:v,
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,j,k,l,m,n,o,p,v=[];for(k=0;k<b.length;k++){l=b[k];e=e.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];p=[];for(n=0;n<c.length;n++)m=c[n],m=o.distanceToSquared(m),p.push(m),m<h&&(h=m,g=f,j=n)}f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;var u=[l[g],c[j],c[f]];n=THREE.FontUtils.Triangulate.area(u);var x=[l[g],l[h],c[j]];o=THREE.FontUtils.Triangulate.area(x);p=j;m=g;j+=1;g+=-1;j<0&&(j+=c.length);j%=
|
|
|
+c.length;g<0&&(g+=l.length);g%=l.length;f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;u=[l[g],c[j],c[f]];u=THREE.FontUtils.Triangulate.area(u);x=[l[g],l[h],c[j]];x=THREE.FontUtils.Triangulate.area(x);n+o>u+x&&(j=p,g=m,j<0&&(j+=c.length),j%=c.length,g<0&&(g+=l.length),g%=l.length,f=j-1>=0?j-1:c.length-1,h=g-1>=0?g-1:l.length-1);n=c.slice(0,j);o=c.slice(j);p=l.slice(g);m=l.slice(0,g);h=[l[g],l[h],c[j]];v.push([l[g],c[j],c[f]]);v.push(h);c=n.concat(p).concat(m).concat(o)}return{shape:c,isolatedPts:v,
|
|
|
allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,g,j,k,l={};h=0;for(g=e.length;h<g;h++)k=e[h].x+":"+e[h].y,l[k]!==void 0&&console.log("Duplicate point",k),l[k]=h;h=0;for(g=c.length;h<g;h++){j=c[h];for(e=0;e<3;e++)k=j[e].x+":"+j[e].y,k=l[k],k!==void 0&&(j[e]=k)}h=0;for(g=f.length;h<g;h++){j=f[h];for(e=0;e<3;e++)k=j[e].x+":"+j[e].y,k=l[k],k!==void 0&&(j[e]=k)}return c.concat(f)},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,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},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,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+this.b3p3(a,f)}};
|
|
|
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,e=b.font!==void 0?b.font:"helvetiker",f=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=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)b=b.concat(a[c].toShapes());return b};
|
|
|
-THREE.CubeGeometry=function(a,b,c,e,f,h,g,j,k){function l(a,b,c,g,j,k,l,n){var p,o,t=e||1,v=f||1,C=j/2,I=k/2,K=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")p="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")p="y",v=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",t=h||1;var L=t+1,J=v+1;j/=t;var N=k/v;for(o=0;o<J;o++)for(k=0;k<L;k++){var D=new THREE.Vector3;D[a]=(k*j-C)*c;D[b]=(o*N-I)*g;D[p]=l;m.vertices.push(new THREE.Vertex(D))}for(o=0;o<v;o++)for(k=0;k<t;k++)m.faces.push(new THREE.Face4(k+L*o+
|
|
|
-K,k+L*(o+1)+K,k+1+L*(o+1)+K,k+1+L*o+K,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/t,o/v),new THREE.UV(k/t,(o+1)/v),new THREE.UV((k+1)/t,(o+1)/v),new THREE.UV((k+1)/t,o/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,p=c/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var t in k)this.sides[t]!=void 0&&(this.sides[t]=
|
|
|
-k[t]);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,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,p,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],b=[],c=0,e=m.vertices.length;c<e;c++){for(var g=m.vertices[c],h=!1,f=0,j=a.length;f<j;f++){var k=a[f];if(g.position.x==k.position.x&&
|
|
|
+THREE.CubeGeometry=function(a,b,c,e,f,h,g,j,k){function l(a,b,c,g,j,k,l,n){var p,o,u=e||1,v=f||1,D=j/2,I=k/2,K=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")p="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")p="y",v=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",u=h||1;var M=u+1,J=v+1;j/=u;var N=k/v;for(o=0;o<J;o++)for(k=0;k<M;k++){var E=new THREE.Vector3;E[a]=(k*j-D)*c;E[b]=(o*N-I)*g;E[p]=l;m.vertices.push(new THREE.Vertex(E))}for(o=0;o<v;o++)for(k=0;k<u;k++)m.faces.push(new THREE.Face4(k+M*o+
|
|
|
+K,k+M*(o+1)+K,k+1+M*(o+1)+K,k+1+M*o+K,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/u,o/v),new THREE.UV(k/u,(o+1)/v),new THREE.UV((k+1)/u,(o+1)/v),new THREE.UV((k+1)/u,o/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,p=c/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var u in k)this.sides[u]!=void 0&&(this.sides[u]=
|
|
|
+k[u]);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,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,p,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],b=[],c=0,e=m.vertices.length;c<e;c++){for(var g=m.vertices[c],h=!1,f=0,j=a.length;f<j;f++){var k=a[f];if(g.position.x==k.position.x&&
|
|
|
g.position.y==k.position.y&&g.position.z==k.position.z){b[c]=f;h=!0;break}}if(!h)b[c]=a.length,a.push(new THREE.Vertex(g.position.clone()))}c=0;for(e=m.faces.length;c<e;c++)g=m.faces[c],g.a=b[g.a],g.b=b[g.b],g.c=b[g.c],g.d=b[g.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,e,f,h){function g(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=e/2;for(k=0;k<a;k++)g(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)g(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,m);var n,o,p,v,t=b-c;for(k=0;k<a;k++)n=new THREE.Vector3,n.copy(j.vertices[k].position),n.z=t,n.normalize(),o=new THREE.Vector3,o.copy(j.vertices[k+a].position),o.z=t,o.normalize(),p=new THREE.Vector3,p.copy(j.vertices[a+
|
|
|
-(k+1)%a].position),p.z=t,p.normalize(),v=new THREE.Vector3,v.copy(j.vertices[(k+1)%a].position),v.z=t,v.normalize(),j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a,[n,o,p,v]));if(c>0){c=new THREE.Vector3(0,0,-1);g(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,[c,c,c,c]))}if(b>0){b=new THREE.Vector3(0,0,1);g(0,0,m+(f||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,[b,b,b,b]))}k=
|
|
|
+THREE.CylinderGeometry=function(a,b,c,e,f,h){function g(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=e/2;for(k=0;k<a;k++)g(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)g(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,m);var n,o,p,v,u=b-c;for(k=0;k<a;k++)n=new THREE.Vector3,n.copy(j.vertices[k].position),n.z=u,n.normalize(),o=new THREE.Vector3,o.copy(j.vertices[k+a].position),o.z=u,o.normalize(),p=new THREE.Vector3,p.copy(j.vertices[a+
|
|
|
+(k+1)%a].position),p.z=u,p.normalize(),v=new THREE.Vector3,v.copy(j.vertices[(k+1)%a].position),v.z=u,v.normalize(),j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a,[n,o,p,v]));if(c>0){c=new THREE.Vector3(0,0,-1);g(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,[c,c,c,c]))}if(b>0){b=new THREE.Vector3(0,0,1);g(0,0,m+(f||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,[b,b,b,b]))}k=
|
|
|
0;for(a=this.faces.length;k<a;k++)f=[],m=this.faces[k],b=this.vertices[m.a],h=this.vertices[m.b],c=this.vertices[m.c],n=this.vertices[m.d],f.push(new THREE.UV(0.5+Math.atan2(b.position.x,b.position.y)/l,0.5+b.position.z/e)),f.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/e)),f.push(new THREE.UV(0.5+Math.atan2(c.position.x,c.position.y)/l,0.5+c.position.z/e)),m instanceof THREE.Face4&&f.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/
|
|
|
e)),this.faceVertexUvs[0].push(f);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,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};
|
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,j=THREE.ExtrudeGeometry.__v5,k=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);j.copy(a).addSelf(h);k.copy(a).addSelf(f);if(j.equals(k))return f.clone();
|
|
|
-j.copy(b).addSelf(h);k.copy(c).addSelf(f);h=e.dot(f);f=k.subSelf(j).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return 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,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(j).subSelf(a).clone()}function f(a){for(z=a.length;--z>=0;){Q=z;P=z-1;P<0&&(P=a.length-
|
|
|
-1);for(var b=0,c=p+m*2,b=0;b<c;b++){var e=N*b,g=N*(b+1),h=T+Q+e,f=T+Q+g,l=h,e=T+P+e,g=T+P+g,n=f;l+=M;e+=M;g+=M;n+=M;G.faces.push(new THREE.Face4(l,e,g,n,null,null,A));A&&(l=b/c,e=(b+1)/c,g=j+k*2,h=(G.vertices[h].position.z+k)/g,f=(G.vertices[f].position.z+k)/g,G.faceVertexUvs[0].push([new THREE.UV(h,l),new THREE.UV(f,l),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=M;b+=M;c+=M;G.faces.push(new THREE.Face3(a,
|
|
|
-b,c,null,null,u));if(u){var e=B.maxY,g=B.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,c/e)])}}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,o=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,v=b.bendPath,t=b.extrudePath,w,y=!1,x=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,u=b.material,A=b.extrudeMaterial,B=this.shapebb;if(t)w=t.getPoints(o),p=w.length,y=!0,n=!1;n||(l=k=m=0);var F,E,H,G=this,M=this.vertices.length;v&&a.addWrapPath(v);o=x?a.extractAllSpacedPoints(o):a.extractAllPoints(o);v=o.shape;o=o.holes;if(t=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();E=0;for(H=o.length;E<H;E++)F=o[E],THREE.Shape.Utils.isClockWise(F)&&
|
|
|
-(o[E]=F.reverse());t=!1}t=THREE.Shape.Utils.triangulateShape(v,o);x=v;E=0;for(H=o.length;E<H;E++)F=o[E],v=v.concat(F);var z,C,I,K,L,J,N=v.length,D=t.length,R=[];z=0;C=x.length;Q=C-1;for(P=z+1;z<C;z++,Q++,P++)Q==C&&(Q=0),P==C&&(P=0),R[z]=e(x[z],x[Q],x[P]);var O=[],S,U=R.concat();E=0;for(H=o.length;E<H;E++){F=o[E];S=[];z=0;C=F.length;Q=C-1;for(P=z+1;z<C;z++,Q++,P++)Q==C&&(Q=0),P==C&&(P=0),S[z]=e(F[z],F[Q],F[P]);O.push(S);U=U.concat(S)}for(I=0;I<m;I++){K=I/m;L=k*(1-K);K=l*Math.sin(K*Math.PI/2);z=0;for(C=
|
|
|
-x.length;z<C;z++)J=c(x[z],R[z],K),h(J.x,J.y,-L);E=0;for(H=o.length;E<H;E++){F=o[E];S=O[E];z=0;for(C=F.length;z<C;z++)J=c(F[z],S[z],K),h(J.x,J.y,-L)}}K=l;for(z=0;z<N;z++)J=n?c(v[z],U[z],K):v[z],y?h(J.x,J.y+w[0].y,w[0].x):h(J.x,J.y,0);for(I=1;I<=p;I++)for(z=0;z<N;z++)J=n?c(v[z],U[z],K):v[z],y?h(J.x,J.y+w[I-1].y,w[I-1].x):h(J.x,J.y,j/p*I);for(I=m-1;I>=0;I--){K=I/m;L=k*(1-K);K=l*Math.sin(K*Math.PI/2);z=0;for(C=x.length;z<C;z++)J=c(x[z],R[z],K),h(J.x,J.y,j+L);E=0;for(H=o.length;E<H;E++){F=o[E];S=O[E];
|
|
|
-z=0;for(C=F.length;z<C;z++)J=c(F[z],S[z],K),y?h(J.x,J.y+w[p-1].y,w[p-1].x+L):h(J.x,J.y,j+L)}}if(n){n=N*0;for(z=0;z<D;z++)l=t[z],g(l[2]+n,l[1]+n,l[0]+n);n=N*(p+m*2);for(z=0;z<D;z++)l=t[z],g(l[0]+n,l[1]+n,l[2]+n)}else{for(z=0;z<D;z++)l=t[z],g(l[2],l[1],l[0]);for(z=0;z<D;z++)l=t[z],g(l[0]+N*p,l[1]+N*p,l[2]+N*p)}var Q,P,T=0;f(x);T+=x.length;E=0;for(H=o.length;E<H;E++)F=o[E],f(F),T+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+j.copy(b).addSelf(h);k.copy(c).addSelf(f);h=e.dot(f);f=k.subSelf(j).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return 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,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(j).subSelf(a).clone()}function f(a){for(A=a.length;--A>=0;){Q=A;P=A-1;P<0&&(P=a.length-
|
|
|
+1);for(var b=0,c=p+m*2,b=0;b<c;b++){var e=N*b,g=N*(b+1),h=T+Q+e,f=T+Q+g,l=h,e=T+P+e,g=T+P+g,n=f;l+=L;e+=L;g+=L;n+=L;G.faces.push(new THREE.Face4(l,e,g,n,null,null,z));z&&(l=b/c,e=(b+1)/c,g=j+k*2,h=(G.vertices[h].position.z+k)/g,f=(G.vertices[f].position.z+k)/g,G.faceVertexUvs[0].push([new THREE.UV(h,l),new THREE.UV(f,l),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
|
|
|
+b,c,null,null,t));if(t){var e=B.maxY,g=B.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,c/e)])}}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,o=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,v=b.bendPath,u=b.extrudePath,x,y=!1,w=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,z=b.extrudeMaterial,B=this.shapebb;if(u)x=u.getPoints(o),p=x.length,y=!0,n=!1;n||(l=k=m=0);var F,C,H,G=this,L=this.vertices.length;v&&a.addWrapPath(v);o=w?a.extractAllSpacedPoints(o):a.extractAllPoints(o);v=o.shape;o=o.holes;if(u=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();C=0;for(H=o.length;C<H;C++)F=o[C],THREE.Shape.Utils.isClockWise(F)&&
|
|
|
+(o[C]=F.reverse());u=!1}u=THREE.Shape.Utils.triangulateShape(v,o);w=v;C=0;for(H=o.length;C<H;C++)F=o[C],v=v.concat(F);var A,D,I,K,M,J,N=v.length,E=u.length,R=[];A=0;D=w.length;Q=D-1;for(P=A+1;A<D;A++,Q++,P++)Q==D&&(Q=0),P==D&&(P=0),R[A]=e(w[A],w[Q],w[P]);var O=[],S,U=R.concat();C=0;for(H=o.length;C<H;C++){F=o[C];S=[];A=0;D=F.length;Q=D-1;for(P=A+1;A<D;A++,Q++,P++)Q==D&&(Q=0),P==D&&(P=0),S[A]=e(F[A],F[Q],F[P]);O.push(S);U=U.concat(S)}for(I=0;I<m;I++){K=I/m;M=k*(1-K);K=l*Math.sin(K*Math.PI/2);A=0;for(D=
|
|
|
+w.length;A<D;A++)J=c(w[A],R[A],K),h(J.x,J.y,-M);C=0;for(H=o.length;C<H;C++){F=o[C];S=O[C];A=0;for(D=F.length;A<D;A++)J=c(F[A],S[A],K),h(J.x,J.y,-M)}}K=l;for(A=0;A<N;A++)J=n?c(v[A],U[A],K):v[A],y?h(J.x,J.y+x[0].y,x[0].x):h(J.x,J.y,0);for(I=1;I<=p;I++)for(A=0;A<N;A++)J=n?c(v[A],U[A],K):v[A],y?h(J.x,J.y+x[I-1].y,x[I-1].x):h(J.x,J.y,j/p*I);for(I=m-1;I>=0;I--){K=I/m;M=k*(1-K);K=l*Math.sin(K*Math.PI/2);A=0;for(D=w.length;A<D;A++)J=c(w[A],R[A],K),h(J.x,J.y,j+M);C=0;for(H=o.length;C<H;C++){F=o[C];S=O[C];
|
|
|
+A=0;for(D=F.length;A<D;A++)J=c(F[A],S[A],K),y?h(J.x,J.y+x[p-1].y,x[p-1].x+M):h(J.x,J.y,j+M)}}if(n){n=N*0;for(A=0;A<E;A++)l=u[A],g(l[2]+n,l[1]+n,l[0]+n);n=N*(p+m*2);for(A=0;A<E;A++)l=u[A],g(l[0]+n,l[1]+n,l[2]+n)}else{for(A=0;A<E;A++)l=u[A],g(l[2],l[1],l[0]);for(A=0;A<E;A++)l=u[A],g(l[0]+N*p,l[1]+N*p,l[2]+N*p)}var Q,P,T=0;f(w);T+=w.length;C=0;for(H=o.length;C<H;C++)F=o[C],f(F),T+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
THREE.IcosahedronGeometry=function(a){function b(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function c(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;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(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,j;for(j in h.faces){var k=e(h.faces[j].a,h.faces[j].b),l=e(h.faces[j].b,h.faces[j].c),m=e(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,a);c(h.faces[j].b,l,
|
|
@@ -153,18 +153,18 @@ THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;t
|
|
|
for(j=0;j<e.length-1;j++)this.faces.push(new THREE.Face4(f[j],f[j+1],e[j+1],e[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)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,g=b/2,c=c||1,e=e||1,j=c+1,k=e+1;a/=c;var l=b/e;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*l-g),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var j=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],m=0;for(e=0;e<h;e++){var n=2*e/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(c==0||c==g)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}b.push(l)}for(var p,v,t,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){l=e==h-1;g=b[c][l?0:e+1];j=b[c][l?h-1:e];k=b[c-1][l?
|
|
|
-h-1:e];l=b[c-1][l?0:e+1];o=c/(f-1);p=(c-1)/(f-1);v=(e+1)/h;var n=e/h,m=new THREE.UV(1-v,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,p),w=new THREE.UV(1-v,p);c<b.length-1&&(p=this.vertices[g].position.clone(),v=this.vertices[j].position.clone(),t=this.vertices[k].position.clone(),p.normalize(),v.normalize(),t.normalize(),this.faces.push(new THREE.Face3(g,j,k,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(t.x,t.y,t.z)])),this.faceVertexUvs[0].push([m,o,n]));c>1&&(p=
|
|
|
-this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),t=this.vertices[l].position.clone(),p.normalize(),v.normalize(),t.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(t.x,t.y,t.z)])),this.faceVertexUvs[0].push([m,n,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var j=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],m=0;for(e=0;e<h;e++){var n=2*e/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(c==0||c==g)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}b.push(l)}for(var p,v,u,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){l=e==h-1;g=b[c][l?0:e+1];j=b[c][l?h-1:e];k=b[c-1][l?
|
|
|
+h-1:e];l=b[c-1][l?0:e+1];o=c/(f-1);p=(c-1)/(f-1);v=(e+1)/h;var n=e/h,m=new THREE.UV(1-v,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,p),x=new THREE.UV(1-v,p);c<b.length-1&&(p=this.vertices[g].position.clone(),v=this.vertices[j].position.clone(),u=this.vertices[k].position.clone(),p.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,j,k,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,o,n]));c>1&&(p=
|
|
|
+this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),u=this.vertices[l].position.clone(),p.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,n,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,b){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;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}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,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(f[a],b,c,e,j);e+=j.offset;g.push(j.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,j,k,l,m,n,o,p,v,t,w=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,
|
|
|
-l));f.moveTo(j,l);break;case "l":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,l));f.lineTo(j,l);break;case "q":j=b[a++]*c+e;l=b[a++]*c;o=b[a++]*c+e;p=b[a++]*c;f.quadraticCurveTo(o,p,j,l);if(g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,x=THREE.Shape.Utils.b2(y,m,o,j),y=THREE.Shape.Utils.b2(y,n,p,l);h.push(new THREE.Vector2(x,y))}}break;case "b":if(j=b[a++]*c+e,l=b[a++]*c,o=b[a++]*c+e,p=b[a++]*-c,v=b[a++]*c+e,t=b[a++]*-c,f.bezierCurveTo(j,l,
|
|
|
-o,p,v,t),g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,x=THREE.Shape.Utils.b3(y,m,o,v,j),y=THREE.Shape.Utils.b3(y,n,p,t,l),h.push(new THREE.Vector2(x,y))}}}return{offset:w.ha*c,points:h,path:f}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return j;return h}k=l;f<=k&&(k=0);l=k+1;f<=l&&(l=0);m=l+1;f<=m&&(m=0);var o;a:{o=a;var p=k,v=l,t=m,w=f,y=g,x=void 0,u=void 0,A=void 0,
|
|
|
-B=void 0,F=void 0,E=void 0,H=void 0,G=void 0,M=void 0,u=o[y[p]].x,A=o[y[p]].y,B=o[y[v]].x,F=o[y[v]].y,E=o[y[t]].x,H=o[y[t]].y;if(1.0E-10>(B-u)*(H-A)-(F-A)*(E-u))o=!1;else{for(x=0;x<w;x++)if(!(x==p||x==v||x==t)){var G=o[y[x]].x,M=o[y[x]].y,z=void 0,C=void 0,I=void 0,K=void 0,L=void 0,J=void 0,N=void 0,D=void 0,R=void 0,O=void 0,S=void 0,U=void 0,z=I=L=void 0,z=E-B,C=H-F,I=u-E,K=A-H,L=B-u,J=F-A,N=G-u,D=M-A,R=G-B,O=M-F,S=G-E,U=M-H,z=z*O-C*R,L=L*D-J*N,I=I*U-K*S;if(z>=0&&I>=0&&L>=0){o=!1;break a}}o=!0}}if(o){h.push([a[g[k]],
|
|
|
+this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(f[a],b,c,e,j);e+=j.offset;g.push(j.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,j,k,l,m,n,o,p,v,u,x=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){b=x._cachedOutline||(x._cachedOutline=x.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,
|
|
|
+l));f.moveTo(j,l);break;case "l":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,l));f.lineTo(j,l);break;case "q":j=b[a++]*c+e;l=b[a++]*c;o=b[a++]*c+e;p=b[a++]*c;f.quadraticCurveTo(o,p,j,l);if(g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,w=THREE.Shape.Utils.b2(y,m,o,j),y=THREE.Shape.Utils.b2(y,n,p,l);h.push(new THREE.Vector2(w,y))}}break;case "b":if(j=b[a++]*c+e,l=b[a++]*c,o=b[a++]*c+e,p=b[a++]*-c,v=b[a++]*c+e,u=b[a++]*-c,f.bezierCurveTo(j,l,
|
|
|
+o,p,v,u),g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,w=THREE.Shape.Utils.b3(y,m,o,v,j),y=THREE.Shape.Utils.b3(y,n,p,u,l),h.push(new THREE.Vector2(w,y))}}}return{offset:x.ha*c,points:h,path:f}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return j;return h}k=l;f<=k&&(k=0);l=k+1;f<=l&&(l=0);m=l+1;f<=m&&(m=0);var o;a:{o=a;var p=k,v=l,u=m,x=f,y=g,w=void 0,t=void 0,z=void 0,
|
|
|
+B=void 0,F=void 0,C=void 0,H=void 0,G=void 0,L=void 0,t=o[y[p]].x,z=o[y[p]].y,B=o[y[v]].x,F=o[y[v]].y,C=o[y[u]].x,H=o[y[u]].y;if(1.0E-10>(B-t)*(H-z)-(F-z)*(C-t))o=!1;else{for(w=0;w<x;w++)if(!(w==p||w==v||w==u)){var G=o[y[w]].x,L=o[y[w]].y,A=void 0,D=void 0,I=void 0,K=void 0,M=void 0,J=void 0,N=void 0,E=void 0,R=void 0,O=void 0,S=void 0,U=void 0,A=I=M=void 0,A=C-B,D=H-F,I=t-C,K=z-H,M=B-t,J=F-z,N=G-t,E=L-z,R=G-B,O=L-F,S=G-C,U=L-H,A=A*O-D*R,M=M*E-J*N,I=I*U-K*S;if(A>=0&&I>=0&&M>=0){o=!1;break a}}o=!0}}if(o){h.push([a[g[k]],
|
|
|
a[g[l]],a[g[m]]]);j.push([g[k],g[l],g[m]]);k=l;for(m=l+1;m<f;k++,m++)g[k]=g[m];f--;n=2*f}}if(e)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,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var j=new THREE.Vector3;j.x=(this.radius+this.tube*Math.cos(g))*Math.cos(h);j.y=(this.radius+this.tube*Math.cos(g))*Math.sin(h);j.z=
|
|
|
this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(j));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(j.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,g=(this.segmentsT+1)*(c-1)+e,j=(this.segmentsT+1)*c+e,k=new THREE.Face4(f,h,g,j,[b[f],b[h],b[g],b[j]]);k.normal.addSelf(b[f]);k.normal.addSelf(b[h]);k.normal.addSelf(b[g]);k.normal.addSelf(b[j]);k.normal.normalize();this.faces.push(k);
|
|
@@ -182,59 +182,59 @@ else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpe
|
|
|
a.mapSpecular&&b&&f(g,"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=g.color;j=g.specular;k=g.ambient;var o=g.shininess;m.tNormal.texture=g.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(g.map)m.tDiffuse.texture=g.map,m.enableDiffuse.value=!0;if(g.specularMap)m.tSpecular.texture=g.specularMap,m.enableSpecular.value=!0;if(g.lightMap)m.tAO.texture=
|
|
|
g.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(n);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=o;if(g.opacity)m.uOpacity.value=g.opacity;g=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else g=new THREE[j](g);return g},constructor:THREE.Loader};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,f);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,k,l,m,n,o,p,v,t,w,y,x,u,A=a.faces;n=a.vertices;var B=a.normals,F=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*b,o.position.y=
|
|
|
-n[l++]*b,o.position.z=n[l++]*b,e.vertices.push(o);l=0;for(m=A.length;l<m;){b=A[l++];n=b&1;k=b&2;c=b&4;f=b&8;p=b&16;o=b&32;t=b&64;b&=128;n?(w=new THREE.Face4,w.a=A[l++],w.b=A[l++],w.c=A[l++],w.d=A[l++],n=4):(w=new THREE.Face3,w.a=A[l++],w.b=A[l++],w.c=A[l++],n=3);if(k)k=A[l++],w.materials=e.materials[k];k=e.faces.length;if(c)for(c=0;c<E;c++)y=a.uvs[c],v=A[l++],u=y[v*2],v=y[v*2+1],e.faceUvs[c][k]=new THREE.UV(u,v);if(f)for(c=0;c<E;c++){y=a.uvs[c];x=[];for(f=0;f<n;f++)v=A[l++],u=y[v*2],v=y[v*2+1],x[f]=
|
|
|
-new THREE.UV(u,v);e.faceVertexUvs[c][k]=x}if(p)p=A[l++]*3,f=new THREE.Vector3,f.x=B[p++],f.y=B[p++],f.z=B[p],w.normal=f;if(o)for(c=0;c<n;c++)p=A[l++]*3,f=new THREE.Vector3,f.x=B[p++],f.y=B[p++],f.z=B[p],w.vertexNormals.push(f);if(t)o=A[l++],o=new THREE.Color(F[o]),w.color=o;if(b)for(c=0;c<n;c++)o=A[l++],o=new THREE.Color(F[o]),w.vertexColors.push(o);e.faces.push(w)}}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],k=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,k,l,m,n,o,p,v,u,x,y,w,t,z=a.faces;n=a.vertices;var B=a.normals,F=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*b,o.position.y=
|
|
|
+n[l++]*b,o.position.z=n[l++]*b,e.vertices.push(o);l=0;for(m=z.length;l<m;){b=z[l++];n=b&1;k=b&2;c=b&4;f=b&8;p=b&16;o=b&32;u=b&64;b&=128;n?(x=new THREE.Face4,x.a=z[l++],x.b=z[l++],x.c=z[l++],x.d=z[l++],n=4):(x=new THREE.Face3,x.a=z[l++],x.b=z[l++],x.c=z[l++],n=3);if(k)k=z[l++],x.materials=e.materials[k];k=e.faces.length;if(c)for(c=0;c<C;c++)y=a.uvs[c],v=z[l++],t=y[v*2],v=y[v*2+1],e.faceUvs[c][k]=new THREE.UV(t,v);if(f)for(c=0;c<C;c++){y=a.uvs[c];w=[];for(f=0;f<n;f++)v=z[l++],t=y[v*2],v=y[v*2+1],w[f]=
|
|
|
+new THREE.UV(t,v);e.faceVertexUvs[c][k]=w}if(p)p=z[l++]*3,f=new THREE.Vector3,f.x=B[p++],f.y=B[p++],f.z=B[p],x.normal=f;if(o)for(c=0;c<n;c++)p=z[l++]*3,f=new THREE.Vector3,f.x=B[p++],f.y=B[p++],f.z=B[p],x.vertexNormals.push(f);if(u)o=z[l++],o=new THREE.Color(F[o]),x.color=o;if(b)for(c=0;c<n;c++)o=z[l++],o=new THREE.Color(F[o]),x.vertexColors.push(o);e.faces.push(x)}}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],k=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
|
|
|
k,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],k=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,k,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,l,m,n,o,p,v;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];p=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*b,n=v[k+1]*
|
|
|
b,o=v[k+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(m,n,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];l=e.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)}}})(f);(function(){if(a.edges!==void 0){var b,c,f;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],f=a.edges[b+1],e.edges.push(new THREE.Edge(e.vertices[c],
|
|
|
e.vertices[f],c,f))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};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,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=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,f,e,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
|
|
|
-b.postMessage(a)},loadAjaxBuffers:function(a,b,c,e,f,h){var g=new XMLHttpRequest,j=e+"/"+a,k=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,c,f,b):alert("Couldn't load ["+j+"] ["+g.status+"]"):g.readyState==3?h&&(k==0&&(k=g.getResponseHeader("Content-Length")),h({total:k,loaded:g.responseText.length})):g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};g.open("GET",j,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,b,c,e){var f=function(b){function c(a,b){var e=m(a,b),f=m(a,b+1),g=m(a,b+2),h=m(a,b+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,b){var c=m(a,b),e=m(a,b+1),g=m(a,b+2);return(m(a,b+3)<<24)+(g<<16)+(e<<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,e,g;c=f(a,b);e=f(a,b+F);g=f(a,b+E);b=k(a,b+H);THREE.BinaryLoader.prototype.f3(y,c,e,g,b)}function o(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+F);g=f(a,b+E);h=k(a,b+H);l=f(a,b+G);m=f(a,b+M);b=f(a,b+z);THREE.BinaryLoader.prototype.f3n(y,A,c,e,g,h,l,m,b)}function p(b){var c,e,g,h;c=f(a,b);e=f(a,b+C);g=f(a,b+I);h=f(a,b+K);b=k(a,b+L);THREE.BinaryLoader.prototype.f4(y,c,e,g,h,b)}function v(b){var c,e,g,h,l,m,n,o;c=f(a,b);e=f(a,b+C);g=f(a,b+I);h=f(a,b+K);l=k(a,
|
|
|
-b+L);m=f(a,b+J);n=f(a,b+N);o=f(a,b+D);b=f(a,b+R);THREE.BinaryLoader.prototype.f4n(y,A,c,e,g,h,l,m,n,o,b)}function t(b){var c,e;c=f(a,b);e=f(a,b+O);b=f(a,b+S);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],B[c*2],B[c*2+1],B[e*2],B[e*2+1],B[b*2],B[b*2+1])}function w(b){var c,e,g;c=f(a,b);e=f(a,b+U);g=f(a,b+Q);b=f(a,b+P);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],B[c*2],B[c*2+1],B[e*2],B[e*2+1],B[g*2],B[g*2+1],B[b*2],B[b*2+1])}var y=this,x=0,u,A=[],B=[],F,E,H,G,M,z,C,I,K,L,J,N,D,R,O,S,
|
|
|
-U,Q,P,T,W,X,Y,Z,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,b);u={signature:a.substr(x,8),header_bytes:m(a,x+8),vertex_coordinate_bytes:m(a,x+9),normal_coordinate_bytes:m(a,x+10),uv_coordinate_bytes:m(a,x+11),vertex_index_bytes:m(a,x+12),normal_index_bytes:m(a,x+13),uv_index_bytes:m(a,x+14),material_index_bytes:m(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,x+16+20),ntri_smooth_uv:f(a,x+
|
|
|
-16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=u.header_bytes;F=u.vertex_index_bytes;E=u.vertex_index_bytes*2;H=u.vertex_index_bytes*3;G=u.vertex_index_bytes*3+u.material_index_bytes;M=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;z=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;C=u.vertex_index_bytes;I=u.vertex_index_bytes*2;K=u.vertex_index_bytes*3;L=u.vertex_index_bytes*4;J=u.vertex_index_bytes*
|
|
|
-4+u.material_index_bytes;N=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;D=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;R=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;O=u.uv_index_bytes;S=u.uv_index_bytes*2;U=u.uv_index_bytes;Q=u.uv_index_bytes*2;P=u.uv_index_bytes*3;b=u.vertex_index_bytes*3+u.material_index_bytes;V=u.vertex_index_bytes*4+u.material_index_bytes;T=u.ntri_flat*b;W=u.ntri_smooth*(b+u.normal_index_bytes*3);X=u.ntri_flat_uv*
|
|
|
-(b+u.uv_index_bytes*3);Y=u.ntri_smooth_uv*(b+u.normal_index_bytes*3+u.uv_index_bytes*3);Z=u.nquad_flat*V;b=u.nquad_smooth*(V+u.normal_index_bytes*4);V=u.nquad_flat_uv*(V+u.uv_index_bytes*4);x+=function(b){for(var e,f,h,j=u.vertex_coordinate_bytes*3,k=b+u.nvertices*j;b<k;b+=j)e=c(a,b),f=c(a,b+u.vertex_coordinate_bytes),h=c(a,b+u.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,e,f,h);return u.nvertices*j}(x);x+=function(b){for(var c,e,f,g=u.normal_coordinate_bytes*3,h=b+u.nnormals*g;b<h;b+=
|
|
|
-g)c=l(a,b),e=l(a,b+u.normal_coordinate_bytes),f=l(a,b+u.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return u.nnormals*g}(x);x+=function(b){for(var e,f,h=u.uv_coordinate_bytes*2,j=b+u.nuvs*h;b<j;b+=h)e=c(a,b),f=c(a,b+u.uv_coordinate_bytes),B.push(e,f);return u.nuvs*h}(x);T=x+T;W=T+W;X=W+X;Y=X+Y;Z=Y+Z;b=Z+b;V=b+V;(function(a){var b,c=u.vertex_index_bytes*3+u.material_index_bytes,e=c+u.uv_index_bytes*3,f=a+u.ntri_flat_uv*e;for(b=a;b<f;b+=e)n(b),t(b+c);return f-a})(W);(function(a){var b,c=u.vertex_index_bytes*
|
|
|
-3+u.material_index_bytes+u.normal_index_bytes*3,e=c+u.uv_index_bytes*3,f=a+u.ntri_smooth_uv*e;for(b=a;b<f;b+=e)o(b),t(b+c);return f-a})(X);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes,e=c+u.uv_index_bytes*4,f=a+u.nquad_flat_uv*e;for(b=a;b<f;b+=e)p(b),w(b+c);return f-a})(b);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,e=c+u.uv_index_bytes*4,f=a+u.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),w(b+c);return f-a})(V);(function(a){var b,c=u.vertex_index_bytes*
|
|
|
-3+u.material_index_bytes,e=a+u.ntri_flat*c;for(b=a;b<e;b+=c)n(b);return e-a})(x);(function(a){var b,c=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,e=a+u.ntri_smooth*c;for(b=a;b<e;b+=c)o(b);return e-a})(T);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes,e=a+u.nquad_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(Y);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,e=a+u.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})(Z);
|
|
|
-this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3:function(a,b,c,e,f){a.faces.push(new THREE.Face3(b,c,e,null,null,a.materials[f]))},f4:function(a,b,c,e,f,h){a.faces.push(new THREE.Face4(b,c,e,f,null,null,a.materials[h]))},f3n:function(a,b,c,e,f,h,g,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],o=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,h))},f4n:function(a,b,c,e,f,h,g,j,k,l,m){var g=a.materials[g],n=b[k*3],o=b[k*3+1],k=b[k*3+2],p=b[l*3],v=b[l*3+1],l=b[l*3+2],t=b[m*3],w=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,v,l),new THREE.Vector3(t,w,
|
|
|
-m)],null,g))},uv3:function(a,b,c,e,f,h,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(e,f));j.push(new THREE.UV(h,g));a.push(j)},uv4:function(a,b,c,e,f,h,g,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(e,f));l.push(new THREE.UV(h,g));l.push(new THREE.UV(j,k));a.push(l)},constructor:THREE.BinaryLoader};
|
|
|
-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,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function j(){for(p in C.objects)if(!D.objects[p])if(x=C.objects[p],x.geometry!==void 0){if(F=D.geometries[x.geometry]){var a=!1;M=[];for(O=0;O<x.materials.length;O++)M[O]=D.materials[x.materials[O]],a=M[O]instanceof THREE.MeshShaderMaterial;a&&F.computeTangents();u=x.position;r=x.rotation;
|
|
|
-q=x.quaternion;s=x.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,M);object.name=p;object.position.set(u[0],u[1],u[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;D.scene.addObject(object);D.objects[p]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),D.scene.collisions.colliders.push(a));
|
|
|
-if(x.castsShadow)a=new THREE.ShadowVolume(F),D.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},D.triggers[object.name]=a)}}else u=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(u[0],u[1],u[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
-s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,D.scene.addObject(object),D.objects[p]=object,D.empties[p]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},D.triggers[object.name]=a)}function k(a){return function(b){D.geometries[a]=b;j();K-=1;c.onLoadComplete();m()}}function l(a){return function(b){D.geometries[a]=b}}function m(){c.callbackProgress({totalModels:J,totalTextures:N,loadedModels:J-K,loadedTextures:N-L},D);c.onLoadProgress();K==0&&L==0&&b(D)}var n,
|
|
|
-o,p,v,t,w,y,x,u,A,B,F,E,H,G,M,z,C,I,K,L,J,N,D;C=a.data;G=new THREE.BinaryLoader;I=new THREE.JSONLoader;L=K=0;D={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in C.objects)if(x=C.objects[p],x.meshCollider){a=!0;break}if(a)D.scene.collisions=new THREE.CollisionSystem;if(C.transform){a=C.transform.position;A=C.transform.rotation;var R=C.transform.scale;a&&D.scene.position.set(a[0],a[1],a[2]);A&&D.scene.rotation.set(A[0],
|
|
|
-A[1],A[2]);R&&D.scene.scale.set(R[0],R[1],R[2]);(a||A||R)&&D.scene.updateMatrix()}a=function(){L-=1;m();c.onLoadComplete()};for(t in C.cameras){A=C.cameras[t];if(A.type=="perspective")E=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")E=new THREE.Camera,E.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);u=A.position;A=A.target;E.position.set(u[0],u[1],u[2]);E.target.position.set(A[0],A[1],A[2]);D.cameras[t]=E}for(v in C.lights)t=C.lights[v],
|
|
|
-E=t.color!==void 0?t.color:16777215,A=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(u=t.direction,z=new THREE.DirectionalLight(E,A),z.position.set(u[0],u[1],u[2]),z.position.normalize()):t.type=="point"?(u=t.position,d=t.distance,z=new THREE.PointLight(E,A,d),z.position.set(u[0],u[1],u[2])):t.type=="ambient"&&(z=new THREE.AmbientLight(E)),D.scene.addLight(z),D.lights[v]=z;for(w in C.fogs)v=C.fogs[w],v.type=="linear"?H=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(H=new THREE.FogExp2(0,
|
|
|
-v.density)),A=v.color,H.color.setRGB(A[0],A[1],A[2]),D.fogs[w]=H;if(D.cameras&&C.defaults.camera)D.currentCamera=D.cameras[C.defaults.camera];if(D.fogs&&C.defaults.fog)D.scene.fog=D.fogs[C.defaults.fog];A=C.defaults.bgcolor;D.bgColor=new THREE.Color;D.bgColor.setRGB(A[0],A[1],A[2]);D.bgColorAlpha=C.defaults.bgalpha;for(n in C.geometries)if(w=C.geometries[n],w.type=="bin_mesh"||w.type=="ascii_mesh")K+=1,c.onLoadStart();J=K;for(n in C.geometries)w=C.geometries[n],w.type=="cube"?(F=new THREE.CubeGeometry(w.width,
|
|
|
-w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),D.geometries[n]=F):w.type=="plane"?(F=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),D.geometries[n]=F):w.type=="sphere"?(F=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),D.geometries[n]=F):w.type=="cylinder"?(F=new THREE.CylinderGeometry(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset),D.geometries[n]=F):w.type=="torus"?(F=new THREE.TorusGeometry(w.radius,
|
|
|
-w.tube,w.segmentsR,w.segmentsT),D.geometries[n]=F):w.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(w.subdivisions),D.geometries[n]=F):w.type=="bin_mesh"?G.load({model:e(w.url,C.urlBaseType),callback:k(n)}):w.type=="ascii_mesh"?I.load({model:e(w.url,C.urlBaseType),callback:k(n)}):w.type=="embedded_mesh"&&(w=C.embeds[w.id])&&I.createModel(w,l(n),"");for(y in C.textures)if(n=C.textures[y],n.url instanceof Array){L+=n.url.length;for(G=0;G<n.url.length;G++)c.onLoadStart()}else L+=1,c.onLoadStart();
|
|
|
-N=L;for(y in C.textures){n=C.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){G=[];for(var O=0;O<n.url.length;O++)G[O]=e(n.url[O],C.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,n.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(n.url,C.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)G.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)G.magFilter=THREE[n.magFilter];if(n.repeat){G.repeat.set(n.repeat[0],n.repeat[1]);
|
|
|
-if(n.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}n.offset&&G.offset.set(n.offset[0],n.offset[1]);if(n.wrap){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(I[n.wrap[0]]!==void 0)G.wrapS=I[n.wrap[0]];if(I[n.wrap[1]]!==void 0)G.wrapT=I[n.wrap[1]]}}D.textures[y]=G}for(o in C.materials){y=C.materials[o];for(B in y.parameters)if(B=="envMap"||B=="map"||B=="lightMap")y.parameters[B]=D.textures[y.parameters[B]];else if(B=="shading")y.parameters[B]=
|
|
|
+THREE.BinaryLoader.prototype.load=function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=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,f,e,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
|
|
|
+b.postMessage(a)};
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var g=new XMLHttpRequest,j=e+"/"+a,k=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,c,f,b):alert("Couldn't load ["+j+"] ["+g.status+"]"):g.readyState==3?h&&(k==0&&(k=g.getResponseHeader("Content-Length")),h({total:k,loaded:g.responseText.length})):g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};g.open("GET",j,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(b){function c(a,b){var e=m(a,b),f=m(a,b+1),g=m(a,b+2),h=m(a,b+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,b){var c=m(a,b),e=m(a,b+1),g=m(a,b+2);return(m(a,b+3)<<24)+(g<<16)+(e<<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,
|
|
|
+e,g;c=f(a,b);e=f(a,b+F);g=f(a,b+C);b=k(a,b+H);y.faces.push(new THREE.Face3(c,e,g,null,null,y.materials[b]))}function o(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+F);g=f(a,b+C);h=k(a,b+H);l=f(a,b+G);m=f(a,b+L);b=f(a,b+A);h=y.materials[h];var n=z[m*3],o=z[m*3+1];m=z[m*3+2];var p=z[b*3],u=z[b*3+1],b=z[b*3+2];y.faces.push(new THREE.Face3(c,e,g,[new THREE.Vector3(z[l*3],z[l*3+1],z[l*3+2]),new THREE.Vector3(n,o,m),new THREE.Vector3(p,u,b)],null,h))}function p(b){var c,e,g,h;c=f(a,b);e=f(a,b+D);g=f(a,b+I);h=f(a,
|
|
|
+b+K);b=k(a,b+M);y.faces.push(new THREE.Face4(c,e,g,h,null,null,y.materials[b]))}function v(b){var c,e,g,h,l,m,n,o;c=f(a,b);e=f(a,b+D);g=f(a,b+I);h=f(a,b+K);l=k(a,b+M);m=f(a,b+J);n=f(a,b+N);o=f(a,b+E);b=f(a,b+R);l=y.materials[l];var p=z[n*3],u=z[n*3+1];n=z[n*3+2];var x=z[o*3],v=z[o*3+1];o=z[o*3+2];var t=z[b*3],w=z[b*3+1],b=z[b*3+2];y.faces.push(new THREE.Face4(c,e,g,h,[new THREE.Vector3(z[m*3],z[m*3+1],z[m*3+2]),new THREE.Vector3(p,u,n),new THREE.Vector3(x,v,o),new THREE.Vector3(t,w,b)],null,l))}function u(b){var c,
|
|
|
+e,g,h;c=f(a,b);e=f(a,b+O);g=f(a,b+S);b=B[c*2];h=B[c*2+1];c=B[e*2];var k=y.faceVertexUvs[0];e=B[e*2+1];var l=B[g*2];g=B[g*2+1];var m=[];m.push(new THREE.UV(b,h));m.push(new THREE.UV(c,e));m.push(new THREE.UV(l,g));k.push(m)}function x(b){var c,e,g,h,k,l;c=f(a,b);e=f(a,b+U);g=f(a,b+Q);h=f(a,b+P);b=B[c*2];k=B[c*2+1];c=B[e*2];l=B[e*2+1];e=B[g*2];var m=y.faceVertexUvs[0];g=B[g*2+1];var n=B[h*2];h=B[h*2+1];var o=[];o.push(new THREE.UV(b,k));o.push(new THREE.UV(c,l));o.push(new THREE.UV(e,g));o.push(new THREE.UV(n,
|
|
|
+h));m.push(o)}var y=this,w=0,t,z=[],B=[],F,C,H,G,L,A,D,I,K,M,J,N,E,R,O,S,U,Q,P,T,W,X,Y,Z,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,b);t={signature:a.substr(w,8),header_bytes:m(a,w+8),vertex_coordinate_bytes:m(a,w+9),normal_coordinate_bytes:m(a,w+10),uv_coordinate_bytes:m(a,w+11),vertex_index_bytes:m(a,w+12),normal_index_bytes:m(a,w+13),uv_index_bytes:m(a,w+14),material_index_bytes:m(a,w+15),nvertices:f(a,w+16),nnormals:f(a,w+16+4),nuvs:f(a,w+16+8),ntri_flat:f(a,w+16+12),
|
|
|
+ntri_smooth:f(a,w+16+16),ntri_flat_uv:f(a,w+16+20),ntri_smooth_uv:f(a,w+16+24),nquad_flat:f(a,w+16+28),nquad_smooth:f(a,w+16+32),nquad_flat_uv:f(a,w+16+36),nquad_smooth_uv:f(a,w+16+40)};w+=t.header_bytes;F=t.vertex_index_bytes;C=t.vertex_index_bytes*2;H=t.vertex_index_bytes*3;G=t.vertex_index_bytes*3+t.material_index_bytes;L=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;A=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;D=t.vertex_index_bytes;I=t.vertex_index_bytes*
|
|
|
+2;K=t.vertex_index_bytes*3;M=t.vertex_index_bytes*4;J=t.vertex_index_bytes*4+t.material_index_bytes;N=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;E=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;R=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;O=t.uv_index_bytes;S=t.uv_index_bytes*2;U=t.uv_index_bytes;Q=t.uv_index_bytes*2;P=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;V=t.vertex_index_bytes*4+t.material_index_bytes;
|
|
|
+T=t.ntri_flat*b;W=t.ntri_smooth*(b+t.normal_index_bytes*3);X=t.ntri_flat_uv*(b+t.uv_index_bytes*3);Y=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);Z=t.nquad_flat*V;b=t.nquad_smooth*(V+t.normal_index_bytes*4);V=t.nquad_flat_uv*(V+t.uv_index_bytes*4);w+=function(b){for(var e,f,h,j=t.vertex_coordinate_bytes*3,k=b+t.nvertices*j;b<k;b+=j)e=c(a,b),f=c(a,b+t.vertex_coordinate_bytes),h=c(a,b+t.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,h)));return t.nvertices*
|
|
|
+j}(w);w+=function(b){for(var c,e,f,g=t.normal_coordinate_bytes*3,h=b+t.nnormals*g;b<h;b+=g)c=l(a,b),e=l(a,b+t.normal_coordinate_bytes),f=l(a,b+t.normal_coordinate_bytes*2),z.push(c/127,e/127,f/127);return t.nnormals*g}(w);w+=function(b){for(var e,f,h=t.uv_coordinate_bytes*2,j=b+t.nuvs*h;b<j;b+=h)e=c(a,b),f=c(a,b+t.uv_coordinate_bytes),B.push(e,f);return t.nuvs*h}(w);T=w+T;W=T+W;X=W+X;Y=X+Y;Z=Y+Z;b=Z+b;V=b+V;(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=c+t.uv_index_bytes*3,
|
|
|
+f=a+t.ntri_flat_uv*e;for(b=a;b<f;b+=e)n(b),u(b+c);return f-a})(W);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=c+t.uv_index_bytes*3,f=a+t.ntri_smooth_uv*e;for(b=a;b<f;b+=e)o(b),u(b+c);return f-a})(X);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=c+t.uv_index_bytes*4,f=a+t.nquad_flat_uv*e;for(b=a;b<f;b+=e)p(b),x(b+c);return f-a})(b);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,e=c+t.uv_index_bytes*
|
|
|
+4,f=a+t.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),x(b+c);return f-a})(V);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=a+t.ntri_flat*c;for(b=a;b<e;b+=c)n(b);return e-a})(w);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=a+t.ntri_smooth*c;for(b=a;b<e;b+=c)o(b);return e-a})(T);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=a+t.nquad_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(Y);(function(a){var b,c=t.vertex_index_bytes*
|
|
|
+4+t.material_index_bytes+t.normal_index_bytes*4,e=a+t.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})(Z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};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,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function j(){for(p in D.objects)if(!E.objects[p])if(w=D.objects[p],w.geometry!==void 0){if(F=E.geometries[w.geometry]){var a=!1;L=[];for(O=0;O<w.materials.length;O++)L[O]=E.materials[w.materials[O]],a=L[O]instanceof THREE.MeshShaderMaterial;a&&F.computeTangents();t=w.position;r=w.rotation;
|
|
|
+q=w.quaternion;s=w.scale;q=0;L.length==0&&(L[0]=new THREE.MeshFaceMaterial);L.length>1&&(L=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,L);object.name=p;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=w.visible;E.scene.addObject(object);E.objects[p]=object;w.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),E.scene.collisions.colliders.push(a));
|
|
|
+if(w.castsShadow)a=new THREE.ShadowVolume(F),E.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},E.triggers[object.name]=a)}}else t=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=p,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=w.visible!==void 0?w.visible:!1,E.scene.addObject(object),E.objects[p]=object,E.empties[p]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},E.triggers[object.name]=a)}function k(a){return function(b){E.geometries[a]=b;j();K-=1;c.onLoadComplete();m()}}function l(a){return function(b){E.geometries[a]=b}}function m(){c.callbackProgress({totalModels:J,totalTextures:N,loadedModels:J-K,loadedTextures:N-M},E);c.onLoadProgress();K==0&&M==0&&b(E)}var n,
|
|
|
+o,p,v,u,x,y,w,t,z,B,F,C,H,G,L,A,D,I,K,M,J,N,E;D=a.data;G=new THREE.BinaryLoader;I=new THREE.JSONLoader;M=K=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in D.objects)if(w=D.objects[p],w.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;z=D.transform.rotation;var R=D.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);z&&E.scene.rotation.set(z[0],
|
|
|
+z[1],z[2]);R&&E.scene.scale.set(R[0],R[1],R[2]);(a||z||R)&&E.scene.updateMatrix()}a=function(){M-=1;m();c.onLoadComplete()};for(u in D.cameras){z=D.cameras[u];if(z.type=="perspective")C=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")C=new THREE.Camera,C.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);t=z.position;z=z.target;C.position.set(t[0],t[1],t[2]);C.target.position.set(z[0],z[1],z[2]);E.cameras[u]=C}for(v in D.lights)u=D.lights[v],
|
|
|
+C=u.color!==void 0?u.color:16777215,z=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(t=u.direction,A=new THREE.DirectionalLight(C,z),A.position.set(t[0],t[1],t[2]),A.position.normalize()):u.type=="point"?(t=u.position,d=u.distance,A=new THREE.PointLight(C,z,d),A.position.set(t[0],t[1],t[2])):u.type=="ambient"&&(A=new THREE.AmbientLight(C)),E.scene.addLight(A),E.lights[v]=A;for(x in D.fogs)v=D.fogs[x],v.type=="linear"?H=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(H=new THREE.FogExp2(0,
|
|
|
+v.density)),z=v.color,H.color.setRGB(z[0],z[1],z[2]),E.fogs[x]=H;if(E.cameras&&D.defaults.camera)E.currentCamera=E.cameras[D.defaults.camera];if(E.fogs&&D.defaults.fog)E.scene.fog=E.fogs[D.defaults.fog];z=D.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(z[0],z[1],z[2]);E.bgColorAlpha=D.defaults.bgalpha;for(n in D.geometries)if(x=D.geometries[n],x.type=="bin_mesh"||x.type=="ascii_mesh")K+=1,c.onLoadStart();J=K;for(n in D.geometries)x=D.geometries[n],x.type=="cube"?(F=new THREE.CubeGeometry(x.width,
|
|
|
+x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),E.geometries[n]=F):x.type=="plane"?(F=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),E.geometries[n]=F):x.type=="sphere"?(F=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),E.geometries[n]=F):x.type=="cylinder"?(F=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),E.geometries[n]=F):x.type=="torus"?(F=new THREE.TorusGeometry(x.radius,
|
|
|
+x.tube,x.segmentsR,x.segmentsT),E.geometries[n]=F):x.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(x.subdivisions),E.geometries[n]=F):x.type=="bin_mesh"?G.load({model:e(x.url,D.urlBaseType),callback:k(n)}):x.type=="ascii_mesh"?I.load({model:e(x.url,D.urlBaseType),callback:k(n)}):x.type=="embedded_mesh"&&(x=D.embeds[x.id])&&I.createModel(x,l(n),"");for(y in D.textures)if(n=D.textures[y],n.url instanceof Array){M+=n.url.length;for(G=0;G<n.url.length;G++)c.onLoadStart()}else M+=1,c.onLoadStart();
|
|
|
+N=M;for(y in D.textures){n=D.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){G=[];for(var O=0;O<n.url.length;O++)G[O]=e(n.url[O],D.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,n.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(n.url,D.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)G.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)G.magFilter=THREE[n.magFilter];if(n.repeat){G.repeat.set(n.repeat[0],n.repeat[1]);
|
|
|
+if(n.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}n.offset&&G.offset.set(n.offset[0],n.offset[1]);if(n.wrap){I={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(I[n.wrap[0]]!==void 0)G.wrapS=I[n.wrap[0]];if(I[n.wrap[1]]!==void 0)G.wrapT=I[n.wrap[1]]}}E.textures[y]=G}for(o in D.materials){y=D.materials[o];for(B in y.parameters)if(B=="envMap"||B=="map"||B=="lightMap")y.parameters[B]=E.textures[y.parameters[B]];else if(B=="shading")y.parameters[B]=
|
|
|
y.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")y.parameters[B]=THREE[y.parameters[B]]?THREE[y.parameters[B]]:THREE.NormalBlending;else if(B=="combine")y.parameters[B]=y.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(y.parameters[B]=="face")y.parameters[B]=THREE.FaceColors;else if(y.parameters[B])y.parameters[B]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
|
|
|
-!0;if(y.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);G=y.parameters.color;I=y.parameters.specular;w=y.parameters.ambient;H=y.parameters.shininess;a.tNormal.texture=D.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=
|
|
|
-D.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(I);a.uAmbientColor.value.setHex(w);a.uShininess.value=H;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);D.materials[o]=y}j();c.callbackSync(D)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+!0;if(y.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);G=y.parameters.color;I=y.parameters.specular;x=y.parameters.ambient;H=y.parameters.shininess;a.tNormal.texture=E.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=
|
|
|
+E.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(I);a.uAmbientColor.value.setHex(x);a.uShininess.value=H;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);E.materials[o]=y}j();c.callbackSync(E)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
-THREE.UTF8Loader.prototype={load:function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,f=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,g=a.offsetY!==void 0?a.offsetY:0,j=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,f,h,g,j):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)},
|
|
|
-decompressMesh:function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,g=0;g<b;++g){var j=a.charCodeAt(g+e);h+=j>>1^-(j&1);c[8*g+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=g=0;f<b;f++)j=a.charCodeAt(f+e),h[f]=g-j,j==0&&g++;return[c,h]},createModel:function(a,b,c,e,f,h){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],m=[];(function(a,g,k){for(var l,m,w,
|
|
|
-y=a.length;k<y;k+=g)l=a[k],m=a[k+1],w=a[k+2],l=l/16383*c,m=m/16383*c,w=w/16383*c,l+=e,m+=f,w+=h,THREE.UTF8Loader.prototype.v(b,l,m,w)})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,m.push(e,f)})(g[0],8,3);(function(a,b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,l.push(e,f,g)})(g[0],8,5);(function(a){var c,e,f,g,h,k,x,u=a.length;for(c=0;c<u;c+=3)e=a[c],f=a[c+1],g=a[c+2],THREE.UTF8Loader.prototype.f3n(b,
|
|
|
-l,e,f,g,0,e,f,g),h=m[e*2],e=m[e*2+1],k=m[f*2],f=m[f*2+1],x=m[g*2],g=m[g*2+1],THREE.UTF8Loader.prototype.uv3(b.faceVertexUvs[0],h,e,k,f,x,g)})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3n:function(a,b,c,e,f,h,g,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],o=b[k*3+1],k=b[k*3+2],g=new THREE.Vector3(b[g*3],b[g*3+1],b[g*
|
|
|
-3+2]),j=new THREE.Vector3(l,m,j),k=new THREE.Vector3(n,o,k);a.faces.push(new THREE.Face3(c,e,f,[g,j,k],null,h))},uv3:function(a,b,c,e,f,h,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(e,f));j.push(new THREE.UV(h,g));a.push(j)},constructor:THREE.UTF8Loader};
|
|
|
+THREE.UTF8Loader.prototype.load=function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,f=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,g=a.offsetY!==void 0?a.offsetY:0,j=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,f,h,g,j):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)};
|
|
|
+THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,g=0;g<b;++g){var j=a.charCodeAt(g+e);h+=j>>1^-(j&1);c[8*g+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=g=0;f<b;f++)j=a.charCodeAt(f+e),h[f]=g-j,j==0&&g++;return[c,h]};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],m=[];(function(a,g,k){for(var l,m,x,y=a.length;k<y;k+=g)l=a[k],m=a[k+1],x=a[k+2],l=l/16383*c,m=m/16383*c,x=x/16383*c,l+=e,m+=f,x+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(l,m,x)))})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,m.push(e,f)})(g[0],8,3);(function(a,
|
|
|
+b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,l.push(e,f,g)})(g[0],8,5);(function(a){var c,e,f,g,h,k,w,t,z,B=a.length;for(c=0;c<B;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;t=e;z=f;k=g;w=e;var F=f,C=g,H=h.materials[0],G=l[F*3],L=l[F*3+1],F=l[F*3+2],A=l[C*3],D=l[C*3+1],C=l[C*3+2];w=new THREE.Vector3(l[w*3],l[w*3+1],l[w*3+2]);F=new THREE.Vector3(G,L,F);C=new THREE.Vector3(A,D,C);h.faces.push(new THREE.Face3(t,z,k,[w,F,C],null,H));h=m[e*2];e=m[e*2+
|
|
|
+1];k=m[f*2];w=m[f*2+1];t=m[g*2];z=m[g*2+1];g=b.faceVertexUvs[0];f=k;k=w;w=[];w.push(new THREE.UV(h,e));w.push(new THREE.UV(f,k));w.push(new THREE.UV(t,z));g.push(w)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
|
|
|
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,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j+g*this.delta;b[h+1]=k;b[h+2]=l;f[h]=this.lerp(m[a],m[a+3],g);f[h+1]=this.lerp(m[a+1],m[a+4],g);f[h+2]=this.lerp(m[a+2],m[a+5],g)};this.VIntY=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k+g*this.delta;b[h+
|
|
|
2]=l;b=a+this.yd*3;f[h]=this.lerp(m[a],m[b],g);f[h+1]=this.lerp(m[a+1],m[b+1],g);f[h+2]=this.lerp(m[a+2],m[b+2],g)};this.VIntZ=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+g*this.delta;b=a+this.zd*3;f[h]=this.lerp(m[a],m[b],g);f[h+1]=this.lerp(m[a+1],m[b+1],g);f[h+2]=this.lerp(m[a+2],m[b+2],g)};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,f,h,g,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,p=h+this.yd+this.zd,v=k+this.yd+this.zd,t=0,w=this.field[h],y=this.field[k],x=this.field[l],u=this.field[n],A=this.field[m],B=this.field[o],F=this.field[p],E=this.field[v];w<g&&(t|=1);y<g&&(t|=2);x<g&&(t|=8);u<g&&(t|=4);A<g&&(t|=16);B<g&&(t|=32);F<g&&(t|=128);E<g&&(t|=64);var H=THREE.edgeTable[t];if(H==0)return 0;var G=this.delta,
|
|
|
-M=a+G,z=b+G,G=f+G;H&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,w,y));H&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,g,M,b,f,y,u));H&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,z,f,x,u));H&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,w,x));H&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,g,a,b,G,A,B));H&32&&(this.compNorm(o),
|
|
|
-this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,g,M,b,G,B,E));H&64&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,18,g,a,z,G,F,E));H&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,g,a,b,G,A,F));H&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,w,A));H&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,g,M,b,f,y,B));H&1024&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*
|
|
|
-3,this.vlist,this.nlist,30,g,M,z,f,u,E));H&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,z,f,x,F));t<<=4;for(g=h=0;THREE.triTable[t+g]!=-1;)a=t+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],j),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,j){var k=this.count*3;this.positionArray[k]=a[f];this.positionArray[k+1]=a[f+1];this.positionArray[k+2]=a[f+2];this.positionArray[k+3]=a[h];this.positionArray[k+
|
|
|
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,g,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,p=h+this.yd+this.zd,v=k+this.yd+this.zd,u=0,x=this.field[h],y=this.field[k],w=this.field[l],t=this.field[n],z=this.field[m],B=this.field[o],F=this.field[p],C=this.field[v];x<g&&(u|=1);y<g&&(u|=2);w<g&&(u|=8);t<g&&(u|=4);z<g&&(u|=16);B<g&&(u|=32);F<g&&(u|=128);C<g&&(u|=64);var H=THREE.edgeTable[u];if(H==0)return 0;var G=this.delta,
|
|
|
+L=a+G,A=b+G,G=f+G;H&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,x,y));H&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,g,L,b,f,y,t));H&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,A,f,w,t));H&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,x,w));H&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,g,a,b,G,z,B));H&32&&(this.compNorm(o),
|
|
|
+this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,g,L,b,G,B,C));H&64&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,18,g,a,A,G,F,C));H&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,g,a,b,G,z,F));H&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,x,z));H&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,g,L,b,f,y,B));H&1024&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*
|
|
|
+3,this.vlist,this.nlist,30,g,L,A,f,t,C));H&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,A,f,w,F));u<<=4;for(g=h=0;THREE.triTable[u+g]!=-1;)a=u+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],j),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,j){var k=this.count*3;this.positionArray[k]=a[f];this.positionArray[k+1]=a[f+1];this.positionArray[k+2]=a[f+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[g];this.positionArray[k+7]=a[g+1];this.positionArray[k+8]=a[g+2];this.normalArray[k]=b[f];this.normalArray[k+1]=b[f+1];this.normalArray[k+2]=b[f+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[g];this.normalArray[k+7]=b[g+1];this.normalArray[k+8]=b[g+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,f,h,g){var j=this.size*Math.sqrt(h/g),k=f*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 o=Math.floor(l-j);o<1&&(o=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-j);p<1&&(p=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
|
|
|
-1);for(var v,t,w,y,x,u;n<k;n++){m=this.size2*n;t=n/this.size-f;x=t*t;for(t=o;t<l;t++){w=m+this.size*t;v=t/this.size-b;u=v*v;for(v=p;v<j;v++)y=v/this.size-a,y=h/(1.0E-6+y*y+u+x)-g,y>0&&(this.field[w+v]+=y)}}};this.addPlaneX=function(a,b){var f,h,g,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(f=0;f<p;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=f+h*m;for(g=0;g<l;g++)o[n*g+k]+=j}};this.addPlaneY=function(a,b){var f,h,g,j,k,l,m=this.size,n=this.yd,o=
|
|
|
+1);for(var v,u,x,y,w,t;n<k;n++){m=this.size2*n;u=n/this.size-f;w=u*u;for(u=o;u<l;u++){x=m+this.size*u;v=u/this.size-b;t=v*v;for(v=p;v<j;v++)y=v/this.size-a,y=h/(1.0E-6+y*y+t+w)-g,y>0&&(this.field[x+v]+=y)}}};this.addPlaneX=function(a,b){var f,h,g,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(f=0;f<p;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=f+h*m;for(g=0;g<l;g++)o[n*g+k]+=j}};this.addPlaneY=function(a,b){var f,h,g,j,k,l,m=this.size,n=this.yd,o=
|
|
|
this.zd,p=this.field,v=m*Math.sqrt(a/b);v>m&&(v=m);for(h=0;h<v;h++)if(f=h/m,f*=f,j=a/(1.0E-4+f)-b,j>0){k=h*n;for(f=0;f<m;f++){l=k+f;for(g=0;g<m;g++)p[o*g+l]+=j}}};this.addPlaneZ=function(a,b){var f,h,g,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(g=0;g<dist;g++)if(f=g/size,f*=f,j=a/(1.0E-4+f)-b,j>0){k=zd*g;for(h=0;h<size;h++){l=k+h*yd;for(f=0;f<size;f++)field[l+f]+=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,f,h,g,j,k,l,m,n,o=this.size-2;for(g=1;g<o;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(h=1;h<o;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(f=1;f<o;f++)j=(f-this.halfsize)/this.halfsize,b=m+f,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var g,j,k,l,m,n,o,p;for(g=0;g<h.count;g++)o=g*3,m=o+1,p=o+2,j=h.positionArray[o],
|
|
|
k=h.positionArray[m],l=h.positionArray[p],n=new THREE.Vector3(j,k,l),j=h.normalArray[o],k=h.normalArray[m],l=h.normalArray[p],o=new THREE.Vector3(j,k,l),o.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),f.push(o);nfaces=h.count/3;for(g=0;g<nfaces;g++)o=(a+g)*3,m=o+1,p=o+2,n=f[o],j=f[m],k=f[p],o=new THREE.Face3(o,m,p,[n,j,k]),b.faces.push(o);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
@@ -282,7 +282,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.Camera,h=new THREE.Camera,g=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;f.useTarget=h.useTarget=!1;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.Camera(53,1,1,1E4);p.position.z=
|
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
-var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.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 y=c.projectionMatrix.clone(),x=125/30*0.5,u=x*l/125,A=l*Math.tan(m*Math.PI/360),B;g.n14=x;j.n14=-x;x=-A*k+u;B=A*k+u;y.n11=2*l/(B-x);y.n13=(B+x)/(B-x);f.projectionMatrix=y.clone();x=-A*k-u;B=A*k-u;y.n11=2*l/(B-x);
|
|
|
-y.n13=(B+x)/(B-x);h.projectionMatrix=y.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(c.position);f.near=l;f.far=c.far;e.call(b,a,f,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;e.call(b,a,h,o,!0);e.call(b,v,p)}};
|
|
|
+var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.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 y=c.projectionMatrix.clone(),w=125/30*0.5,t=w*l/125,z=l*Math.tan(m*Math.PI/360),B;g.n14=w;j.n14=-w;w=-z*k+t;B=z*k+t;y.n11=2*l/(B-w);y.n13=(B+w)/(B-w);f.projectionMatrix=y.clone();w=-z*k-t;B=z*k-t;y.n11=2*l/(B-w);
|
|
|
+y.n13=(B+w)/(B-w);h.projectionMatrix=y.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(c.position);f.near=l;f.far=c.far;e.call(b,a,f,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;e.call(b,a,h,o,!0);e.call(b,v,p)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,g=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);f=a/2;h=e};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=c.far;
|
|
|
g.updateProjectionMatrix();g.position.copy(c.position);g.target.position.copy(c.target.position);g.translateX(b.separation);j.projectionMatrix=g.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,f,h);e.call(b,a,g);this.setViewport(f,0,f,h);e.call(b,a,j,!1)}};
|