mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
work on device names
This commit is contained in:
parent
4107f4ea9f
commit
46e40ed032
3 changed files with 26 additions and 5 deletions
|
@ -159,9 +159,12 @@ void SixenseManager::setSixenseFilter(bool filter) {
|
|||
}
|
||||
|
||||
void SixenseManager::update(float deltaTime, bool jointsCaptured) {
|
||||
if (!_activated) {
|
||||
return;
|
||||
}
|
||||
// FIXME - Some of the code in update() will crash if you haven't actually activated the
|
||||
// plugin. But we want register with the UserInputMapper if we don't call this.
|
||||
// We need to clean this up.
|
||||
//if (!_activated) {
|
||||
// return;
|
||||
//}
|
||||
#ifdef HAVE_SIXENSE
|
||||
_buttonPressedMap.clear();
|
||||
|
||||
|
|
|
@ -28,8 +28,22 @@ UserInputMapper::~UserInputMapper() {
|
|||
}
|
||||
|
||||
|
||||
bool UserInputMapper::registerDevice(uint16 deviceID, const DeviceProxy::Pointer& proxy){
|
||||
proxy->_name += " (" + QString::number(deviceID) + ")";
|
||||
int UserInputMapper::recordDeviceOfType(const QString& deviceName) {
|
||||
if (!_deviceCounts.contains(deviceName)) {
|
||||
_deviceCounts[deviceName] = 0;
|
||||
}
|
||||
_deviceCounts[deviceName] += 1;
|
||||
|
||||
return _deviceCounts[deviceName];
|
||||
}
|
||||
|
||||
bool UserInputMapper::registerDevice(uint16 deviceID, const DeviceProxy::Pointer& proxy) {
|
||||
int numberOfType = recordDeviceOfType(proxy->_name);
|
||||
|
||||
if (numberOfType > 1) {
|
||||
proxy->_name += QString::number(numberOfType);
|
||||
}
|
||||
|
||||
_registeredDevices[deviceID] = proxy;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public:
|
|||
};
|
||||
// GetFreeDeviceID should be called before registering a device to use an ID not used by a different device.
|
||||
uint16 getFreeDeviceID() { return _nextFreeDeviceID++; }
|
||||
|
||||
bool registerDevice(uint16 deviceID, const DeviceProxy::Pointer& device);
|
||||
bool registerStandardDevice(const DeviceProxy::Pointer& device) { _standardDevice = device; return true; }
|
||||
DeviceProxy::Pointer getDeviceProxy(const Input& input);
|
||||
|
@ -285,6 +286,9 @@ protected:
|
|||
std::vector<PoseValue> _poseStates = std::vector<PoseValue>(NUM_ACTIONS);
|
||||
|
||||
glm::mat4 _sensorToWorldMat;
|
||||
|
||||
int recordDeviceOfType(const QString& deviceName);
|
||||
QHash<const QString&, int> _deviceCounts;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(UserInputMapper::InputPair)
|
||||
|
|
Loading…
Reference in a new issue