From 5afa4b1dc8aacdd17f72a2bcaccd53838107c229 Mon Sep 17 00:00:00 2001 From: Ish Bosamiya Date: Mon, 2 Mar 2020 10:52:58 -0300 Subject: Fix T65568: sewing and self collision issue As explained in T65568 by @LucaRood, the self collision system should exclude triangles that are connected by sewing springs. Differential Revision: https://developer.blender.org/D6911 --- source/blender/blenlib/BLI_ghash.h | 14 ++++++++++++++ source/blender/blenlib/intern/BLI_ghash_utils.c | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index eb926c51ba9..f59d9ea99d0 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -370,6 +370,20 @@ unsigned int BLI_ghashutil_uinthash_v4_murmur(const unsigned int key[4]); bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b); #define BLI_ghashutil_inthash_v4_cmp BLI_ghashutil_uinthash_v4_cmp +unsigned int BLI_ghashutil_uinthash_v2(const unsigned int key[2]); +#define BLI_ghashutil_inthash_v2(key) \ + (CHECK_TYPE_ANY(key, int *, const int *), BLI_ghashutil_uinthash_v2((const unsigned int *)key)) +#define BLI_ghashutil_inthash_v2_p ((GSetHashFP)BLI_ghashutil_uinthash_v2) +#define BLI_ghashutil_uinthash_v2_p ((GSetHashFP)BLI_ghashutil_uinthash_v2) +unsigned int BLI_ghashutil_uinthash_v2_murmur(const unsigned int key[2]); +#define BLI_ghashutil_inthash_v2_murmur(key) \ + (CHECK_TYPE_ANY(key, int *, const int *), \ + BLI_ghashutil_uinthash_v2_murmur((const unsigned int *)key)) +#define BLI_ghashutil_inthash_v2_p_murmur ((GSetHashFP)BLI_ghashutil_uinthash_v2_murmur) +#define BLI_ghashutil_uinthash_v2_p_murmur ((GSetHashFP)BLI_ghashutil_uinthash_v2_murmur) +bool BLI_ghashutil_uinthash_v2_cmp(const void *a, const void *b); +#define BLI_ghashutil_inthash_v2_cmp BLI_ghashutil_uinthash_v2_cmp + typedef struct GHashPair { const void *first; const void *second; diff --git a/source/blender/blenlib/intern/BLI_ghash_utils.c b/source/blender/blenlib/intern/BLI_ghash_utils.c index 63559da5bd7..abe5970b9a6 100644 --- a/source/blender/blenlib/intern/BLI_ghash_utils.c +++ b/source/blender/blenlib/intern/BLI_ghash_utils.c @@ -75,6 +75,7 @@ uint BLI_ghashutil_uinthash_v4(const uint key[4]) hash += key[3]; return hash; } + uint BLI_ghashutil_uinthash_v4_murmur(const uint key[4]) { return BLI_hash_mm2((const unsigned char *)key, sizeof(int) * 4 /* sizeof(key) */, 0); @@ -85,6 +86,25 @@ bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b) return (memcmp(a, b, sizeof(uint[4])) != 0); } +uint BLI_ghashutil_uinthash_v2(const uint key[2]) +{ + uint hash; + hash = key[0]; + hash *= 37; + hash += key[1]; + return hash; +} + +uint BLI_ghashutil_uinthash_v2_murmur(const uint key[2]) +{ + return BLI_hash_mm2((const unsigned char *)key, sizeof(int) * 2 /* sizeof(key) */, 0); +} + +bool BLI_ghashutil_uinthash_v2_cmp(const void *a, const void *b) +{ + return (memcmp(a, b, sizeof(uint[2])) != 0); +} + uint BLI_ghashutil_uinthash(uint key) { key += ~(key << 16); -- cgit v1.2.3