fix t53701 minimal changes to get it working right

This commit is contained in:
Jens Ole Wund(bjornmose) 2018-01-10 01:51:04 +01:00
parent 0f6ed7d111
commit 9aada45e52
Notes: blender-bot 2023-02-14 06:21:59 +01:00
Referenced by issue #53701, softbody self collision fails with more than one thread
1 changed files with 2 additions and 8 deletions

View File

@ -2013,7 +2013,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
float compare;
float bstune = sb->ballstiff;
for (c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
/* running in a slice we must not assume anything done with obp neither alter the data of obp */
for (c=sb->totpoint, obp= sb->bpoint; c>0; c--, obp++) {
compare = (obp->colball + bp->colball);
sub_v3_v3v3(def, bp->pos, obp->pos);
/* rather check the AABBoxes before ever calulating the real distance */
@ -2038,13 +2039,6 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
madd_v3_v3fl(bp->force, def, f * (1.0f - sb->balldamp));
madd_v3_v3fl(bp->force, dvel, sb->balldamp);
/* exploit force(a, b) == -force(b, a) part2/2 */
sub_v3_v3v3(dvel, velcenter, obp->vec);
mul_v3_fl(dvel, _final_mass(ob, bp));
madd_v3_v3fl(obp->force, dvel, sb->balldamp);
madd_v3_v3fl(obp->force, def, -f * (1.0f - sb->balldamp));
}
}
}