diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2012-05-15 15:14:50 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2012-05-15 15:14:50 +0400 |
commit | 763a16cb70ca223babd9862a329c7f1c536b167d (patch) | |
tree | 9204ffd5414e881d27f908054b8d3e923f0dfa05 /source/blender/modifiers/intern | |
parent | 8107130854c0ff6b4406c92e926fa51253ad39d1 (diff) |
Cloth:
- Triangulate Cloth Mesh for collisions
- Speed up collisions
- Remove EL Topo code
- Prepare code to incooperate El Topo self collisions (TODO next commits)
TODO:
----------
- Triangulation: Is custom data/uv preserved correctly?
- Use MPoly not tessface?
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_cloth.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 2c38bc42a8f..72e5d792e1f 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -67,10 +67,10 @@ static void initData(ModifierData *md) cloth_init(clmd); } -static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], - int UNUSED(numVerts), ModifierApplyFlag UNUSED(flag)) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *dm, + ModifierApplyFlag UNUSED(flag)) { - DerivedMesh *dm; ClothModifierData *clmd = (ClothModifierData *) md; DerivedMesh *result = NULL; @@ -79,25 +79,20 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, initData(md); if (!clmd->sim_parms || !clmd->coll_parms) - return; + return dm; } - dm = get_dm(ob, NULL, derivedData, NULL, 0); - if (dm == derivedData) - dm = CDDM_copy(dm); - - CDDM_apply_vert_coords(dm, vertexCos); - DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ - clothModifier_do(clmd, md->scene, ob, dm, vertexCos); + result = clothModifier_do(clmd, md->scene, ob, dm); - if (result) { - result->getVertCos(result, vertexCos); - result->release(result); + if(result) + { + CDDM_calc_normals(result); + return result; } - dm->release(dm); + return dm; } static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Object *ob, DagNode *obNode) @@ -205,17 +200,17 @@ ModifierTypeInfo modifierType_Cloth = { /* name */ "Cloth", /* structName */ "ClothModifierData", /* structSize */ sizeof(ClothModifierData), - /* type */ eModifierTypeType_OnlyDeform, + /* type */ eModifierTypeType_Constructive, /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_UsesPointCache | eModifierTypeFlag_Single, /* copyData */ copyData, - /* deformVerts */ deformVerts, + /* deformVerts */ NULL, /* deformMatrices */ NULL, /* deformVertsEM */ NULL, /* deformMatricesEM */ NULL, - /* applyModifier */ NULL, + /* applyModifier */ applyModifier, /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, |