Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-03-22 12:30:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-03-22 12:30:00 +0300
commit1e9bf0cfdb6c925b28af6f0330467e7d9d798c05 (patch)
treec8356d8bc812dc6e3f23b9c381e94ec4c9d4c879 /source/blender/blenkernel/intern/softbody.c
parent9b2dd9aac65aa49c05176bb8b7aabde9fe1aeeac (diff)
spaces -> tabs, (4 spaces == 1 tab, only for white space preceding text)
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r--source/blender/blenkernel/intern/softbody.c144
1 files changed, 72 insertions, 72 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 4b19e71dfca..e6f500aab15 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -123,7 +123,7 @@ typedef struct SBScratch {
typedef struct SB_thread_context {
Scene *scene;
- Object *ob;
+ Object *ob;
float forcetime;
float timenow;
int ifirst;
@@ -191,7 +191,7 @@ static float sb_time_scale(Object *ob)
/*hrms .. this could be IPO as well :)
estimated range [0.001 sluggish slug - 100.0 very fast (i hope ODE solver can handle that)]
1 approx = a unit 1 pendulum at g = 9.8 [earth conditions] has period 65 frames
- theory would give a 50 frames period .. so there must be something inaccurate .. looking for that (BM)
+ theory would give a 50 frames period .. so there must be something inaccurate .. looking for that (BM)
*/
}
return (1.0f);
@@ -280,7 +280,7 @@ typedef struct ccd_Mesh {
static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
{
- ccd_Mesh *pccd_M = NULL;
+ ccd_Mesh *pccd_M = NULL;
ccdf_minmax *mima =NULL;
MFace *mface=NULL;
float v[3],hull;
@@ -299,17 +299,17 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
pccd_M->mprevvert=NULL;
- /* blow it up with forcefield ranges */
+ /* blow it up with forcefield ranges */
hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
/* alloc and copy verts*/
pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
+ /* ah yeah, put the verices to global coords once */
/* and determine the ortho BB on the fly */
for(i=0; i < pccd_M->totvert; i++){
mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
- /* evaluate limits */
+ /* evaluate limits */
VECCOPY(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
@@ -321,10 +321,10 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
}
/* alloc and copy faces*/
- pccd_M->mface = dm->dupFaceArray(dm);
+ pccd_M->mface = dm->dupFaceArray(dm);
/* OBBs for idea1 */
- pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
+ pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
mima = pccd_M->mima;
mface = pccd_M->mface;
@@ -334,7 +334,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
- VECCOPY(v,pccd_M->mvert[mface->v1].co);
+ VECCOPY(v,pccd_M->mvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -342,7 +342,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- VECCOPY(v,pccd_M->mvert[mface->v2].co);
+ VECCOPY(v,pccd_M->mvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -377,7 +377,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
}
static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
{
- ccdf_minmax *mima =NULL;
+ ccdf_minmax *mima =NULL;
MFace *mface=NULL;
float v[3],hull;
int i;
@@ -393,20 +393,20 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
- /* blow it up with forcefield ranges */
+ /* blow it up with forcefield ranges */
hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
/* rotate current to previous */
if(pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
- pccd_M->mprevvert = pccd_M->mvert;
+ pccd_M->mprevvert = pccd_M->mvert;
/* alloc and copy verts*/
- pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
+ pccd_M->mvert = dm->dupVertArray(dm);
+ /* ah yeah, put the verices to global coords once */
/* and determine the ortho BB on the fly */
for(i=0; i < pccd_M->totvert; i++){
mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
- /* evaluate limits */
+ /* evaluate limits */
VECCOPY(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
@@ -416,7 +416,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
- /* evaluate limits */
+ /* evaluate limits */
VECCOPY(v,pccd_M->mprevvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
@@ -437,7 +437,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
- VECCOPY(v,pccd_M->mvert[mface->v1].co);
+ VECCOPY(v,pccd_M->mvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -445,7 +445,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- VECCOPY(v,pccd_M->mvert[mface->v2].co);
+ VECCOPY(v,pccd_M->mvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -472,7 +472,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
}
- VECCOPY(v,pccd_M->mprevvert[mface->v1].co);
+ VECCOPY(v,pccd_M->mprevvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -480,7 +480,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- VECCOPY(v,pccd_M->mprevvert[mface->v2].co);
+ VECCOPY(v,pccd_M->mprevvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -667,7 +667,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
}
}
- /* now we can announce new springs */
+ /* now we can announce new springs */
ob->soft->totspring += nofquads *2;
}
}
@@ -703,7 +703,7 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
}
else {printf("oops we should not get here - add_2nd_order_springs");}
}
- if (bpo){/* so now we have a 2nd order humpdidump */
+ if (bpo){/* so now we have a 2nd order humpdidump */
for(c=bpo->nofsprings;c>0;c--){
bs2 = sb->bspring + bpo->springs[c-1];
if ((bs2->v1 != notthis) && (bs2->v1 > v0)){
@@ -711,7 +711,7 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
if (addsprings){
bs3->v1= v0;
bs3->v2= bs2->v1;
- bs3->springtype =SB_BEND;
+ bs3->springtype =SB_BEND;
bs3++;
}
}
@@ -720,7 +720,7 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
if (addsprings){
bs3->v1= v0;
bs3->v2= bs2->v2;
- bs3->springtype =SB_BEND;
+ bs3->springtype =SB_BEND;
bs3++;
}
@@ -1039,7 +1039,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1068,7 +1068,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye
}
/* so now we have the 2 boxes overlapping */
- /* forces actually not used */
+ /* forces actually not used */
deflected = 2;
}
@@ -1114,7 +1114,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1205,7 +1205,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1396,11 +1396,11 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
for(a=0; a<sb->scratch->totface; a++, bf++) {
if (( bf->flag & BFF_INTERSECT) || ( bf->flag & BFF_CLOSEVERT))
{
- sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
- sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
- sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
+ sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
+ sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
+ sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
if (bf->v4){
- sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
+ sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
}
}
}
@@ -1433,7 +1433,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1583,7 +1583,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
add_v3_v3v3(bs->ext_force,bs->ext_force,feedback);
bs->flag |= BSF_INTERSECT;
//bs->cf=damp;
- bs->cf=sb->choke*0.01f;
+ bs->cf=sb->choke*0.01f;
}
}
@@ -1690,8 +1690,8 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
}
else
sb_threads[i].ifirst = 0;
- sb_threads[i].do_effector = do_effector;
- sb_threads[i].do_deflector = 0;// not used here
+ sb_threads[i].do_effector = do_effector;
+ sb_threads[i].do_deflector = 0;// not used here
sb_threads[i].fieldfactor = 0.0f;// not used here
sb_threads[i].windfactor = 0.0f;// not used here
sb_threads[i].nr= i;
@@ -1707,7 +1707,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
}
else
exec_scan_for_ext_spring_forces(&sb_threads[0]);
- /* clean up */
+ /* clean up */
MEM_freeN(sb_threads);
pdEndEffectors(&do_effector);
@@ -1722,7 +1722,7 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
int winner =1;
mindist = ABS(dot_v3v3(pos,a));
- cp = ABS(dot_v3v3(pos,b));
+ cp = ABS(dot_v3v3(pos,b));
if ( mindist < cp ){
mindist = cp;
winner =2;
@@ -1751,7 +1751,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
GHash *hash;
GHashIterator *ihash;
float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3],d_nvect[3], dv1[3],ve[3],avel[3]={0.0,0.0,0.0},
- vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
+ vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
outerforceaccu[3],innerforceaccu[3],
facedist,n_mag,force_mag_norm,minx,miny,minz,maxx,maxy,maxz,
innerfacethickness = -0.5f, outerfacethickness = 0.2f,
@@ -1764,7 +1764,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
outerforceaccu[0]=outerforceaccu[1]=outerforceaccu[2]=0.0f;
innerforceaccu[0]=innerforceaccu[1]=innerforceaccu[2]=0.0f;
/* go */
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1815,7 +1815,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
fa = (ff*outerfacethickness-outerfacethickness);
fa *= fa;
fa = 1.0f/fa;
- avel[0]=avel[1]=avel[2]=0.0f;
+ avel[0]=avel[1]=avel[2]=0.0f;
/* use mesh*/
while (a--) {
if (
@@ -1938,7 +1938,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
VECADD(avel,avel,ve);
cavel ++;
}
- *intrusion += facedist;
+ *intrusion += facedist;
ci++;
}
@@ -1948,7 +1948,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
float dist;
closest_to_line_segment_v3(ve, opco, nv1, nv2);
- VECSUB(ve,opco,ve);
+ VECSUB(ve,opco,ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )){
VECCOPY(coledge,ve);
@@ -1957,7 +1957,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
}
closest_to_line_segment_v3(ve, opco, nv2, nv3);
- VECSUB(ve,opco,ve);
+ VECSUB(ve,opco,ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )){
VECCOPY(coledge,ve);
@@ -1966,7 +1966,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
}
closest_to_line_segment_v3(ve, opco, nv3, nv1);
- VECSUB(ve,opco,ve);
+ VECSUB(ve,opco,ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )){
VECCOPY(coledge,ve);
@@ -2181,11 +2181,11 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* intitialize */
if (sb) {
/* check conditions for various options */
- /* +++ could be done on object level to squeeze out the last bits of it */
+ /* +++ could be done on object level to squeeze out the last bits of it */
do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF));
do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL);
do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
- /* --- could be done on object level to squeeze out the last bits of it */
+ /* --- could be done on object level to squeeze out the last bits of it */
}
else {
printf("Error expected a SB here \n");
@@ -2207,14 +2207,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* naive ball self collision */
/* needs to be done if goal snaps or not */
if(do_selfcollision){
- int attached;
+ int attached;
BodyPoint *obp;
BodySpring *bs;
int c,b;
float velcenter[3],dvel[3],def[3];
float distance;
float compare;
- float bstune = sb->ballstiff;
+ float bstune = sb->ballstiff;
for(c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
compare = (obp->colball + bp->colball);
@@ -2222,7 +2222,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* rather check the AABBoxes before ever calulating the real distance */
/* mathematically it is completly nuts, but performace is pretty much (3) times faster */
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 ){
/* exclude body points attached with a spring */
attached = 0;
@@ -2363,7 +2363,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bp->choke = bs->cf;
}
- // sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
+ // sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
sb_spring_force(ob,ilast-bb,bs,iks,forcetime,0);
}/* loop springs */
}/* existing spring list */
@@ -2377,7 +2377,7 @@ return 0; /*done fine*/
static void *exec_softbody_calc_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
- _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor);
+ _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor);
return 0;
}
@@ -2398,7 +2398,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
totthread--;
}
- /* printf("sb_cf_threads_run spawning %d threads \n",totthread); */
+ /* printf("sb_cf_threads_run spawning %d threads \n",totthread); */
sb_threads= MEM_callocN(sizeof(SB_thread_context)*totthread, "SBThread");
memset(sb_threads, 0, sizeof(SB_thread_context)*totthread);
@@ -2416,8 +2416,8 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
}
else
sb_threads[i].ifirst = 0;
- sb_threads[i].do_effector = do_effector;
- sb_threads[i].do_deflector = do_deflector;
+ sb_threads[i].do_effector = do_effector;
+ sb_threads[i].do_deflector = do_deflector;
sb_threads[i].fieldfactor = fieldfactor;
sb_threads[i].windfactor = windfactor;
sb_threads[i].nr= i;
@@ -2435,7 +2435,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
}
else
exec_softbody_calc_forces(&sb_threads[0]);
- /* clean up */
+ /* clean up */
MEM_freeN(sb_threads);
}
@@ -2904,12 +2904,12 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
float maxerrpos= 0.0f,maxerrvel = 0.0f;
int a,fuzzy=0;
- forcetime *= sb_time_scale(ob);
+ forcetime *= sb_time_scale(ob);
- aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
- aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
+ aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
+ aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
- /* old one with homogenous masses */
+ /* old one with homogenous masses */
/* claim a minimum mass for vertex */
/*
if (sb->nodemass > 0.009999f) timeovermass = forcetime/sb->nodemass;
@@ -2920,11 +2920,11 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* now we have individual masses */
/* claim a minimum mass for vertex */
if (_final_mass(ob,bp) > 0.009999f) timeovermass = forcetime/_final_mass(ob,bp);
- else timeovermass = forcetime/0.009999f;
+ else timeovermass = forcetime/0.009999f;
if(_final_goal(ob,bp) < SOFTGOALSNAP){
- /* this makes t~ = t */
+ /* this makes t~ = t */
if(mid_flags & MID_PRESERVE) VECCOPY(dx,bp->vec);
/* so here is (v)' = a(cceleration) = sum(F_springs)/m + gravitation + some friction forces + more forces*/
@@ -2952,7 +2952,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
}
else {VECADD(bp->vec, bp->vec, bp->force);}
- /* this makes t~ = t+dt */
+ /* this makes t~ = t+dt */
if(!(mid_flags & MID_PRESERVE)) VECCOPY(dx,bp->vec);
/* so here is (x)'= v(elocity) */
@@ -2969,7 +2969,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
bp->frozen =MIN2(bp->frozen*1.05f,1.0f);
}
mul_v3_fl(dx,bp->frozen);
- */
+ */
/* again some nasty if's to have heun in here too */
if (mode ==1){
VECCOPY(bp->prevpos,bp->pos);
@@ -3102,12 +3102,12 @@ static void softbody_swap_state(Object *ob,float *ppos,float *pvel)
VECCOPY(temp, bp->vec);
VECCOPY(bp->vec,pv);
- VECCOPY(pv,temp);
+ VECCOPY(pv,temp);
pv+=3;
VECCOPY(temp, bp->pos);
VECCOPY(bp->pos,pp);
- VECCOPY(pp,temp);
+ VECCOPY(pp,temp);
pp+=3;
}
}
@@ -3185,7 +3185,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time)
/* ************ convertors ********** */
/* for each object type we need;
- - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry
+ - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry
*/
static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex, float *target)
@@ -3294,7 +3294,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* this is where '2.5 every thing is animateable' goes wrong in the first place jow_go_for2_5 */
/* 1st coding action to take : move this to frame level */
/* reads: leave the bp->goal as it was read from vertex group / or default .. we will need it at per frame call */
- /* should be fixed for meshes */
+ /* should be fixed for meshes */
// bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */
}
else{
@@ -3358,7 +3358,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
build_bps_springlist(ob); /* yes we need to do it again*/
}
springs_from_mesh(ob); /* write the 'rest'-lenght of the springs */
- if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
+ if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
}
@@ -3515,7 +3515,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
if (ob->softflag & OB_SB_EDGES){
totspring = ((lt->pntsu -1) * lt->pntsv
- + (lt->pntsv -1) * lt->pntsu) * lt->pntsw
+ + (lt->pntsv -1) * lt->pntsu) * lt->pntsw
+lt->pntsu*lt->pntsv*(lt->pntsw -1);
if (ob->softflag & OB_SB_QUADS){
totspring += 4*(lt->pntsu -1) * (lt->pntsv -1) * (lt->pntsw-1);
@@ -4110,7 +4110,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
if(sb->totpoint==0) {
return;
}
- if(framenr == startframe) {
+ if(framenr == startframe) {
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
/* first frame, no simulation to do, just set the positions */