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/physics/intern/implicit_blender.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/physics/intern/implicit_blender.c')
-rw-r--r--source/blender/physics/intern/implicit_blender.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c
index d8b3f647591..fa093f482f7 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -1469,6 +1469,7 @@ void BPH_mass_spring_force_face_wind(
/* calculate face normal and area */
area = calc_nor_area_tri(nor, data->X[v1], data->X[v2], data->X[v3]);
+ /* The force is calculated and split up evenly for each of the three face verts */
factor = effector_scale * area / 3.0f;
world_to_root_v3(data, v1, win, winvec[v1]);
@@ -1481,6 +1482,29 @@ void BPH_mass_spring_force_face_wind(
madd_v3_v3fl(data->F[v3], nor, factor * dot_v3v3(win, nor));
}
+float BPH_tri_tetra_volume_signed_6x(Implicit_Data *data, int v1, int v2, int v3)
+{
+ /* The result will be 6x the volume */
+ return volume_tri_tetrahedron_signed_v3_6x(data->X[v1], data->X[v2], data->X[v3]);
+}
+
+void BPH_mass_spring_force_pressure(
+ Implicit_Data *data, int v1, int v2, int v3, float pressure_difference)
+{
+ float nor[3], area;
+ float factor;
+
+ /* calculate face normal and area */
+ area = calc_nor_area_tri(nor, data->X[v1], data->X[v2], data->X[v3]);
+ /* The force is calculated and split up evenly for each of the three face verts */
+ factor = pressure_difference * area / 3.0f;
+
+ /* add pressure to each of the face verts */
+ madd_v3_v3fl(data->F[v1], nor, factor);
+ madd_v3_v3fl(data->F[v2], nor, factor);
+ madd_v3_v3fl(data->F[v3], nor, factor);
+}
+
static void edge_wind_vertex(const float dir[3],
float length,
float radius,