Advertisement
Guest User

Untitled

a guest
Jan 4th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. @@ -1989,11 +1989,13 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
  2. return (999);
  3. }
  4.  
  5. -/* debugerin */
  6. +/* debugerin uncomment when there are doubts in the thread sheduler */
  7. +/*
  8. if (sb->totpoint < ifirst) {
  9. printf("Aye 998");
  10. return (998);
  11. }
  12. +*/
  13. /* debugerin */
  14.  
  15.  
  16. @@ -2005,15 +2007,15 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
  17. /* needs to be done if goal snaps or not */
  18. if (do_selfcollision) {
  19. int attached;
  20. - BodyPoint *obp;
  21. + BodyPoint *obp; /* read as Other Body Point */
  22. BodySpring *bs;
  23. int c, b;
  24. float velcenter[3], dvel[3], def[3];
  25. float distance;
  26. float compare;
  27. float bstune = sb->ballstiff;
  28. -
  29. - for (c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
  30. + /* we are threading here .. so .. needs to go all the way because we do not know which Other Body Points were touched */
  31. + for (c=sb->totpoint, obp= sb->bpoint; c>0; c--, obp++) {
  32. compare = (obp->colball + bp->colball);
  33. sub_v3_v3v3(def, bp->pos, obp->pos);
  34. /* rather check the AABBoxes before ever calulating the real distance */
  35. @@ -2021,7 +2023,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
  36. if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
  37. distance = normalize_v3(def);
  38. if (distance < compare ) {
  39. - /* exclude body points attached with a spring */
  40. + /* exclude body points attached with a spring ( including bp itself ) */
  41. + /* we don't want to keep the solver busy pushing energy from one container to the other and back */
  42. attached = 0;
  43. for (b=obp->nofsprings;b>0;b--) {
  44. bs = sb->bspring + obp->springs[b-1];
  45. @@ -2039,12 +2042,9 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
  46. madd_v3_v3fl(bp->force, def, f * (1.0f - sb->balldamp));
  47. madd_v3_v3fl(bp->force, dvel, sb->balldamp);
  48.  
  49. - /* exploit force(a, b) == -force(b, a) part2/2 */
  50. - sub_v3_v3v3(dvel, velcenter, obp->vec);
  51. - mul_v3_fl(dvel, _final_mass(ob, bp));
  52. -
  53. - madd_v3_v3fl(obp->force, dvel, sb->balldamp);
  54. - madd_v3_v3fl(obp->force, def, -f * (1.0f - sb->balldamp));
  55. + /* exploit force(a, b) == -force(b, a) nopes is not working when mesh is divided in threads ..
  56. + well .. not now .. may be someone thinks this over .. benefit would be 1/2 computing time
  57. + */
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement