mirror of
https://github.com/overte-org/overte.git
synced 2025-04-12 10:42:10 +02:00
finished vive in desktop mode
This commit is contained in:
parent
309a03230c
commit
51792769b5
5 changed files with 74 additions and 5 deletions
|
@ -642,6 +642,57 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Separator {
|
||||
id: advanceSeperator
|
||||
width: parent.width
|
||||
anchors.top: timeToCalibrate.bottom
|
||||
anchors.topMargin: 10
|
||||
}
|
||||
|
||||
RalewayBold {
|
||||
id: advanceSettings
|
||||
|
||||
text: "Advance Settings"
|
||||
size: 12
|
||||
|
||||
color: hifi.colors.white
|
||||
|
||||
anchors.top: advanceSeperator.bottom
|
||||
anchors.topMargin: 10
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: leftMargin
|
||||
}
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: viveInDesktop
|
||||
width: 15
|
||||
height: 15
|
||||
boxRadius: 7
|
||||
|
||||
anchors.top: advanceSettings.bottom
|
||||
anchors.topMargin: 5
|
||||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 10
|
||||
|
||||
onClicked: {
|
||||
sendConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
RalewayBold {
|
||||
id: viveDesktopText
|
||||
size: 10
|
||||
text: "Use vive devices in desktop mode"
|
||||
color: hifi.colors.white
|
||||
|
||||
anchors {
|
||||
left: viveInDesktop.right
|
||||
leftMargin: 5
|
||||
verticalCenter: viveInDesktop.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: numberAnimation
|
||||
target: openVrConfiguration
|
||||
|
@ -728,6 +779,7 @@ Rectangle {
|
|||
|
||||
var HmdHead = settings["HMDHead"];
|
||||
var viveController = settings["handController"];
|
||||
var desktopMode = settings["desktopMode"];
|
||||
|
||||
if (HmdHead) {
|
||||
headBox.checked = true;
|
||||
|
@ -745,6 +797,8 @@ Rectangle {
|
|||
handBox.checked = false;
|
||||
}
|
||||
|
||||
viveInDesktop.checked = desktopMode;
|
||||
|
||||
initializeButtonState();
|
||||
updateCalibrationText();
|
||||
|
||||
|
@ -901,7 +955,8 @@ Rectangle {
|
|||
var settingsObject = {
|
||||
"bodyConfiguration": trackerConfiguration,
|
||||
"headConfiguration": headObject,
|
||||
"handConfiguration": handObject
|
||||
"handConfiguration": handObject,
|
||||
"desktopMode": viveInDesktop.checked
|
||||
}
|
||||
|
||||
return settingsObject;
|
||||
|
|
|
@ -525,7 +525,7 @@ void OpenVrDisplayPlugin::resetSensors() {
|
|||
_sensorResetMat = glm::inverse(cancelOutRollAndPitch(m));
|
||||
}
|
||||
|
||||
/static bool isBadPose(vr::HmdMatrix34_t* mat) {
|
||||
static bool isBadPose(vr::HmdMatrix34_t* mat) {
|
||||
if (mat->m[1][3] < -0.2f) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,12 @@ struct PoseData {
|
|||
angularVelocities[i] = transformVectorFast(resetMat, toGlm(vrPoses[i].vAngularVelocity));
|
||||
}
|
||||
}
|
||||
|
||||
void resetToInvalid() {
|
||||
for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) {
|
||||
vrPoses[i].bPoseIsValid = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// FIXME remove once OpenVR header is updated
|
||||
|
|
|
@ -166,13 +166,19 @@ bool ViveControllerManager::isSupported() const {
|
|||
|
||||
void ViveControllerManager::setConfigurationSettings(const QJsonObject configurationSettings) {
|
||||
if (isSupported()) {
|
||||
if (configurationSettings.contains("desktopMode")) {
|
||||
qDebug() << configurationSettings["desktopMode"].toBool();
|
||||
_desktopMode = configurationSettings["desktopMode"].toBool();
|
||||
}
|
||||
_inputDevice->configureCalibrationSettings(configurationSettings);
|
||||
}
|
||||
}
|
||||
|
||||
QJsonObject ViveControllerManager::configurationSettings() {
|
||||
if (isSupported()) {
|
||||
return _inputDevice->configurationSettings();
|
||||
QJsonObject configurationSettings = _inputDevice->configurationSettings();
|
||||
configurationSettings["desktopMode"] = _desktopMode;
|
||||
return configurationSettings;
|
||||
}
|
||||
|
||||
return QJsonObject();
|
||||
|
@ -243,7 +249,7 @@ void ViveControllerManager::pluginUpdate(float deltaTime, const controller::Inpu
|
|||
return;
|
||||
}
|
||||
|
||||
if (isDesktopMode()) {
|
||||
if (isDesktopMode() && _desktopMode) {
|
||||
if (!_resetMatCalculated) {
|
||||
_resetMat = calculateResetMat();
|
||||
_resetMatCalculated = true;
|
||||
|
@ -251,6 +257,8 @@ void ViveControllerManager::pluginUpdate(float deltaTime, const controller::Inpu
|
|||
|
||||
_system->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseStanding, 0, _nextSimPoseData.vrPoses, vr::k_unMaxTrackedDeviceCount);
|
||||
_nextSimPoseData.update(_resetMat);
|
||||
} else if (isDesktopMode()) {
|
||||
_nextSimPoseData.resetToInvalid();
|
||||
}
|
||||
|
||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||
|
|
|
@ -194,7 +194,7 @@ private:
|
|||
bool _registeredWithInputMapper { false };
|
||||
bool _modelLoaded { false };
|
||||
bool _resetMatCalculated { false };
|
||||
bool _pullInputData { false };
|
||||
bool _desktopMode { false };
|
||||
glm::mat4 _resetMat { glm::mat4() };
|
||||
model::Geometry _modelGeometry;
|
||||
gpu::TexturePointer _texture;
|
||||
|
|
Loading…
Reference in a new issue