fix(viz): volume rendering fps drop with box crop
Description
In some apps, the frame rate drops drastically as soon as the box crop is used.
Steps to reproduce
- Open an app with two volume renderings, or build and run SightViewer with this patch
- Switch to the split views
- Observe the camera movement is smooth
- Enable the box crop
- Move several faces of the box
- Observe the frame rate drops down
Functional specifications
The frame rate should stay identical.
Technical specifications
This occurs because we enter an infinite signal/slot loop between the two renderers because they use the same clipping matrix. When one volume modifies the clipping matrix, it sends a signal received by the other one, which applies it, and then informs that the clipping matrix is modified. Thus volume_render::update_clipping_box()
is constantly called.
I propose to solve the logic error by not relying on update_clipping_matrix() indirection to apply the clipping, and simply calling the clipping function directly in update_clipping_box() after updating the box widget. Thus the signal will not be sent again on the receiver, breaking the loop.
Test plan
See Steps to reproduce