Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Romanov <a.romanov@blend4web.com>2017-07-03 19:49:35 +0300
committerAlexander Romanov <a.romanov@blend4web.com>2017-07-03 19:53:00 +0300
commite1482841dd5dd55cb453d37d115ec80f44c02316 (patch)
tree63cee90e2ab7b4316b4e36ffeb181700e99d6aab /source/blender/blenlib
parent1ad0cc6bde4746949eee7a9babb97178a05816c3 (diff)
parent1fb30758034c2f83862bb7fc5f30a1a4d7b4510b (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/noise.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index f834c5b4c74..347640aae0d 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -1394,6 +1394,11 @@ static float voronoi_CrS(float x, float y, float z)
/* returns unsigned cellnoise */
static float cellNoiseU(float x, float y, float z)
{
+ /* avoid precision issues on unit coordinates */
+ x = (x + 0.000001f)*0.999999f;
+ y = (y + 0.000001f)*0.999999f;
+ z = (z + 0.000001f)*0.999999f;
+
int xi = (int)(floor(x));
int yi = (int)(floor(y));
int zi = (int)(floor(z));
@@ -1411,6 +1416,11 @@ float cellNoise(float x, float y, float z)
/* returns a vector/point/color in ca, using point hasharray directly */
void cellNoiseV(float x, float y, float z, float ca[3])
{
+ /* avoid precision issues on unit coordinates */
+ x = (x + 0.000001f)*0.999999f;
+ y = (y + 0.000001f)*0.999999f;
+ z = (z + 0.000001f)*0.999999f;
+
int xi = (int)(floor(x));
int yi = (int)(floor(y));
int zi = (int)(floor(z));