New: Collision Modifier and Cloth can be at any position on the modifier stack. BUT...
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 30 Jan 2008 14:01:05 +0000 (14:01 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 30 Jan 2008 14:01:05 +0000 (14:01 +0000)
extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
source/blender/blenkernel/intern/modifier.c

index d4f376128fcadcdaf91cce2b35a8937e8fd26ad4..248c582dcd8fa697070465acc5c77240d92c5b99 100644 (file)
@@ -53,10 +53,15 @@ subject to the following restrictions:
 extern "C"
 double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3])
 {
-       btTriangleShape trishapeA(btVector3(p1[0], p1[1], p1[2]), btVector3(p2[0], p2[1], p2[2]), btVector3(p3[0], p3[1], p3[2]));
+       btVector3 vp(p1[0], p1[1], p1[2]);
+       btTriangleShape trishapeA(vp, 
+                                 btVector3(p2[0], p2[1], p2[2]), 
+                                 btVector3(p3[0], p3[1], p3[2]));
        trishapeA.setMargin(0.000001f);
-       
-       btTriangleShape trishapeB(btVector3(q1[0], q1[1], q1[2]), btVector3(q2[0], q2[1], q2[2]), btVector3(q3[0], q3[1], q3[2]));
+       btVector3 vq(q1[0], q1[1], q1[2]);
+       btTriangleShape trishapeB(vq, 
+                                 btVector3(q2[0], q2[1], q2[2]), 
+                                 btVector3(q3[0], q3[1], q3[2]));
        trishapeB.setMargin(0.000001f);
        
        // btVoronoiSimplexSolver sGjkSimplexSolver;
index 2008291e51021720879dcacc2a3cd1343301213a..88123098b98e3dc0cbd79e0709e1d3ca46840bb0 100644 (file)
@@ -5178,6 +5178,8 @@ static void collisionModifier_deformVerts(
                                // TODO: epsilon
                                // create bounding box hierarchy
                                collmd->tree = bvh_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->x, numverts, ob->pd->pdef_sbift);
+                               
+                               collmd->time = current_time;
                        }
                        else if(numverts == collmd->numverts)
                        {
@@ -5207,9 +5209,14 @@ static void collisionModifier_deformVerts(
                                        // recalc static bounding boxes
                                        bvh_update_from_mvert(collmd->tree, collmd->current_x, numverts, NULL, 0);
                                }
+                               
+                               collmd->time = current_time;
+                       }
+                       else if(numverts != collmd->numverts)
+                       {
+                               collisionModifier_freeData((ModifierData *)collmd);
                        }
                        
-                       collmd->time = current_time;
                }
                else
                {       
@@ -7050,10 +7057,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti->type = eModifierTypeType_Nonconstructive;
                mti->initData = clothModifier_initData;
                mti->flags = eModifierTypeFlag_AcceptsMesh
-                               | eModifierTypeFlag_RequiresOriginalData;
-                                       // | eModifierTypeFlag_SupportsMapping
-                                       // | eModifierTypeFlag_SupportsEditmode 
-                                       // | eModifierTypeFlag_EnableInEditmode;
+                               | eModifierTypeFlag_UsesPointCache;
                mti->dependsOnTime = clothModifier_dependsOnTime;
                mti->freeData = clothModifier_freeData; 
                mti->requiredDataMask = clothModifier_requiredDataMask;
@@ -7064,8 +7068,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti = INIT_TYPE(Collision);
                mti->type = eModifierTypeType_OnlyDeform;
                mti->initData = collisionModifier_initData;
-               mti->flags = eModifierTypeFlag_AcceptsMesh 
-                               | eModifierTypeFlag_RequiresOriginalData;
+               mti->flags = eModifierTypeFlag_AcceptsMesh;
                mti->dependsOnTime = collisionModifier_dependsOnTime;
                mti->freeData = collisionModifier_freeData; 
                mti->deformVerts = collisionModifier_deformVerts;