From 419042af55ddb789f29771886e0bb090ad757cad Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 5 Sep 2011 16:25:42 +0000 Subject: [PATCH] Fix #28394: clouds texture error with high noise depth and blender original noise, patch from Campbell, --- source/blender/blenlib/intern/noise.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 9bc666dc971..9efe8dc9739 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -263,13 +263,21 @@ static float newPerlinU(float x, float y, float z) static float orgBlenderNoise(float x, float y, float z) { register float cn1, cn2, cn3, cn4, cn5, cn6, i, *h; - float ox, oy, oz, jx, jy, jz; + float fx, fy, fz, ox, oy, oz, jx, jy, jz; float n= 0.5; int ix, iy, iz, b00, b01, b10, b11, b20, b21; - ox= (x- (ix= (int)floor(x)) ); - oy= (y- (iy= (int)floor(y)) ); - oz= (z- (iz= (int)floor(z)) ); + fx= floor(x); + fy= floor(y); + fz= floor(z); + + ox= x- fx; + oy= y- fy; + oz= z- fz; + + ix= (int)fx; + iy= (int)fy; + iz= (int)fz; jx= ox-1; jy= oy-1;