mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
21539: Allow HMD to turned off in Desktop Mode
This commit is contained in:
parent
9c1a33c826
commit
ac1df7b815
3 changed files with 69 additions and 6 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
|
||||
|
@ -789,6 +791,7 @@ Rectangle {
|
|||
verticalCenter: viveInDesktop.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NumberAnimation {
|
||||
id: numberAnimation
|
||||
|
@ -797,6 +800,35 @@ Rectangle {
|
|||
to: 0
|
||||
}
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: hmdInDesktop
|
||||
width: 15
|
||||
height: 15
|
||||
boxRadius: 7
|
||||
|
||||
anchors.top: viveInDesktop.bottom
|
||||
anchors.topMargin: 5
|
||||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 10
|
||||
|
||||
onClicked: {
|
||||
sendConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
RalewayBold {
|
||||
id: hmdDesktopText
|
||||
size: 10
|
||||
text: "Use HMD in desktop mode"
|
||||
color: hifi.colors.white
|
||||
|
||||
anchors {
|
||||
left: hmdInDesktop.right
|
||||
leftMargin: 5
|
||||
verticalCenter: hmdInDesktop.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
function logAction(action, status) {
|
||||
console.log("calibrated from ui");
|
||||
var data = {
|
||||
|
@ -877,6 +909,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 +931,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
viveInDesktop.checked = desktopMode;
|
||||
hmdInDesktop.checked = hmdDesktopPosition;
|
||||
|
||||
initializeButtonState();
|
||||
updateCalibrationText();
|
||||
|
@ -1058,7 +1092,8 @@ Rectangle {
|
|||
"handConfiguration": handObject,
|
||||
"armCircumference": armCircumference.value,
|
||||
"shoulderWidth": shoulderWidth.value,
|
||||
"desktopMode": viveInDesktop.checked
|
||||
"desktopMode": viveInDesktop.checked,
|
||||
"hmdDesktopTracking": hmdInDesktop.checked
|
||||
}
|
||||
|
||||
return settingsObject;
|
||||
|
|
|
@ -166,6 +166,12 @@ void ViveControllerManager::setConfigurationSettings(const QJsonObject configura
|
|||
_resetMatCalculated = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (configurationSettings.contains("hmdDesktopTracking")) {
|
||||
|
||||
_hmdDesktopTracking = configurationSettings["hmdDesktopTracking"].toBool();
|
||||
}
|
||||
|
||||
_inputDevice->configureCalibrationSettings(configurationSettings);
|
||||
saveSettings();
|
||||
}
|
||||
|
@ -175,6 +181,7 @@ QJsonObject ViveControllerManager::configurationSettings() {
|
|||
if (isSupported()) {
|
||||
QJsonObject configurationSettings = _inputDevice->configurationSettings();
|
||||
configurationSettings["desktopMode"] = _desktopMode;
|
||||
configurationSettings["hmdDesktopTracking"] = _hmdDesktopTracking;
|
||||
return configurationSettings;
|
||||
}
|
||||
|
||||
|
@ -414,6 +421,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 +450,17 @@ 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);
|
||||
|
||||
qDebug() << "HMD desktop tracking Enabled" << _hmdTrackingEnabled << "-" << hmdDesktopMode << "-" << hmdDesktopTracking << !(hmdDesktopMode && !hmdDesktopTracking);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,11 +752,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