mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-15 20:09:14 +02:00
Merge pull request #11752 from Menithal/21539
21539: Add "None" option in Head Tracking section when "Use Vive in Desktop Mode" is selected
This commit is contained in:
commit
83d13717fe
3 changed files with 75 additions and 10 deletions
|
@ -36,7 +36,9 @@ Rectangle {
|
|||
readonly property bool hmdHead: headBox.checked
|
||||
readonly property bool headPuck: headPuckBox.checked
|
||||
readonly property bool handController: handBox.checked
|
||||
|
||||
readonly property bool handPuck: handPuckBox.checked
|
||||
readonly property bool hmdDesktop: hmdInDesktop.checked
|
||||
|
||||
property int state: buttonState.disabled
|
||||
property var lastConfiguration: null
|
||||
|
@ -53,10 +55,6 @@ Rectangle {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
|
@ -99,6 +97,7 @@ Rectangle {
|
|||
onClicked: {
|
||||
if (checked) {
|
||||
headPuckBox.checked = false;
|
||||
hmdInDesktop.checked = false;
|
||||
} else {
|
||||
checked = true;
|
||||
}
|
||||
|
@ -121,6 +120,7 @@ Rectangle {
|
|||
onClicked: {
|
||||
if (checked) {
|
||||
headBox.checked = false;
|
||||
hmdInDesktop.checked = false;
|
||||
} else {
|
||||
checked = true;
|
||||
}
|
||||
|
@ -133,6 +133,36 @@ Rectangle {
|
|||
text: "Tracker"
|
||||
color: hifi.colors.lightGrayText
|
||||
}
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: hmdInDesktop
|
||||
width: 15
|
||||
height: 15
|
||||
boxRadius: 7
|
||||
visible: viveInDesktop.checked
|
||||
|
||||
anchors.top: viveInDesktop.bottom
|
||||
anchors.topMargin: 5
|
||||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 10
|
||||
|
||||
onClicked: {
|
||||
if (checked) {
|
||||
headBox.checked = false;
|
||||
headPuckBox.checked = false;
|
||||
} else {
|
||||
checked = true;
|
||||
}
|
||||
sendConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
visible: viveInDesktop.checked
|
||||
text: "None"
|
||||
color: hifi.colors.lightGrayText
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
|
@ -773,6 +803,11 @@ Rectangle {
|
|||
anchors.leftMargin: leftMargin + 10
|
||||
|
||||
onClicked: {
|
||||
if (!checked & hmdInDesktop.checked) {
|
||||
headBox.checked = true;
|
||||
headPuckBox.checked = false;
|
||||
hmdInDesktop.checked = false;
|
||||
}
|
||||
sendConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
@ -789,6 +824,7 @@ Rectangle {
|
|||
verticalCenter: viveInDesktop.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NumberAnimation {
|
||||
id: numberAnimation
|
||||
|
@ -797,6 +833,7 @@ Rectangle {
|
|||
to: 0
|
||||
}
|
||||
|
||||
|
||||
function logAction(action, status) {
|
||||
console.log("calibrated from ui");
|
||||
var data = {
|
||||
|
@ -877,6 +914,7 @@ Rectangle {
|
|||
var HmdHead = settings["HMDHead"];
|
||||
var viveController = settings["handController"];
|
||||
var desktopMode = settings["desktopMode"];
|
||||
var hmdDesktopPosition = settings["hmdDesktopTracking"];
|
||||
|
||||
armCircumference.value = settings.armCircumference;
|
||||
shoulderWidth.value = settings.shoulderWidth;
|
||||
|
@ -898,6 +936,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
viveInDesktop.checked = desktopMode;
|
||||
hmdInDesktop.checked = hmdDesktopPosition;
|
||||
|
||||
initializeButtonState();
|
||||
updateCalibrationText();
|
||||
|
@ -1058,7 +1097,8 @@ Rectangle {
|
|||
"handConfiguration": handObject,
|
||||
"armCircumference": armCircumference.value,
|
||||
"shoulderWidth": shoulderWidth.value,
|
||||
"desktopMode": viveInDesktop.checked
|
||||
"desktopMode": viveInDesktop.checked,
|
||||
"hmdDesktopTracking": hmdInDesktop.checked
|
||||
}
|
||||
|
||||
return settingsObject;
|
||||
|
|
|
@ -166,6 +166,11 @@ void ViveControllerManager::setConfigurationSettings(const QJsonObject configura
|
|||
_resetMatCalculated = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (configurationSettings.contains("hmdDesktopTracking")) {
|
||||
_hmdDesktopTracking = configurationSettings["hmdDesktopTracking"].toBool();
|
||||
}
|
||||
|
||||
_inputDevice->configureCalibrationSettings(configurationSettings);
|
||||
saveSettings();
|
||||
}
|
||||
|
@ -175,6 +180,7 @@ QJsonObject ViveControllerManager::configurationSettings() {
|
|||
if (isSupported()) {
|
||||
QJsonObject configurationSettings = _inputDevice->configurationSettings();
|
||||
configurationSettings["desktopMode"] = _desktopMode;
|
||||
configurationSettings["hmdDesktopTracking"] = _hmdDesktopTracking;
|
||||
return configurationSettings;
|
||||
}
|
||||
|
||||
|
@ -414,6 +420,8 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
|
|||
if (!configurationSettings.empty()) {
|
||||
auto iter = configurationSettings.begin();
|
||||
auto end = configurationSettings.end();
|
||||
bool hmdDesktopTracking = true;
|
||||
bool hmdDesktopMode = false;
|
||||
while (iter != end) {
|
||||
if (iter.key() == "bodyConfiguration") {
|
||||
setConfigFromString(iter.value().toString());
|
||||
|
@ -441,9 +449,15 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
|
|||
_armCircumference = (float)iter.value().toDouble() * CM_TO_M;
|
||||
} else if (iter.key() == "shoulderWidth") {
|
||||
_shoulderWidth = (float)iter.value().toDouble() * CM_TO_M;
|
||||
} else if (iter.key() == "hmdDesktopTracking") {
|
||||
hmdDesktopTracking = iter.value().toBool();
|
||||
} else if (iter.key() == "desktopMode") {
|
||||
hmdDesktopMode = iter.value().toBool();
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
_hmdTrackingEnabled = !(hmdDesktopMode && hmdDesktopTracking);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,11 +749,18 @@ void ViveControllerManager::InputDevice::handleHmd(uint32_t deviceIndex, const c
|
|||
_system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_HMD &&
|
||||
_nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid) {
|
||||
|
||||
const mat4& mat = _nextSimPoseData.poses[deviceIndex];
|
||||
const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
|
||||
const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
|
||||
if (_hmdTrackingEnabled){
|
||||
const mat4& mat = _nextSimPoseData.poses[deviceIndex];
|
||||
const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
|
||||
const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
|
||||
|
||||
handleHeadPoseEvent(inputCalibrationData, mat, linearVelocity, angularVelocity);
|
||||
handleHeadPoseEvent(inputCalibrationData, mat, linearVelocity, angularVelocity);
|
||||
} else {
|
||||
const mat4& mat = mat4();
|
||||
const vec3 zero = vec3();
|
||||
|
||||
handleHeadPoseEvent(inputCalibrationData, mat, zero, zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@ private:
|
|||
void emitCalibrationStatus();
|
||||
void calibrateNextFrame();
|
||||
|
||||
|
||||
class FilteredStick {
|
||||
public:
|
||||
glm::vec2 process(float deltaTime, const glm::vec2& stick) {
|
||||
|
@ -195,6 +194,8 @@ private:
|
|||
bool _overrideHands { false };
|
||||
mutable std::recursive_mutex _lock;
|
||||
|
||||
bool _hmdTrackingEnabled { false };
|
||||
|
||||
QString configToString(Config config);
|
||||
friend class ViveControllerManager;
|
||||
};
|
||||
|
@ -204,7 +205,10 @@ private:
|
|||
bool _registeredWithInputMapper { false };
|
||||
bool _modelLoaded { false };
|
||||
bool _resetMatCalculated { false };
|
||||
|
||||
bool _desktopMode { false };
|
||||
bool _hmdDesktopTracking { false };
|
||||
|
||||
glm::mat4 _resetMat { glm::mat4() };
|
||||
model::Geometry _modelGeometry;
|
||||
gpu::TexturePointer _texture;
|
||||
|
|
Loading…
Reference in a new issue