diff options
author | kwolekr <kwolekr@minetest.net> | 2014-12-09 00:48:00 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-12-09 00:50:58 -0500 |
commit | 941d000fc62fd07cc058f6bc663a56843dc8591e (patch) | |
tree | d385cbd7f05aa75858d2918fcefb64f891fb1140 | |
parent | 29b413b376d42c27bf1f7065c9f7c850b61f3f24 (diff) | |
download | minetest-941d000fc62fd07cc058f6bc663a56843dc8591e.tar.gz minetest-941d000fc62fd07cc058f6bc663a56843dc8591e.tar.bz2 minetest-941d000fc62fd07cc058f6bc663a56843dc8591e.zip |
Noise: Update Noise::resizeNoiseBuf to account for lacunarity not equal to 2
-rw-r--r-- | src/noise.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/noise.cpp b/src/noise.cpp index 3fedf357f..57938bd06 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -400,15 +400,15 @@ void Noise::resizeNoiseBuf(bool is3d) float ofactor; //maximum possible spread value factor - ofactor = (float)(1 << (np->octaves - 1)); + ofactor = pow(np->lacunarity, np->octaves - 1); //noise lattice point count //(int)(sz * spread * ofactor) is # of lattice points crossed due to length // + 2 for the two initial endpoints // + 1 for potentially crossing a boundary due to offset - nlx = (int)(sx * ofactor / np->spread.X) + 3; - nly = (int)(sy * ofactor / np->spread.Y) + 3; - nlz = is3d ? (int)(sz * ofactor / np->spread.Z) + 3 : 1; + nlx = (int)ceil(sx * ofactor / np->spread.X) + 3; + nly = (int)ceil(sy * ofactor / np->spread.Y) + 3; + nlz = is3d ? (int)ceil(sz * ofactor / np->spread.Z) + 3 : 1; delete[] noise_buf; try { |