Draft: CAVEInteraction: Refactor how valuator events are delivered to interactors
Valuator (aka "analog") events come from VRPN and VRUI as an array of data corresponding to the valuator channels on the device. Registration of valuator events in the CAVEInteraction plugin requires providing an id for each valuator, which corresponds to the index in the channel data where the event can be found. Since roles are bound to event names, which are composed of the id and user-defined name, when valuator events are delivered to the CAVE, we previously could not provide the associated role (since many roles may have corresponded to the union of all valuator channels).
This breaks up valuator events coming from VRPN and VRUI into individual events, one for each channel. By doing this, we can ensure that valuators are properly associated with the named roles defined in the interactor styles. Previously the vtkValuator
event struct looked like:
struct vtkValuator
{
int num_channels; // how many channels
double channel[VTK_VALUATOR_CHANNEL_MAX]; // channel diliever valuator values
};
And after this change, it has the following structure:
struct vtkValuator
{
int channel_id; // which channel
double channel_value; // valuator data value
};
Since this increases the number of events delivered to all vtkSMVRInteractorStyleProxy
subclass instances, this change also introduces filtering of events before delivery. After this, if an interactor style does not bind a named role for an event, the event will not be delivered to the interactor style.
Note (8/16/2024): Just doing some very rough performance comparison with and without this change, it seems this results in a pretty drastic reduction in interaction frame rate on my machine (more than 50%). That needs to be addressed before this can be merged. Actually, the slowdown was maybe instead due to building in Debug
rather than Release
.