From 48e67c49a5951d20643533958dc28705cfe476e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Fri, 26 Sep 2014 17:25:21 +0200 Subject: Added separate damping for bending springs. The bend damping factor was hardcoded to the same value as the stiffness. Now it has its own factor in the settings and button in hair dynamics. --- source/blender/physics/intern/BPH_mass_spring.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/blender/physics/intern/BPH_mass_spring.cpp') diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp index 0138178b722..6a768f10d11 100644 --- a/source/blender/physics/intern/BPH_mass_spring.cpp +++ b/source/blender/physics/intern/BPH_mass_spring.cpp @@ -410,7 +410,10 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, s->flags |= CLOTH_SPRING_FLAG_NEEDED; scaling = parms->bending + s->stiffness * fabsf(parms->max_bend - parms->bending); - cb = kb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON)); + kb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON)); + + scaling = parms->bending_damping; + cb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON)); BPH_mass_spring_force_spring_bending(data, s->ij, s->kl, s->matrix_ij_kl, s->restlen, kb, cb, s->f, s->dfdx, s->dfdv); #endif @@ -422,7 +425,10 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, s->flags |= CLOTH_SPRING_FLAG_NEEDED; scaling = parms->bending + s->stiffness * fabsf(parms->max_bend - parms->bending); - cb = kb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON)); + kb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON)); + + scaling = parms->bending_damping; + cb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON)); /* XXX assuming same restlen for ij and jk segments here, this can be done correctly for hair later */ BPH_mass_spring_force_spring_bending_angular(data, s->ij, s->kl, s->mn, s->matrix_ij_kl, s->matrix_kl_mn, s->matrix_ij_mn, s->target, kb, cb); -- cgit v1.2.3