diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-08-18 23:32:21 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-08-18 23:32:21 +0400 |
commit | 17e42222306e8671fb8937594200d350abd127f4 (patch) | |
tree | 1667ab691576f36d0af598e36f7d24a2ace4dc8f /source/blender/blenkernel/intern/effect.c | |
parent | 8562efe8a3f25c68251b080cae8c8c7e936bf476 (diff) |
Little tweaks so 0 wind results in 0 noise, also removed double-mass dependancy in cloth
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 1ab8ab757ec..890e488efcd 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -315,12 +315,12 @@ float effector_falloff(PartDeflect *pd, float *eff_velocity, float *vec_to_part) return falloff; } -void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise) +void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor) { float mag_vec[3]={0,0,0}; float temp[3], temp2[3]; float eff_vel[3]; - float wind = 0; + float noise = 0; VecCopyf(eff_vel,eff_velocity); Normalize(eff_vel); @@ -329,11 +329,11 @@ void do_physical_effector(short type, float force_val, float distance, float fal case PFIELD_WIND: VECCOPY(mag_vec,eff_vel); - // add wind noise here - if(noise> 0.0f) - wind = wind_func(rng, noise); - - VecMulf(mag_vec,(force_val+wind)*falloff); + // add wind noise here, only if we have wind + if((noise_factor> 0.0f) && (force_val > FLT_EPSILON)) + noise = wind_func(rng, noise_factor); + + VecMulf(mag_vec,(force_val+noise)*falloff); VecAddf(field,field,mag_vec); break; |