diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-03-18 00:45:40 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-03-18 00:45:40 +0300 |
commit | 7c1a21c385ac8450e295f73a71f104ab17a076c5 (patch) | |
tree | ec0023481e755a9176c97bb2632c88ea9568db43 /source/blender/blenkernel/intern/collision.c | |
parent | db7457a6bb70aa4b9d10aff3638cea9cda25a2ce (diff) |
Collision Modifier/KDOP: Rearrange things to be more generic. Also fix possible crash if not enough memory there.
Diffstat (limited to 'source/blender/blenkernel/intern/collision.c')
-rw-r--r-- | source/blender/blenkernel/intern/collision.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index a1c49ac4655..f2200a24ea2 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -86,11 +86,6 @@ BVH *bvh_build_from_mvert (MFace *mfaces, unsigned int numfaces, MVert *x, unsig // in the moment, return zero if no faces there if(!numfaces) return NULL; - - bvh->flags = 0; - bvh->leaf_tree = NULL; - bvh->leaf_root = NULL; - bvh->tree = NULL; bvh->epsilon = epsilon; bvh->numfaces = numfaces; @@ -103,8 +98,7 @@ BVH *bvh_build_from_mvert (MFace *mfaces, unsigned int numfaces, MVert *x, unsig } bvh->numverts = numverts; - bvh->current_x = MEM_dupallocN(x); - bvh->current_xold = MEM_dupallocN(x); + bvh->current_x = MEM_dupallocN(x); bvh_build(bvh); @@ -975,10 +969,13 @@ int cloth_bvh_objcollisions_do(ClothModifierData * clmd, CollisionModifierData * if (collmd->tree) { + /* get pointer to bounding volume hierarchy */ BVH *coll_bvh = collmd->tree; - + + /* move object to position (step) in time */ collision_move_object(collmd, step + dt, step); - + + /* search for overlapping collision pairs */ bvh_traverse((ModifierData *)clmd, (ModifierData *)collmd, cloth_bvh->root, coll_bvh->root, step, cloth_collision_static, 0); } else |