Fix a problem with the YASim turbulence model. This change has been
coordinated with and approved by Andy. The lattice(x,y) arguments were being "WRAP()'d" but the WRAP() function didn't make sense. Instead it was forcing the value to zero if it was greater than the wrap limit. This was creating large areas of constant values in the perlin noise maps which resulted in a "constant" turbulence vector over time -- which is just weird. Andy couldn't see any reason why the values should be wrapped and couldn't remember any reason why the WRAP() function was set up like it was. Andy wanted me to make sure and mention that he was INSANE when he wrote that code (but now he's sane ... err, mostly.)
This commit is contained in:
parent
5566c79873
commit
a482465659
1 changed files with 4 additions and 6 deletions
|
@ -270,12 +270,10 @@ float Turbulence::iturb(unsigned int x, unsigned int y)
|
|||
xfrac = xfrac*xfrac*(3 - 2*xfrac); // ... as cubics
|
||||
yfrac = yfrac*yfrac*(3 - 2*yfrac);
|
||||
|
||||
#define WRAP(a) (a) >= wrapmax ? 0 : (a)
|
||||
float p00 = lattice(WRAP(xl), WRAP(yl)); // lattice values
|
||||
float p01 = lattice(WRAP(xl), WRAP(yl+1));
|
||||
float p10 = lattice(WRAP(xl+1), WRAP(yl));
|
||||
float p11 = lattice(WRAP(xl+1), WRAP(yl+1));
|
||||
#undef WRAP
|
||||
float p00 = lattice(xl, yl); // lattice values
|
||||
float p01 = lattice(xl, yl+1);
|
||||
float p10 = lattice(xl+1, yl);
|
||||
float p11 = lattice(xl+1, yl+1);
|
||||
|
||||
float p0 = p00 * (1-yfrac) + p01 * yfrac;
|
||||
float p1 = p10 * (1-yfrac) + p11 * yfrac;
|
||||
|
|
Loading…
Reference in a new issue