Recompute measures & gradients only when needed
Currently measures and gradients are computed every frame.
Gradients need to be recomputed only when the corresponding UI values change.
Measures need to be recomputed only when the WoT state or the gradients change.