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:
authorLuca Rood <dev@lucarood.com>2018-08-29 01:29:37 +0300
committerLuca Rood <dev@lucarood.com>2018-08-31 17:33:59 +0300
commite3d31b8dfbdc3f4412e12fa1594927098ed0654d (patch)
treeabc629afab10eca51ddc52a3d3550cfcc3291565 /source/blender/blenkernel/intern/cloth.c
parentec3357e03ab1cf3bad48b0460a62761aae206278 (diff)
Cloth: Componentize forces
This separates cloth stiffness and damping forces into tension, compression, and shearing components, allowing more control over the cloth behaviour. This also adds a bending model selector (although the new bending model itself is not implemented in this commit). This is because some of the features implemented here only make sense within the new bending model, while the old model is kept for compatibility. This commit makes non-breaking changes, and thus maintains full compatibility with existing simulations. Reviewed By: brecht Differential Revision: http://developer.blender.org/D3655
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index caf5b94b30e..54236785509 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -85,13 +85,18 @@ void cloth_init(ClothModifierData *clmd )
clmd->sim_parms->gravity[0] = 0.0;
clmd->sim_parms->gravity[1] = 0.0;
clmd->sim_parms->gravity[2] = -9.81;
- clmd->sim_parms->structural = 15.0;
- clmd->sim_parms->max_struct = 15.0;
- clmd->sim_parms->shear = 15.0;
+ clmd->sim_parms->tension = 15.0;
+ clmd->sim_parms->max_tension = 15.0;
+ clmd->sim_parms->compression = 15.0;
+ clmd->sim_parms->max_compression = 15.0;
+ clmd->sim_parms->shear = 5.0;
+ clmd->sim_parms->max_shear = 5.0;
clmd->sim_parms->bending = 0.5;
clmd->sim_parms->max_bend = 0.5;
+ clmd->sim_parms->tension_damp = 5.0;
+ clmd->sim_parms->compression_damp = 5.0;
+ clmd->sim_parms->shear_damp = 5.0;
clmd->sim_parms->bending_damping = 0.5;
- clmd->sim_parms->Cdis = 5.0;
clmd->sim_parms->Cvi = 1.0;
clmd->sim_parms->mass = 0.3f;
clmd->sim_parms->stepsPerFrame = 5;
@@ -134,6 +139,8 @@ void cloth_init(ClothModifierData *clmd )
clmd->sim_parms->voxel_cell_size = 0.1f;
+ clmd->sim_parms->bending_model = CLOTH_BENDING_ANGULAR;
+
if (!clmd->sim_parms->effector_weights)
clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
@@ -728,6 +735,9 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, Mesh *mesh )
if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) {
if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1)) {
verts->struct_stiff = dvert->dw [j].weight;
+ }
+
+ if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_shear-1)) {
verts->shear_stiff = dvert->dw [j].weight;
}