From 3290895156b25010912d6f1e59e59f6bf981d804 Mon Sep 17 00:00:00 2001 From: IceCreamYou Date: Sun, 15 Apr 2018 18:23:30 -0700 Subject: [PATCH] Bump version to 1.6.0 --- .gitignore | 2 ++ README.md | 2 +- bower.json | 2 +- build/THREE.Terrain.js | 2 +- build/THREE.Terrain.min.js | 4 ++-- package.json | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5f19d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +package-lock.json diff --git a/README.md b/README.md index 0197136..08e86df 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You then have access to the `THREE.Terrain` object. (Make sure the `three.js` library is loaded first.) The latest releases of this project have been tested with three.js -[r86](https://github.com/mrdoob/three.js/releases/tag/r86). +[r91](https://github.com/mrdoob/three.js/releases/tag/r91). ### Procedurally Generate a Terrain diff --git a/bower.json b/bower.json index 104d140..c7bba7b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "THREE.Terrain", - "version": "1.5.0", + "version": "1.6.0", "main": "build/THREE.Terrain.min.js", "ignore": [ "node_modules" diff --git a/build/THREE.Terrain.js b/build/THREE.Terrain.js index edf2425..71c46e1 100644 --- a/build/THREE.Terrain.js +++ b/build/THREE.Terrain.js @@ -1,5 +1,5 @@ /** - * THREE.Terrain.js 1.5.0-20180326 + * THREE.Terrain.js 1.6.0-20180415 * * @author Isaac Sukin (http://www.isaacsukin.com/) * @license MIT diff --git a/build/THREE.Terrain.min.js b/build/THREE.Terrain.min.js index eda573a..1cb233a 100644 --- a/build/THREE.Terrain.min.js +++ b/build/THREE.Terrain.min.js @@ -1,9 +1,9 @@ /** - * THREE.Terrain.js 1.5.0-20180326 + * THREE.Terrain.js 1.6.0-20180415 * * @author Isaac Sukin (http://www.isaacsukin.com/) * @license MIT */ !function(a){function b(a,b,c){this.x=a,this.y=b,this.z=c}function c(a){return a*a*a*(a*(6*a-15)+10)}function d(a,b,c){return(1-c)*a+c*b}var e=a.noise={};b.prototype.dot2=function(a,b){return this.x*a+this.y*b},b.prototype.dot3=function(a,b,c){return this.x*a+this.y*b+this.z*c};var f=[new b(1,1,0),new b(-1,1,0),new b(1,-1,0),new b(-1,-1,0),new b(1,0,1),new b(-1,0,1),new b(1,0,-1),new b(-1,0,-1),new b(0,1,1),new b(0,-1,1),new b(0,1,-1),new b(0,-1,-1)],g=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],h=new Array(512),i=new Array(512);e.seed=function(a){a>0&&a<1&&(a*=65536),a=Math.floor(a),a<256&&(a|=a<<8);for(var b=0;b<256;b++){var c;c=1&b?g[b]^255&a:g[b]^a>>8&255,h[b]=h[b+256]=c,i[b]=i[b+256]=f[c%12]}},e.seed(Math.random());var j=.5*(Math.sqrt(3)-1),k=(3-Math.sqrt(3))/6,l=1/3,m=1/6;e.simplex=function(a,b){var c,d,e,f=(a+b)*j,g=Math.floor(a+f),l=Math.floor(b+f),m=(g+l)*k,n=a-g+m,o=b-l+m,p,q;n>o?(p=1,q=0):(p=0,q=1);var r=n-p+k,s=o-q+k,t=n-1+2*k,u=o-1+2*k;g&=255,l&=255;var v=i[g+h[l]],w=i[g+p+h[l+q]],x=i[g+1+h[l+1]],y=.5-n*n-o*o;y<0?c=0:(y*=y,c=y*y*v.dot2(n,o));var z=.5-r*r-s*s;z<0?d=0:(z*=z,d=z*z*w.dot2(r,s));var A=.5-t*t-u*u;return A<0?e=0:(A*=A,e=A*A*x.dot2(t,u)),70*(c+d+e)},e.perlin=function(a,b){var e=Math.floor(a),f=Math.floor(b);a-=e,b-=f,e&=255,f&=255;var g=i[e+h[f]].dot2(a,b),j=i[e+h[f+1]].dot2(a,b-1),k=i[e+1+h[f]].dot2(a-1,b),l=i[e+1+h[f+1]].dot2(a-1,b-1),m=c(a);return d(d(g,k,m),d(j,l,m),c(b))}}(this),THREE.Terrain=function(a){var b={after:null,easing:THREE.Terrain.Linear,heightmap:THREE.Terrain.DiamondSquare,material:null,maxHeight:100,minHeight:-100,optimization:THREE.Terrain.NONE,frequency:2.5,steps:1,stretch:!0,turbulent:!1,useBufferGeometry:!1,xSegments:63,xSize:1024,ySegments:63,ySize:1024,_mesh:null};a=a||{};for(var c in b)b.hasOwnProperty(c)&&(a[c]=void 0===a[c]?b[c]:a[c]);a.material=a.material||new THREE.MeshBasicMaterial({color:15623731});var d=new THREE.Object3D;d.rotation.x=-.5*Math.PI;var e=a._mesh;if(e&&"PlaneGeometry"===e.geometry.type&&e.geometry.parameters.widthSegments===a.xSegments&&e.geometry.parameters.heightSegments===a.ySegments){e.material=a.material,e.scale.x=a.xSize/e.geometry.parameters.width,e.scale.y=a.ySize/e.geometry.parameters.height;for(var f=0,g=e.geometry.vertices.length;f1&&(THREE.Terrain.Step(c,b.steps),THREE.Terrain.Smooth(c,b)),THREE.Terrain.Clamp(c,b),"function"==typeof b.after&&b.after(c,b),a.geometry.verticesNeedUpdate=!0,a.geometry.normalsNeedUpdate=!0,a.geometry.computeBoundingSphere(),a.geometry.computeFaceNormals(),a.geometry.computeVertexNormals()},THREE.Terrain.NONE=0,THREE.Terrain.GEOMIPMAP=1,THREE.Terrain.GEOCLIPMAP=2,THREE.Terrain.POLYGONREDUCTION=3,THREE.Terrain.toArray2D=function(a,b){var c=new Array(b.xSegments),d=b.xSegments+1,e=b.ySegments+1,f,g;for(f=0;fg&&(g=a[i].z),a[i].zd&&(d=a[f].z);var g=d-c,h="number"!=typeof b.maxHeight?d:b.maxHeight,i="number"!=typeof b.minHeight?c:b.minHeight,j=b.stretch?h:di?c:i,l=j-k;for(j=0&&h+k>=0&&e+l=0&&j+k>=0&&g+l=0&&h+k>=0&&e+li&&(i=a[m].z))}var n=h*f+e;if("number"==typeof c){var o=.5*(i-j),p=j+o;i=p+o*c,j=p-o*c}d[n]=a[n].z>i?i:a[n].z=h[d].min&&l<=h[d].max){a[c].z=h[d].avg;break}}},THREE.Terrain.Turbulence=function(a,b){for(var c=b.maxHeight-b.minHeight,d=0,e=a.length;d=2;k/=2){var l=Math.round(.5*k),m=Math.round(k),n,o,p,q,r;for(f/=2,n=0;ng?a[o*n+m].z+=f:q<-g?a[o*n+m].z-=f:a[o*n+m].z+=Math.cos(q/g*Math.PI*2)*f}},THREE.Terrain.Hill=function(a,b,c,d){var e=2*b.frequency,f=e*e*10,g=b.maxHeight-b.minHeight,h=g/(e*e),i=g/e,j=Math.min(b.xSize,b.ySize),k=j/(e*e),l=j/e;c=c||THREE.Terrain.Influences.Hill;for(var m={x:0,y:0},n=0;nd)){var g=0,h=0,i=d,j=d,k=Math.floor(d/c),l=-k,m=-k;for(g=0;g<=i;g+=k){for(h=0;h<=j;h+=k){var n=h*i+g;if(f[n]=Math.random()*e,!(l<0&&m<0)){for(var o=f[n],p=f[h*i+(g-k)]||o,q=f[(h-k)*i+g]||o,r=f[(h-k)*i+(g-k)]||o,s=l;sMath.random())}else s=b.spread(j[r.a],q,r,m,o);if(s){if(r.normal.angleTo(l)>b.maxSlope)continue;var u=b.mesh.clone();if(u.position.copy(j[r.a]).add(j[r.b]).add(j[r.c]).divideScalar(3),b.maxTilt>0){var v=u.position.clone().add(r.normal);u.lookAt(v);var w=r.normal.angleTo(l);if(w>b.maxTilt){var x=b.maxTilt/w;u.rotation.x*=x,u.rotation.y*=x,u.rotation.z*=x}}if(u.rotation.x+=.5*Math.PI,u.rotateY(2*Math.random()*Math.PI),b.sizeVariance){var y=Math.random()*i-b.sizeVariance;u.scale.x=u.scale.z=1+y,u.scale.y+=y}k.push(u)}}var z,A;if(b.mesh.geometry instanceof THREE.Geometry){var B=new THREE.Geometry;for(z=0,A=k.length;zd)&&(g[h]=1);return function(){return g}},THREE.Terrain.Influences={Mesa:function(a){return 1.25*Math.min(.8,Math.exp(-a*a))},Hole:function(a){return-THREE.Terrain.Influences.Mesa(a)},Hill:function(a){return a<0?(a+1)*(a+1)*(3-2*(a+1)):1-a*a*(3-2*a)},Valley:function(a){return-THREE.Terrain.Influences.Hill(a)},Dome:function(a){return-(a+1)*(a-1)},Flat:function(a){return 0},Volcano:function(a){return.94-.32*(Math.abs(2*a)+Math.cos(2*Math.PI*Math.abs(a)+.4))}},THREE.Terrain.Influence=function(a,b,c,d,e,f,g,h,i){c=c||THREE.Terrain.Influences.Hill,d=void 0===d?.5:d,e=void 0===e?.5:e,f=void 0===f?64:f,g=void 0===g?64:g,h=void 0===h?THREE.NormalBlending:h,i=i||THREE.Terrain.EaseIn;for(var j=b.xSegments+1,k=b.ySegments+1,l=j*d,m=k*e,n=b.xSize/b.xSegments,o=b.ySize/b.ySegments,p=f/n,q=f/o,r=1/f,s=Math.ceil(l-p),t=Math.floor(l+p),u=Math.ceil(m-q),v=Math.floor(m+q),w=s;wf||void 0===a[y]||(h===THREE.AdditiveBlending?a[y].z+=F:h===THREE.SubtractiveBlending?a[y].z-=F:h===THREE.MultiplyBlending?a[y].z*=F:h===THREE.NoBlending?a[y].z=F:h===THREE.NormalBlending?a[y].z=i(C,D,E)*a[y].z+F:"function"==typeof h&&(a[y].z=h(a[y].z,F,C,D,E)))}}; -//# sourceMappingURL=THREE.Terrain.min.js.map \ No newline at end of file +//# sourceMappingURL=THREE.Terrain.min.js.map diff --git a/package.json b/package.json index 5dc1053..6659153 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "three.terrain.js", - "version": "1.5.0", + "version": "1.6.0", "description": "Extends the Three.js web-based 3D graphics framework to support generating random terrains and rendering terrain from predetermined heightmaps.", "homepage": "https://github.com/IceCreamYou/THREE.Terrain", "bugs": "https://github.com/IceCreamYou/THREE.Terrain/issues",