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:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-10-07 13:27:11 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2016-10-07 21:47:00 +0300
commit0a2a006775543292786e8642b20a594771fdc81c (patch)
treea4691a5ef1775477db13dae13ee9d9dd80efa2bc /source/blender/blenkernel/intern/collision.c
parent2dccf5a6e881973858de2c230cb610a2ea3a03e1 (diff)
Collision: skip expensive BVH update if the collider doesn't move.
Since the collision modifier cannot be disabled, it causes a constant hit on the viewport animation playback FPS. Most of this overhead can be automatically removed in the case when the collider is static. The updates are only skipped when the collider was stationary during the preceding update as well, so the state is stored in a field. Knowing that the collider is static can also be used to disable similar BVH updates for substeps in the actual cloth simulation code. Differential Revision: https://developer.blender.org/D2277
Diffstat (limited to 'source/blender/blenkernel/intern/collision.c')
-rw-r--r--source/blender/blenkernel/intern/collision.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 35a7aafdbde..18ca1407ba0 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -71,6 +71,15 @@ void collision_move_object(CollisionModifierData *collmd, float step, float prev
float tv[3] = {0, 0, 0};
unsigned int i = 0;
+ /* the collider doesn't move this frame */
+ if (collmd->is_static) {
+ for (i = 0; i < collmd->mvert_num; i++) {
+ zero_v3(collmd->current_v[i].co);
+ }
+
+ return;
+ }
+
for (i = 0; i < collmd->mvert_num; i++) {
sub_v3_v3v3(tv, collmd->xnew[i].co, collmd->x[i].co);
VECADDS(collmd->current_x[i].co, collmd->x[i].co, tv, prevstep);