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:
authorCampbell Barton <ideasman42@gmail.com>2013-08-24 20:06:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-24 20:06:18 +0400
commit585272fbcf2a23d7491b229736d8de6234ab290b (patch)
tree8fef123f9fa44e95e040b1c0df1b1f46392a4e75 /source/blender/blenkernel/intern/cloth.c
parent1ba29c3a4adde1d9b9a70b9e84745dd0ec5f9c4e (diff)
cloth was using edgehash not quite correctly:
- was ordering vertex args unnecessarily. - was adding the same edges multiple times into the edgehash.
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r--source/blender/blenkernel/intern/cloth.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 1bf231ac218..e4c6f7790d7 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1223,7 +1223,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// check for existing spring
// check also if startpoint is equal to endpoint
if ((index2 != tspring2->ij) &&
- !BLI_edgehash_haskey(edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2)))
+ !BLI_edgehash_haskey(edgehash, tspring2->ij, index2))
{
spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
@@ -1283,16 +1283,18 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
}
}
+ /* note: the edges may already exist so run reinsert */
+
/* insert other near springs in edgehash AFTER bending springs are calculated (for selfcolls) */
for (i = 0; i < numedges; i++) { /* struct springs */
- BLI_edgehash_insert(edgehash, MIN2(medge[i].v1, medge[i].v2), MAX2(medge[i].v2, medge[i].v1), NULL);
+ BLI_edgehash_reinsert(edgehash, medge[i].v1, medge[i].v2, NULL);
}
for (i = 0; i < numfaces; i++) { /* edge springs */
if (mface[i].v4) {
- BLI_edgehash_insert(edgehash, MIN2(mface[i].v1, mface[i].v3), MAX2(mface[i].v3, mface[i].v1), NULL);
+ BLI_edgehash_reinsert(edgehash, mface[i].v1, mface[i].v3, NULL);
- BLI_edgehash_insert(edgehash, MIN2(mface[i].v2, mface[i].v4), MAX2(mface[i].v2, mface[i].v4), NULL);
+ BLI_edgehash_reinsert(edgehash, mface[i].v2, mface[i].v4, NULL);
}
}