diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_evaluate.c | 4 |
2 files changed, 15 insertions, 6 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 + ***************************************************************************************/ diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 2b3051b766a..7b655b2d8fc 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -2392,9 +2392,7 @@ static float mesh_calc_poly_volume_centroid(const MPoly *mpoly, /* Calculate the 6x volume of the tetrahedron formed by the 3 vertices * of the triangle and the origin as the fourth vertex */ - float v_cross[3]; - cross_v3_v3v3(v_cross, v_pivot, v_step1); - const float tetra_volume = dot_v3v3(v_cross, v_step2); + const float tetra_volume = volume_tri_tetrahedron_signed_v3_6x(v_pivot, v_step1, v_step2); total_volume += tetra_volume; /* Calculate the centroid of the tetrahedron formed by the 3 vertices |