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:
authorSebastian Parborg <darkdefende@gmail.com>2019-11-27 16:56:16 +0300
committerSebastian Parborg <darkdefende@gmail.com>2019-11-27 17:01:15 +0300
commitf6cefbef22c8c6583b4927c179dabac3eb57aa22 (patch)
tree96785e2ee93f34bb14975a53bc2a4e003ee3fb59 /source/blender/blenkernel/intern/cloth.c
parenteb798de101ac7946e2d719e763ad1f0fd3e26acd (diff)
Fix T30941: Add cloth air pressure simulation
This adds some basic simulation of internal air pressure inside of closed cloth mesh objects. Reviewed By: Jacques Lucke Differential Revision: http://developer.blender.org/D5473
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 463cbd4f378..2be312bc4d9 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -130,6 +130,11 @@ void cloth_init(ClothModifierData *clmd)
clmd->sim_parms->eff_force_scale = 1000.0;
clmd->sim_parms->eff_wind_scale = 250.0;
+ /* Pressure settings */
+ clmd->sim_parms->uniform_pressure_force = 0.0f;
+ clmd->sim_parms->target_volume = 0.0f;
+ clmd->sim_parms->pressure_factor = 1.0f;
+
// also from softbodies
clmd->sim_parms->maxgoal = 1.0f;
clmd->sim_parms->mingoal = 0.0f;
@@ -291,6 +296,12 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int
BKE_cloth_solver_set_positions(clmd);
+ ClothSimSettings *parms = clmd->sim_parms;
+ if (parms->flags & CLOTH_SIMSETTINGS_FLAG_PRESSURE &&
+ !(parms->flags & CLOTH_SIMSETTINGS_FLAG_PRESSURE_VOL)) {
+ BKE_cloth_solver_set_volume(clmd);
+ }
+
clmd->clothObject->last_frame = MINFRAME - 1;
clmd->sim_parms->dt = 1.0f / clmd->sim_parms->stepsPerFrame;
}
@@ -1742,6 +1753,6 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
return 1;
} /* cloth_build_springs */
-/***************************************************************************************
- * SPRING NETWORK GPU_BATCH_BUILDING IMPLEMENTATION END
- ***************************************************************************************/
+ /***************************************************************************************
+ * SPRING NETWORK GPU_BATCH_BUILDING IMPLEMENTATION END
+ ***************************************************************************************/