mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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) {
|
void SixenseManager::update(float deltaTime, bool jointsCaptured) {
|
||||||
if (!_activated) {
|
// FIXME - Some of the code in update() will crash if you haven't actually activated the
|
||||||
return;
|
// 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
|
#ifdef HAVE_SIXENSE
|
||||||
_buttonPressedMap.clear();
|
_buttonPressedMap.clear();
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,22 @@ UserInputMapper::~UserInputMapper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool UserInputMapper::registerDevice(uint16 deviceID, const DeviceProxy::Pointer& proxy){
|
int UserInputMapper::recordDeviceOfType(const QString& deviceName) {
|
||||||
proxy->_name += " (" + QString::number(deviceID) + ")";
|
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;
|
_registeredDevices[deviceID] = proxy;
|
||||||
return true;
|
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.
|
// GetFreeDeviceID should be called before registering a device to use an ID not used by a different device.
|
||||||
uint16 getFreeDeviceID() { return _nextFreeDeviceID++; }
|
uint16 getFreeDeviceID() { return _nextFreeDeviceID++; }
|
||||||
|
|
||||||
bool registerDevice(uint16 deviceID, const DeviceProxy::Pointer& device);
|
bool registerDevice(uint16 deviceID, const DeviceProxy::Pointer& device);
|
||||||
bool registerStandardDevice(const DeviceProxy::Pointer& device) { _standardDevice = device; return true; }
|
bool registerStandardDevice(const DeviceProxy::Pointer& device) { _standardDevice = device; return true; }
|
||||||
DeviceProxy::Pointer getDeviceProxy(const Input& input);
|
DeviceProxy::Pointer getDeviceProxy(const Input& input);
|
||||||
|
@ -285,6 +286,9 @@ protected:
|
||||||
std::vector<PoseValue> _poseStates = std::vector<PoseValue>(NUM_ACTIONS);
|
std::vector<PoseValue> _poseStates = std::vector<PoseValue>(NUM_ACTIONS);
|
||||||
|
|
||||||
glm::mat4 _sensorToWorldMat;
|
glm::mat4 _sensorToWorldMat;
|
||||||
|
|
||||||
|
int recordDeviceOfType(const QString& deviceName);
|
||||||
|
QHash<const QString&, int> _deviceCounts;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(UserInputMapper::InputPair)
|
Q_DECLARE_METATYPE(UserInputMapper::InputPair)
|
||||||
|
|
Loading…
Reference in a new issue