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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-09-01 19:46:17 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2015-01-20 11:29:56 +0300
commit1ed88bb24e13f7d911de708e5b2479a937734183 (patch)
tree4d8e7ba536ab50c1eb53c0b19112e0f017dc24e0 /source/blender/blenkernel/intern/effect.c
parentd8cf12fe5a18309e968ffc3b326d70554013b5a7 (diff)
Partial response force for hair collisions.
This implements a penalty force as well as a repulsion force to avoid further penetration, as suggested in "Simulating Complex Hair with Robust Collision Handling" (http://graphics.snu.ac.kr/publications/2005-choe-HairSim/Choe_2005_SCA.pdf) Friction forces are still missing. More problematic is handling of moving colliders, when face swap places with the hair vertex and a collision is missed, putting the vertex inside the mesh volume. Larger margins might help, but ultimately using Bullet collision detection is probably more reliable and failsafe.
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r--source/blender/blenkernel/intern/effect.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 94b4af10201..0cbd7376e4f 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1072,7 +1072,11 @@ static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem)
void BKE_sim_debug_data_add_dot(struct SimDebugData *debug_data, const float p[3], float r, float g, float b, int hash)
{
- SimDebugElement *elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
+ SimDebugElement *elem;
+ if (!debug_data)
+ return;
+
+ elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
elem->type = SIM_DEBUG_ELEM_DOT;
elem->hash = hash;
elem->color[0] = r;
@@ -1085,7 +1089,11 @@ void BKE_sim_debug_data_add_dot(struct SimDebugData *debug_data, const float p[3
void BKE_sim_debug_data_add_line(struct SimDebugData *debug_data, const float p1[3], const float p2[3], float r, float g, float b, int hash)
{
- SimDebugElement *elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
+ SimDebugElement *elem;
+ if (!debug_data)
+ return;
+
+ elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
elem->type = SIM_DEBUG_ELEM_LINE;
elem->hash = hash;
elem->color[0] = r;
@@ -1099,7 +1107,11 @@ void BKE_sim_debug_data_add_line(struct SimDebugData *debug_data, const float p1
void BKE_sim_debug_data_add_vector(struct SimDebugData *debug_data, const float p[3], const float d[3], float r, float g, float b, int hash)
{
- SimDebugElement *elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
+ SimDebugElement *elem;
+ if (!debug_data)
+ return;
+
+ elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
elem->type = SIM_DEBUG_ELEM_VECTOR;
elem->hash = hash;
elem->color[0] = r;
@@ -1111,6 +1123,16 @@ void BKE_sim_debug_data_add_vector(struct SimDebugData *debug_data, const float
debug_data_insert(debug_data, elem);
}
+void BKE_sim_debug_data_remove(SimDebugData *debug_data, int hash)
+{
+ SimDebugElement dummy;
+ if (!debug_data)
+ return;
+
+ dummy.hash = hash;
+ BLI_ghash_remove(debug_data->gh, &dummy, NULL, debug_element_free);
+}
+
void BKE_sim_debug_data_clear(SimDebugData *debug_data)
{
if (!debug_data)