OpenMW-CS: axis markers highlighting is broken

Steps to reproduce:

  1. Open OpenMW-CS
  2. Open any cell in the scene 3D-editing widget
  3. Select any object
  4. Hover a mouse cursor over any marker. It becomes brighter.
  5. Switch editing mode to Rotate or Scale via button on the panel in the left part of the cell editing widget.

As a result, all axis markers remain bright, as they are all hovered by mouse.

This bug seems to be a regression from !5481 (merged).

If I understood correctly, different markers use shallow copies of the same state, and with SceneUtil::Material they have their own uniforms, which are not updated properly.

When we edit material, we just update its config:

void setEmission(const osg::Vec4f& emission) { mConfig.mEmission = emission; }

But when we recreate shaders, we seem to create a shallow copies of the stateset used. They have their own uniforms, and values from config are not propagated to them all.

There may be other cases affected by this issue, so it may be better to implement a general fix instead of a band-aid for markers.

image

This bug affects 0.52 branch.

Edited by Andrei Kortunov