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:
authorDaniel Genrich <daniel.genrich@gmx.net>2008-08-18 23:32:21 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2008-08-18 23:32:21 +0400
commit17e42222306e8671fb8937594200d350abd127f4 (patch)
tree1667ab691576f36d0af598e36f7d24a2ace4dc8f /source/blender/blenkernel
parent8562efe8a3f25c68251b080cae8c8c7e936bf476 (diff)
Little tweaks so 0 wind results in 0 noise, also removed double-mass dependancy in cloth
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_effect.h2
-rw-r--r--source/blender/blenkernel/intern/effect.c14
-rw-r--r--source/blender/blenkernel/intern/implicit.c9
3 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 3b4c3198179..cc1c8c1d708 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -66,7 +66,7 @@ void pdEndEffectors(struct ListBase *lb);
void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags);
/* required for particle_system.c */
-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 effector_falloff(struct PartDeflect *pd, float *eff_velocity, float *vec_to_part);
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;
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 995ea666380..47853363e4b 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -1452,6 +1452,7 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec
float triunnormal[3]={0,0,0}; // not-normalized-triangle normal
float tmp[3]={0,0,0};
float factor = (mfaces[i].v4) ? 0.25 : 1.0 / 3.0;
+ factor *= 0.02;
// calculate face normal
if(mfaces[i].v4)
@@ -1465,24 +1466,24 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec
// add wind from v1
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v1], triunnormal));
- VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], tmp, factor*verts[mfaces[i].v1].mass);
+ VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], tmp, factor);
// add wind from v2
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v2], triunnormal));
- VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], tmp, factor*verts[mfaces[i].v2].mass);
+ VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], tmp, factor);
// add wind from v3
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v3], triunnormal));
- VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor*verts[mfaces[i].v3].mass);
+ VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
// add wind from v4
if(mfaces[i].v4)
{
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
- VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor*verts[mfaces[i].v4].mass);
+ VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor);
}
}
del_lfvector(winvec);