forked from bartvdbraak/blender
Particle effector falloff maxdist etc. didn't work like it was supposed to.
This commit is contained in:
parent
5031fe982e
commit
6121d4b9fe
@ -298,24 +298,22 @@ static float wind_func(struct RNG *rng, float strength)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* maxdist: zero effect from this distance outwards (if usemax) */
|
||||||
|
/* mindist: full effect up to this distance (if usemin) */
|
||||||
|
/* power: falloff with formula 1/r^power */
|
||||||
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
|
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
|
||||||
{
|
{
|
||||||
if(!usemin)
|
/* first quick checks */
|
||||||
mindist= 0.0f;
|
if(usemax && fac > maxdist)
|
||||||
|
|
||||||
if(fac < mindist) {
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
else if(usemax) {
|
|
||||||
if(fac>maxdist || (maxdist-mindist)<=0.0f)
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
fac= (fac-mindist)/(maxdist-mindist);
|
if(usemin && fac < mindist)
|
||||||
return 1.0f - (float)pow((double)fac, (double)power);
|
return 1.0f;
|
||||||
}
|
|
||||||
else
|
if(!usemin)
|
||||||
return pow((double)1.0f+fac-mindist, (double)-power);
|
mindist = 0.0;
|
||||||
|
|
||||||
|
return pow((double)1.0+fac-mindist, (double)-power);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float falloff_func_dist(PartDeflect *pd, float fac)
|
static float falloff_func_dist(PartDeflect *pd, float fac)
|
||||||
|
Loading…
Reference in New Issue
Block a user