diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-22 15:42:03 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-25 14:35:41 +0300 |
commit | a99dcab148ed209409f3b2479ada12d869ae84b6 (patch) | |
tree | 2b7fc55752cbe3538fc05c8f77fd86b18a0d6df7 /source/blender/blenkernel/BKE_collision.h | |
parent | 5b3ff9f7d890554ae87e63095f24ac6d31a36d3c (diff) |
Depsgraph: cache collision relations, for performance and stability.
Same reasoning as effector relations in earlier commit.
Diffstat (limited to 'source/blender/blenkernel/BKE_collision.h')
-rw-r--r-- | source/blender/blenkernel/BKE_collision.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index 2392c92bd84..a488851513c 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -49,6 +49,7 @@ struct MFace; struct MVert; struct Object; struct Scene; +struct Depsgraph; struct MVertTri; //////////////////////////////////////// @@ -143,14 +144,29 @@ void collision_move_object(struct CollisionModifierData *collmd, float step, flo void collision_get_collider_velocity(float vel_old[3], float vel_new[3], struct CollisionModifierData *collmd, struct CollPair *collpair); -///////////////////////////////////////////////// -// used in effect.c -///////////////////////////////////////////////// -/* explicit control over layer mask and dupli recursion */ -struct Object **get_collisionobjects_ext(struct Scene *scene, struct Object *self, struct Collection *collection, unsigned int *numcollobj, unsigned int modifier_type, bool dupli); +/* Collision relations for dependency graph build. */ + +typedef struct CollisionRelation { + struct CollisionRelation *next, *prev; + struct Object *ob; +} CollisionRelation; + +struct ListBase *BKE_collision_relations_create( + struct Depsgraph *depsgraph, + struct Collection *collection, + unsigned int modifier_type); +void BKE_collision_relations_free(struct ListBase *relations); + +/* Collision object lists for physics simulation evaluation. */ -struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Collection *collection, unsigned int *numcollobj, unsigned int modifier_type); +struct Object **BKE_collision_objects_create( + struct Depsgraph *depsgraph, + struct Object *self, + struct Collection *collection, + unsigned int *numcollobj, + unsigned int modifier_type); +void BKE_collision_objects_free(struct Object **objects); typedef struct ColliderCache { struct ColliderCache *next, *prev; @@ -158,8 +174,11 @@ typedef struct ColliderCache { struct CollisionModifierData *collmd; } ColliderCache; -struct ListBase *get_collider_cache(struct Scene *scene, struct Object *self, struct Collection *collection); -void free_collider_cache(struct ListBase **colliders); +struct ListBase *BKE_collider_cache_create( + struct Depsgraph *scene, + struct Object *self, + struct Collection *collection); +void BKE_collider_cache_free(struct ListBase **colliders); ///////////////////////////////////////////////// |