Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Klimenko <peterklimk@outlook.com>2020-06-25 23:33:13 +0300
committerPeter Klimenko <peterklimk@outlook.com>2020-06-25 23:33:13 +0300
commit8e397f56a45d6e39ff5daa2d19cbf4370b9918ad (patch)
tree5e30b6fbdf489f40d4dff99afa88289f76c23ce9
parent5190beb5e9b70681662bf29a2f065399647ca69d (diff)
A few bug fixes.
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp1
-rw-r--r--intern/ghost/intern/GHOST_XrSession.cpp39
-rw-r--r--intern/ghost/intern/GHOST_XrSession.h6
3 files changed, 31 insertions, 15 deletions
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 8eeee3c8c9b..6c54afa3a11 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -966,6 +966,7 @@ int GHOST_XrSessionNeedsUpsideDownDrawing(const GHOST_XrContextHandle xr_context
GHOST_XR_CAPI_CALL_RET(xr_context->needsUpsideDownDrawing(), xr_context);
return 0; /* Only reached if exception is thrown. */
}
+
GHOST_XrPose GHOST_XrGetSpacePose(const GHOST_XrContextHandle xr_contexthandle, GHOST_XrSpace space)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp
index 1c6fadc84c4..3a0f6fe395a 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -25,6 +25,7 @@
#include <iterator>
#include <list>
#include <sstream>
+#include <tuple>
#include "GHOST_C-api.h"
@@ -111,7 +112,7 @@ void GHOST_XrSession::suggestBinding(XrAction handle,
XrPath profilePath = stringToPath(m_context->getInstance(), profile);
XrPath bindingPath = stringToPath(m_context->getInstance(), binding);
- m_oxr->actionData.interactionMap.at(profilePath).push_back(
+ m_oxr->actionData.interactionMap[profilePath].push_back(
XrActionSuggestedBinding{handle, bindingPath});
}
@@ -139,8 +140,7 @@ void GHOST_XrSession::bindAndAttachActions()
/* Push all action sets in the action set hashmap to a vector. */
std::vector<XrActionSet> actionSets;
- for (GHOST_XrActionSetMap::iterator it = actionSetMap.begin(); it != actionSetMap.end();
- it++) {
+ for (GHOST_XrActionSetMap::iterator it = actionSetMap.begin(); it != actionSetMap.end(); it++) {
actionSets.push_back(it->second.handle);
}
@@ -165,7 +165,9 @@ GHOST_XrAction &GHOST_XrActionSet::createAction(GHOST_XrActionCreateInfo info)
XrAction action;
CHECK_XR(xrCreateAction(handle, &actionInfo, &action), "Action creation failed.");
- actionMap.insert({info.name, GHOST_XrAction(xrSession, xrInstance, action, XR_NULL_PATH)});
+ actionMap.emplace(std::piecewise_construct,
+ std::forward_as_tuple(info.name),
+ std::forward_as_tuple(xrSession, xrInstance, action, XR_NULL_PATH));
return actionMap.at(info.name);
}
@@ -191,15 +193,18 @@ GHOST_XrAction &GHOST_XrActionSet::createSubactions(GHOST_XrSubactionsCreateInfo
actionInfo.subactionPaths = subactionPaths.data();
XrAction action;
- CHECK_XR(xrCreateAction(handle, &actionInfo, &action), "Action creation failed.");
+ CHECK_XR(xrCreateAction(handle, &actionInfo, &action), "Subactions creation failed.");
/* Create the parent action GHOST_XrAction (same handle, no subpath). */
- actionMap.insert({info.parentName, GHOST_XrAction(xrSession, xrInstance, action, XR_NULL_PATH)});
+ actionMap.emplace(std::piecewise_construct,
+ std::forward_as_tuple(info.parentName),
+ std::forward_as_tuple(xrSession, xrInstance, action, XR_NULL_PATH));
/* Create a GHOST_XrAction object for each subaction path (duplicate XrAction handle). */
for (int i = 0; i < info.subactions.size(); i++) {
- actionMap.insert({info.subactions[i].name, GHOST_XrAction(
- xrSession, xrInstance, action, subactionPaths[i])});
+ actionMap.emplace(std::piecewise_construct,
+ std::forward_as_tuple(info.subactions[i].name),
+ std::forward_as_tuple(xrSession, xrInstance, action, subactionPaths[i]));
}
return actionMap.at(info.parentName);
@@ -232,7 +237,9 @@ GHOST_XrActionSet &GHOST_XrSession::createActionSet(const std::string &name,
GHOST_XrActionSetMap &setMap = m_oxr->actionData.actionSetMap;
- setMap.insert({name, GHOST_XrActionSet(xrSession, xrInstance, set)});
+ setMap.emplace(std::piecewise_construct,
+ std::forward_as_tuple(name),
+ std::forward_as_tuple(xrSession, xrInstance, set));
return setMap.at(name);
}
@@ -347,7 +354,7 @@ XrSpace GHOST_XrSession::createSpace(GHOST_XrAction &action, XrPosef poseInSpace
XrSpace xrSpace;
CHECK_XR(xrCreateActionSpace(m_oxr->session, &actionSpaceInfo, &xrSpace),
- "Creation of action space failed failed.");
+ "Creation of action space failed.");
return xrSpace;
}
@@ -365,13 +372,15 @@ void GHOST_XrSession::initXrActionsDefault()
GHOST_XrAction &parent_action = set.createSubactions(createInfo);
- suggestBinding(
- parent_action.handle, "/interaction_profiles/oculus/touch_controller", "/user/hand/left/input/grip/pose");
- suggestBinding(
- parent_action.handle, "/interaction_profiles/oculus/touch_controller", "/user/hand/right/input/grip/pose");
+ suggestBinding(parent_action.handle,
+ "/interaction_profiles/oculus/touch_controller",
+ "/user/hand/left/input/grip/pose");
+ suggestBinding(parent_action.handle,
+ "/interaction_profiles/oculus/touch_controller",
+ "/user/hand/right/input/grip/pose");
/* Create hand spaces. */
- XrPosef poseInSpace;
+ XrPosef poseInSpace = {};
poseInSpace.orientation.w = 1.f;
m_oxr->actionData.handSpaces[0] = createSpace(set.getAction("hand_pose_left"), poseInSpace);
diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h
index fe3051df5b6..c24579455cf 100644
--- a/intern/ghost/intern/GHOST_XrSession.h
+++ b/intern/ghost/intern/GHOST_XrSession.h
@@ -45,6 +45,9 @@ class GHOST_XrAction {
XrInstance xrInstance;
public:
+ GHOST_XrAction(const GHOST_XrAction&) = delete;
+ void operator=(const GHOST_XrAction&) = delete;
+
XrAction handle;
XrPath subPath;
GHOST_XrAction(XrSession xrSession, XrInstance xrInstance, XrAction handle, XrPath subPath);
@@ -64,6 +67,9 @@ class GHOST_XrActionSet {
XrInstance xrInstance;
public:
+ GHOST_XrActionSet(const GHOST_XrActionSet&) = delete;
+ void operator=(const GHOST_XrActionSet&) = delete;
+
XrActionSet handle;
GHOST_XrAction &getAction(const std::string &actionID);