Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -1989,11 +1989,13 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
- return (999);
- }
- -/* debugerin */
- +/* debugerin uncomment when there are doubts in the thread sheduler */
- +/*
- if (sb->totpoint < ifirst) {
- printf("Aye 998");
- return (998);
- }
- +*/
- /* debugerin */
- @@ -2005,15 +2007,15 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
- /* needs to be done if goal snaps or not */
- if (do_selfcollision) {
- int attached;
- - BodyPoint *obp;
- + BodyPoint *obp; /* read as Other Body Point */
- BodySpring *bs;
- int c, b;
- float velcenter[3], dvel[3], def[3];
- float distance;
- float compare;
- float bstune = sb->ballstiff;
- -
- - for (c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
- + /* we are threading here .. so .. needs to go all the way because we do not know which Other Body Points were touched */
- + 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 */
- @@ -2021,7 +2023,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
- if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
- distance = normalize_v3(def);
- if (distance < compare ) {
- - /* exclude body points attached with a spring */
- + /* exclude body points attached with a spring ( including bp itself ) */
- + /* we don't want to keep the solver busy pushing energy from one container to the other and back */
- attached = 0;
- for (b=obp->nofsprings;b>0;b--) {
- bs = sb->bspring + obp->springs[b-1];
- @@ -2039,12 +2042,9 @@ 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));
- + /* exploit force(a, b) == -force(b, a) nopes is not working when mesh is divided in threads ..
- + well .. not now .. may be someone thinks this over .. benefit would be 1/2 computing time
- + */
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement