diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-11-16 16:59:33 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:08 +0300 |
commit | 674c98bd06a8d3752d750fb659b98ff5b9a238d8 (patch) | |
tree | 03509daa8e1537fa95c125b86a5fcf44d5197652 /source/blender/blenkernel/intern/cloth.c | |
parent | 52384179f4c5153a62d711d326a7f6a877508dbb (diff) |
Nicer hashing functionality for sim debugging using a variadic macro
to support multiple hash identifiers.
Using explicit hashing functions for every sim debug call defeats the
purpose of having a quick feedback system. Now this can be done simply
by passing an arbitrary number of hash inputs (integers) at the end of
the function calls, which are then combined by a system of variadic
macros (based on the ELEM feature). Up to 8 identifiers are supported
currently, but more could be added easily if needed.
Conflicts:
source/blender/blenkernel/intern/particle_system.c
source/blender/physics/intern/BPH_mass_spring.cpp
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 09239a79d6c..2b4cbf62bb8 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -61,36 +61,6 @@ static void cloth_update_springs( ClothModifierData *clmd ); static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ); static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ); -/* ==== hash functions for debugging ==== */ -BLI_INLINE unsigned int hash_int_2d(unsigned int kx, unsigned int ky) -{ -#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) - - unsigned int a, b, c; - - a = b = c = 0xdeadbeef + (2 << 2) + 13; - a += kx; - b += ky; - - c ^= b; c -= rot(b,14); - a ^= c; a -= rot(c,11); - b ^= a; b -= rot(a,25); - c ^= b; c -= rot(b,16); - a ^= c; a -= rot(c,4); - b ^= a; b -= rot(a,14); - c ^= b; c -= rot(b,24); - - return c; - -#undef rot -} - -BLI_INLINE int hash_vertex(int type, int vertex) -{ - return hash_int_2d((unsigned int)type, (unsigned int)vertex); -} -/* ================ */ - /****************************************************************************** * * External interface called by modifier.c clothModifier functions. @@ -1129,16 +1099,16 @@ static void cloth_update_bending_targets(ClothModifierData *clmd) float a[3], b[3]; copy_v3_v3(a, cloth->verts[spring->kl].x); -// BKE_sim_debug_data_add_dot(clmd->debug_data, cloth_vert ? cloth_vert->x : key->co, 1, 1, 0, "frames", hash_vertex(8246, hash_int_2d(p, k))); +// BKE_sim_debug_data_add_dot(clmd->debug_data, cloth_vert ? cloth_vert->x : key->co, 1, 1, 0, "frames", 8246, p, k); mul_v3_v3fl(b, hair_frame[0], clmd->sim_parms->avg_spring_len); - BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 1, 0, 0, "frames", hash_vertex(8247, hash_int_2d(spring->kl, spring->mn))); + BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 1, 0, 0, "frames", 8247, spring->kl, spring->mn); mul_v3_v3fl(b, hair_frame[1], clmd->sim_parms->avg_spring_len); - BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 1, 0, "frames", hash_vertex(8248, hash_int_2d(spring->kl, spring->mn))); + BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 1, 0, "frames", 8248, spring->kl, spring->mn); mul_v3_v3fl(b, hair_frame[2], clmd->sim_parms->avg_spring_len); - BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 0, 1, "frames", hash_vertex(8249, hash_int_2d(spring->kl, spring->mn))); + BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 0, 1, "frames", 8249, spring->kl, spring->mn); } #endif |