[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29456] trunk/blender/source/blender/ blenkernel: sofbody beziers may work nicer
Jens Ole Wund (bjornmose)
bjornmose at gmx.net
Tue Jun 15 01:56:12 CEST 2010
Revision: 29456
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29456
Author: bjornmose
Date: 2010-06-15 01:56:12 +0200 (Tue, 15 Jun 2010)
Log Message:
-----------
sofbody beziers may work nicer
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_softbody.h
trunk/blender/source/blender/blenkernel/intern/softbody.c
Modified: trunk/blender/source/blender/blenkernel/BKE_softbody.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_softbody.h 2010-06-14 19:14:21 UTC (rev 29455)
+++ trunk/blender/source/blender/blenkernel/BKE_softbody.h 2010-06-14 23:56:12 UTC (rev 29456)
@@ -1,6 +1,6 @@
/**
- * BKE_softbody.h
- *
+ * BKE_softbody.h
+ *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -43,7 +43,7 @@
int nofsprings; int *springs;
float choke,choke2,frozen;
float colball;
- short flag;
+ short loc_flag; //reserved by locale module specific states
//char octantflag;
float mass;
float springweight;
Modified: trunk/blender/source/blender/blenkernel/intern/softbody.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/softbody.c 2010-06-14 19:14:21 UTC (rev 29455)
+++ trunk/blender/source/blender/blenkernel/intern/softbody.c 2010-06-14 23:56:12 UTC (rev 29456)
@@ -1,5 +1,5 @@
-/* softbody.c
- *
+/* softbody.c
+ *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -32,17 +32,17 @@
******
variables on the UI for now
- float mediafrict; friction to env
- float nodemass; softbody mass of *vertex*
- float grav; softbody amount of gravitaion to apply
-
- float goalspring; softbody goal springs
- float goalfrict; softbody goal springs friction
- float mingoal; quick limits for goal
+ float mediafrict; friction to env
+ float nodemass; softbody mass of *vertex*
+ float grav; softbody amount of gravitaion to apply
+
+ float goalspring; softbody goal springs
+ float goalfrict; softbody goal springs friction
+ float mingoal; quick limits for goal
float maxgoal;
- float inspring; softbody inner springs
- float infrict; softbody inner springs friction
+ float inspring; softbody inner springs
+ float infrict; softbody inner springs friction
*****
*/
@@ -136,12 +136,12 @@
int tot;
}SB_thread_context;
-#define NLF_BUILD 1
-#define NLF_SOLVE 2
+#define NLF_BUILD 1
+#define NLF_SOLVE 2
#define MID_PRESERVE 1
-#define SOFTGOALSNAP 0.999f
+#define SOFTGOALSNAP 0.999f
/* if bp-> goal is above make it a *forced follow original* and skip all ODE stuff for this bp
removes *unnecessary* stiffnes from ODE system
*/
@@ -149,8 +149,12 @@
#define BSF_INTERSECT 1 /* edge intersects collider face */
-#define SBF_DOFUZZY 1 /* edge intersects collider face */
+/* private definitions for bodypoint states */
+#define SBF_DOFUZZY 1 /* Bodypoint do fuzzy */
+#define SBF_OUTOFCOLLISION 2 /* Bodypoint does not collide */
+
+
#define BFF_INTERSECT 1 /* collider edge intrudes face */
#define BFF_CLOSEVERT 2 /* collider vertex repulses face */
@@ -187,15 +191,15 @@
{
SoftBody *sb= ob->soft; /* is supposed to be there */
if (sb){
- return(sb->physics_speed);
- /*hrms .. this could be IPO as well :)
+ return(sb->physics_speed);
+ /*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);
- /*
+ /*
this would be frames/sec independant timing assuming 25 fps is default
but does not work very well with NLA
return (25.0f/scene->r.frs_sec)
@@ -206,10 +210,10 @@
/* helper functions for everything is animatable jow_go_for2_5 +++++++*/
/* introducing them here, because i know: steps in properties ( at frame timing )
will cause unwanted responses of the softbody system (which does inter frame calculations )
- so first 'cure' would be: interpolate linear in time ..
+ so first 'cure' would be: interpolate linear in time ..
Q: why do i write this?
A: because it happend once, that some eger coder 'streamlined' code to fail.
- We DO linear interpolation for goals .. and i think we should do on animated properties as well
+ We DO linear interpolation for goals .. and i think we should do on animated properties as well
*/
/* animate sb->maxgoal,sb->mingoal */
@@ -221,7 +225,7 @@
if(!(ob->softflag & OB_SB_GOAL)) return (0.0f);
if (sb&&bp){
if (bp->goal < 0.0f) return (0.0f);
- f = sb->mingoal + bp->goal*ABS(sb->maxgoal - sb->mingoal);
+ f = sb->mingoal + bp->goal*ABS(sb->maxgoal - sb->mingoal);
f = pow(f, 4.0f);
return (f);
}
@@ -247,15 +251,15 @@
/********************
for each target object/face the axis aligned bounding box (AABB) is stored
-faces paralell to global axes
+faces paralell to global axes
so only simple "value" in [min,max] ckecks are used
float operations still
*/
/* just an ID here to reduce the prob for killing objects
** ob->sumohandle points to we should not kill :)
-*/
-const int CCD_SAVETY = 190561;
+*/
+const int CCD_SAVETY = 190561;
typedef struct ccdf_minmax{
float minx,miny,minz,maxx,maxy,maxz;
@@ -285,11 +289,11 @@
MFace *mface=NULL;
float v[3],hull;
int i;
-
+
/* first some paranoia checks */
if (!dm) return NULL;
if (!dm->getNumVerts(dm) || !dm->getNumFaces(dm)) return NULL;
-
+
pccd_M = MEM_mallocN(sizeof(ccd_Mesh),"ccd_Mesh");
pccd_M->totvert = dm->getNumVerts(dm);
pccd_M->totface = dm->getNumFaces(dm);
@@ -297,32 +301,32 @@
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
pccd_M->mprevvert=NULL;
-
-
+
+
/* 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 */
- /* and determine the ortho BB on the fly */
+ /* 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 */
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);
pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
-
+
pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0],v[0]+hull);
pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
-
+
}
/* alloc and copy faces*/
pccd_M->mface = dm->dupFaceArray(dm);
-
+
/* OBBs for idea1 */
pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
mima = pccd_M->mima;
@@ -333,7 +337,7 @@
for(i=0; i < pccd_M->totface; i++){
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
-
+
VECCOPY(v,pccd_M->mvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -341,7 +345,7 @@
mima->maxx = MAX2(mima->maxx,v[0]+hull);
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
+
VECCOPY(v,pccd_M->mvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -349,7 +353,7 @@
mima->maxx = MAX2(mima->maxx,v[0]+hull);
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
+
VECCOPY(v,pccd_M->mvert[mface->v3].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -357,7 +361,7 @@
mima->maxx = MAX2(mima->maxx,v[0]+hull);
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
+
if(mface->v4){
VECCOPY(v,pccd_M->mvert[mface->v4].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
@@ -368,10 +372,10 @@
mima->maxz = MAX2(mima->maxz,v[2]+hull);
}
-
+
mima++;
mface++;
-
+
}
return pccd_M;
}
@@ -381,7 +385,7 @@
MFace *mface=NULL;
float v[3],hull;
int i;
-
+
/* first some paranoia checks */
if (!dm) return ;
if (!dm->getNumVerts(dm) || !dm->getNumFaces(dm)) return ;
@@ -391,27 +395,27 @@
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
-
-
+
+
/* 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;
/* alloc and copy verts*/
pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
- /* and determine the ortho BB on the fly */
+ /* 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 */
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);
pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
-
+
pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0],v[0]+hull);
pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
@@ -421,13 +425,13 @@
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
-
+
pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0],v[0]+hull);
pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
-
+
}
-
+
mima = pccd_M->mima;
mface = pccd_M->mface;
@@ -436,7 +440,7 @@
for(i=0; i < pccd_M->totface; i++){
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
-
+
VECCOPY(v,pccd_M->mvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -444,7 +448,7 @@
mima->maxx = MAX2(mima->maxx,v[0]+hull);
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
+
VECCOPY(v,pccd_M->mvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -452,7 +456,7 @@
mima->maxx = MAX2(mima->maxx,v[0]+hull);
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list