New: Collision Modifier and Cloth can be at any position on the modifier stack. BUT everytime the vertices count change, they will free themselves and internal build new (they rely on vertex count). Should be no problem anymore with e.g. subsurf modifier before collision modifier (tested). Fix: applied a patch from schlaile to get my bullet additions compiled with gcc 3.3
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user