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:
authorJens Ole Wund <bjornmose@gmx.net>2008-02-02 02:20:29 +0300
committerJens Ole Wund <bjornmose@gmx.net>2008-02-02 02:20:29 +0300
commitd09fe9d228ff82e61d8da50f1b18c790dcef6862 (patch)
tree8940d7d3dda70bce773fa8fa7d91095226912b1e /source/blender/blenkernel/intern/softbody.c
parent9d9ba570386a90285288daddcfcc5c399649585f (diff)
users feature request
-- material memory
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r--source/blender/blenkernel/intern/softbody.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index e23708aa328..0186fad5c13 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2913,7 +2913,6 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
VecMulf(dx,forcetime);
/* the freezer */
- /* disable slip stich for now
if ((Inpf(dx,dx)<freezeloc )&&(Inpf(bp->force,bp->force)<freezeforce )){
bp->frozen /=2;
}
@@ -2921,7 +2920,6 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
bp->frozen =MIN2(bp->frozen*1.05f,1.0f);
}
VecMulf(dx,bp->frozen);
- */
/* again some nasty if's to have heun in here too */
if (mode ==1){
@@ -3085,6 +3083,30 @@ static void softbody_apply_goalsnap(Object *ob)
}
}
+
+void apply_spring_memory(Object *ob)
+{
+ SoftBody *sb = ob->soft;
+ BodySpring *bs;
+ BodyPoint *bp1, *bp2;
+ int a;
+ float b,l,r;
+
+ b = sb->plastic;
+ if (sb && sb->totspring){
+ for(a=0; a<sb->totspring; a++) {
+ bs = &sb->bspring[a];
+ bp1 =&sb->bpoint[bs->v1];
+ bp2 =&sb->bpoint[bs->v2];
+ l = VecLenf(bp1->pos,bp2->pos);
+ r = bs->len/l;
+ if (( r > 1.05f) || (r < 0.95)){
+ bs->len = ((100.0f - b) * bs->len + b*l)/100.0f;
+ }
+ }
+ }
+}
+
/* expects full initialized softbody */
static void interpolate_exciter(Object *ob, int timescale, int time)
{
@@ -4372,6 +4394,7 @@ void sbObjectStep(Object *ob, float framenr, float (*vertexCos)[3], int numVerts
else{
printf("softbody no valid solver ID!");
}/*SOLVER SELECT*/
+ if(sb->plastic){ apply_spring_memory(ob);}
if(sb->solverflags & SBSO_MONITOR ){
sct=PIL_check_seconds_timer();