Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/softbody.c
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| /* since this is definitely the most CPU consuming task here .. try to spread it */ | /* since this is definitely the most CPU consuming task here .. try to spread it */ | ||||
| /* core function _softbody_calc_forces_slice_in_a_thread */ | /* core function _softbody_calc_forces_slice_in_a_thread */ | ||||
| /* result is int to be able to flag user break */ | /* result is int to be able to flag user break */ | ||||
| Context not available. | |||||
| int number_of_points_here = ilast - ifirst; | int number_of_points_here = ilast - ifirst; | ||||
| SoftBody *sb= ob->soft; /* is supposed to be there */ | SoftBody *sb= ob->soft; /* is supposed to be there */ | ||||
| BodyPoint *bp; | BodyPoint *bp; | ||||
| /* intitialize */ | /* intitialize */ | ||||
| if (sb) { | if (sb) { | ||||
| /* check conditions for various options */ | /* check conditions for various options */ | ||||
| Context not available. | |||||
| } | } | ||||
| /* debugerin */ | /* debugerin */ | ||||
| bp = &sb->bpoint[ifirst]; | bp = &sb->bpoint[ifirst]; | ||||
| for (bb=number_of_points_here; bb>0; bb--, bp++) { | for (bb=number_of_points_here; bb>0; bb--, bp++) { | ||||
| /* clear forces accumulator */ | /* clear forces accumulator */ | ||||
| Context not available. | |||||
| float distance; | float distance; | ||||
| float compare; | float compare; | ||||
| float bstune = sb->ballstiff; | float bstune = sb->ballstiff; | ||||
| for (c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) { | for (c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) { | ||||
| compare = (obp->colball + bp->colball); | compare = (obp->colball + bp->colball); | ||||
| sub_v3_v3v3(def, bp->pos, obp->pos); | sub_v3_v3v3(def, bp->pos, obp->pos); | ||||
| Context not available. | |||||
| /* mathematically it is completly nuts, but performance is pretty much (3) times faster */ | /* mathematically it is completly nuts, but performance is pretty much (3) times faster */ | ||||
| if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue; | if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue; | ||||
| distance = normalize_v3(def); | distance = normalize_v3(def); | ||||
| if (distance < compare ) { | if (distance < compare){ // skip also overlapping body points by using a minimum distance (demolition) | ||||
| /* exclude body points attached with a spring */ | /* exclude body points attached with a spring */ | ||||
| attached = 0; | attached = 0; | ||||
| for (b=obp->nofsprings;b>0;b--) { | for (b=obp->nofsprings;b>0;b--) { | ||||
| Context not available. | |||||
| if (sb->bpoint == NULL || | if (sb->bpoint == NULL || | ||||
| ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) | ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) | ||||
| { | { | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| mesh_to_softbody(scene, ob); | mesh_to_softbody(scene, ob); | ||||
| Context not available. | |||||