mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
OpenXrInputPlugin: Use C++20 map iterators.
This commit is contained in:
parent
f75ef23da2
commit
ebbd4725d6
1 changed files with 13 additions and 13 deletions
|
@ -385,12 +385,12 @@ bool OpenXrInputPlugin::InputDevice::initActions() {
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
for (const auto& pathAndType : actionsToInit) {
|
for (const auto& [path, type] : actionsToInit) {
|
||||||
std::shared_ptr<Action> action = std::make_shared<Action>(_context, pathAndType.second, pathAndType.first);
|
std::shared_ptr<Action> action = std::make_shared<Action>(_context, type, path);
|
||||||
if (!action->init(_actionSet)) {
|
if (!action->init(_actionSet)) {
|
||||||
qCCritical(xr_input_cat, "Creating action %s failed!", pathAndType.first.c_str());
|
qCCritical(xr_input_cat, "Creating action %s failed!", path.c_str());
|
||||||
} else {
|
} else {
|
||||||
_actions.emplace(pathAndType.first, action);
|
_actions.emplace(path, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,12 +516,12 @@ void OpenXrInputPlugin::InputDevice::update(float deltaTime, const controller::I
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uint32_t i = 0; i < HAND_COUNT; i++) {
|
for (uint32_t i = 0; i < HAND_COUNT; i++) {
|
||||||
for (const auto& channelAndPath : axesToUpdate[i]) {
|
for (const auto& [channel, path] : axesToUpdate[i]) {
|
||||||
_axisStateMap[channelAndPath.first].value = _actions.at(channelAndPath.second)->getFloat(i).currentState;
|
_axisStateMap[channel].value = _actions.at(path)->getFloat(i).currentState;
|
||||||
|
|
||||||
// if (_axisStateMap[channelAndPath.first].value != 0) {
|
// if (_axisStateMap[channel].value != 0) {
|
||||||
// qCDebug(xr_input_cat, "🐸 Controller %d: %s (%d): %f", i, channelAndPath.second.c_str(), channelAndPath.first,
|
// qCDebug(xr_input_cat, "🐸 Controller %d: %s (%d): %f", i, path.c_str(), channel,
|
||||||
// (double)_axisStateMap[channelAndPath.first].value);
|
// (double)_axisStateMap[channel].value);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,10 +553,10 @@ void OpenXrInputPlugin::InputDevice::update(float deltaTime, const controller::I
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uint32_t i = 0; i < HAND_COUNT; i++) {
|
for (uint32_t i = 0; i < HAND_COUNT; i++) {
|
||||||
for (const auto& channelAndPath : buttonsToUpdate[i]) {
|
for (const auto& [channel, path] : buttonsToUpdate[i]) {
|
||||||
if (_actions.at(channelAndPath.second)->getBool(i).currentState == XR_TRUE) {
|
if (_actions.at(path)->getBool(i).currentState == XR_TRUE) {
|
||||||
_buttonPressedMap.insert(channelAndPath.first);
|
_buttonPressedMap.insert(channel);
|
||||||
// qCDebug(xr_input_cat, "🐸 Controller %d: %s (%d)", i, channelAndPath.second.c_str(), channelAndPath.first);
|
// qCDebug(xr_input_cat, "🐸 Controller %d: %s (%d)", i, path.c_str(), channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue