diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-11-17 21:44:42 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:08 +0300 |
commit | d031831a05b0717348df7747c251f623d0d61f55 (patch) | |
tree | 5e003e18c932f372e262f68eb0a6a5c3df7c654a /source/blender/blenkernel/intern/cloth.c | |
parent | 64a4d4ed2564e8a0dad6bfc1117812b2feabbfa8 (diff) |
Randomness factor for hair bending stiffness.
This helps to create some variation in a hair system, which can
otherwise become very uniform and boring. It's yet another confusing
setting in a system that should have been nodified, but only option for
now (broken windows ...)
Conflicts:
source/blender/blenkernel/intern/particle_system.c
source/blender/physics/intern/BPH_mass_spring.cpp
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 2b4cbf62bb8..98da1cf630d 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1072,15 +1072,15 @@ static void cloth_update_bending_targets(ClothModifierData *clmd) prev_mn = -1; for (search = cloth->springs; search; search = search->next) { ClothSpring *spring = search->link; - ClothHairRoot *hair_ij, *hair_kl; + ClothHairData *hair_ij, *hair_kl; bool is_root = spring->kl != prev_mn; if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) { continue; } - hair_ij = &clmd->roots[spring->ij]; - hair_kl = &clmd->roots[spring->kl]; + hair_ij = &clmd->hairdata[spring->ij]; + hair_kl = &clmd->hairdata[spring->kl]; if (is_root) { /* initial hair frame from root orientation */ copy_m3_m3(hair_frame, hair_ij->rot); @@ -1144,15 +1144,15 @@ static void cloth_update_bending_rest_targets(ClothModifierData *clmd) prev_mn = -1; for (search = cloth->springs; search; search = search->next) { ClothSpring *spring = search->link; - ClothHairRoot *hair_ij, *hair_kl; + ClothHairData *hair_ij, *hair_kl; bool is_root = spring->kl != prev_mn; if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) { continue; } - hair_ij = &clmd->roots[spring->ij]; - hair_kl = &clmd->roots[spring->kl]; + hair_ij = &clmd->hairdata[spring->ij]; + hair_kl = &clmd->hairdata[spring->kl]; if (is_root) { /* initial hair frame from root orientation */ copy_m3_m3(hair_frame, hair_ij->rot); @@ -1198,6 +1198,16 @@ static void cloth_update_springs( ClothModifierData *clmd ) else if (spring->type == CLOTH_SPRING_TYPE_BENDING) { spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; } + else if (spring->type == CLOTH_SPRING_TYPE_BENDING_ANG) { + ClothVertex *v1 = &cloth->verts[spring->ij]; + ClothVertex *v2 = &cloth->verts[spring->kl]; + if (clmd->hairdata) { + /* copy extra hair data to generic cloth vertices */ + v1->bend_stiff = clmd->hairdata[spring->ij].bending_stiffness; + v2->bend_stiff = clmd->hairdata[spring->kl].bending_stiffness; + } + spring->stiffness = (v1->bend_stiff + v2->bend_stiff) / 2.0f; + } else if (spring->type == CLOTH_SPRING_TYPE_GOAL) { /* Warning: Appending NEW goal springs does not work because implicit solver would need reset! */ |