mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Add option to enable Vive PRO Eye eye tracking
This commit is contained in:
parent
e95dd3c2bd
commit
2e9a8e2b33
3 changed files with 88 additions and 2 deletions
|
@ -71,6 +71,7 @@ Flickable {
|
||||||
|
|
||||||
property int state: buttonState.disabled
|
property int state: buttonState.disabled
|
||||||
property var lastConfiguration: null
|
property var lastConfiguration: null
|
||||||
|
property bool isConfiguring: false
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
|
@ -840,9 +841,72 @@ Flickable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HifiControls.CheckBox {
|
||||||
|
id: eyeTracking
|
||||||
|
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: eyeTrackingLabel
|
||||||
|
size: 12
|
||||||
|
text: "Use eye tracking (if available)."
|
||||||
|
color: hifi.colors.lightGrayText
|
||||||
|
anchors {
|
||||||
|
left: eyeTracking.right
|
||||||
|
leftMargin: 5
|
||||||
|
verticalCenter: eyeTracking.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: privacyStatement
|
||||||
|
text: "Privacy Statement"
|
||||||
|
color: hifi.colors.blueHighlight
|
||||||
|
size: 12
|
||||||
|
anchors {
|
||||||
|
left: eyeTrackingLabel.right
|
||||||
|
leftMargin: 10
|
||||||
|
verticalCenter: eyeTrackingLabel.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: privacyStatementUnderline
|
||||||
|
color: hifi.colors.blueHighlight
|
||||||
|
width: privacyStatement.width
|
||||||
|
height: 1
|
||||||
|
anchors {
|
||||||
|
top: privacyStatement.bottom
|
||||||
|
topMargin: 1
|
||||||
|
left: privacyStatement.left
|
||||||
|
}
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: privacyStatementUnderline.visible = true;
|
||||||
|
onExited: privacyStatementUnderline.visible = false;
|
||||||
|
onClicked: HiFiAbout.openUrl("https://vircadia.com/"); // FIXME: URL for privacy statement.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: outOfRangeDataStrategyRow
|
id: outOfRangeDataStrategyRow
|
||||||
anchors.top: viveInDesktop.bottom
|
anchors.top: eyeTracking.bottom
|
||||||
anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
anchors.left: openVrConfiguration.left
|
anchors.left: openVrConfiguration.left
|
||||||
anchors.leftMargin: leftMargin + 10
|
anchors.leftMargin: leftMargin + 10
|
||||||
|
@ -966,6 +1030,8 @@ Flickable {
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayConfiguration() {
|
function displayConfiguration() {
|
||||||
|
isConfiguring = true;
|
||||||
|
|
||||||
var settings = InputConfiguration.configurationSettings(openVrConfiguration.pluginName);
|
var settings = InputConfiguration.configurationSettings(openVrConfiguration.pluginName);
|
||||||
var configurationType = settings["trackerConfiguration"];
|
var configurationType = settings["trackerConfiguration"];
|
||||||
displayTrackerConfiguration(configurationType);
|
displayTrackerConfiguration(configurationType);
|
||||||
|
@ -982,6 +1048,7 @@ Flickable {
|
||||||
var viveController = settings["handController"];
|
var viveController = settings["handController"];
|
||||||
var desktopMode = settings["desktopMode"];
|
var desktopMode = settings["desktopMode"];
|
||||||
var hmdDesktopPosition = settings["hmdDesktopTracking"];
|
var hmdDesktopPosition = settings["hmdDesktopTracking"];
|
||||||
|
var eyeTrackingEnabled = settings["eyeTrackingEnabled"];
|
||||||
|
|
||||||
armCircumference.realValue = settings.armCircumference;
|
armCircumference.realValue = settings.armCircumference;
|
||||||
shoulderWidth.realValue = settings.shoulderWidth;
|
shoulderWidth.realValue = settings.shoulderWidth;
|
||||||
|
@ -1004,6 +1071,7 @@ Flickable {
|
||||||
|
|
||||||
viveInDesktop.checked = desktopMode;
|
viveInDesktop.checked = desktopMode;
|
||||||
hmdInDesktop.checked = hmdDesktopPosition;
|
hmdInDesktop.checked = hmdDesktopPosition;
|
||||||
|
eyeTracking.checked = eyeTrackingEnabled;
|
||||||
outOfRangeDataStrategyComboBox.currentIndex = outOfRangeDataStrategyComboBox.model.indexOf(settings.outOfRangeDataStrategy);
|
outOfRangeDataStrategyComboBox.currentIndex = outOfRangeDataStrategyComboBox.model.indexOf(settings.outOfRangeDataStrategy);
|
||||||
|
|
||||||
initializeButtonState();
|
initializeButtonState();
|
||||||
|
@ -1014,6 +1082,8 @@ Flickable {
|
||||||
};
|
};
|
||||||
|
|
||||||
UserActivityLogger.logAction("mocap_ui_open_dialog", data);
|
UserActivityLogger.logAction("mocap_ui_open_dialog", data);
|
||||||
|
|
||||||
|
isConfiguring = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayTrackerConfiguration(type) {
|
function displayTrackerConfiguration(type) {
|
||||||
|
@ -1170,6 +1240,7 @@ Flickable {
|
||||||
"shoulderWidth": shoulderWidth.realValue,
|
"shoulderWidth": shoulderWidth.realValue,
|
||||||
"desktopMode": viveInDesktop.checked,
|
"desktopMode": viveInDesktop.checked,
|
||||||
"hmdDesktopTracking": hmdInDesktop.checked,
|
"hmdDesktopTracking": hmdInDesktop.checked,
|
||||||
|
"eyeTrackingEnabled": eyeTracking.checked,
|
||||||
"outOfRangeDataStrategy": outOfRangeDataStrategyComboBox.model[outOfRangeDataStrategyComboBox.currentIndex]
|
"outOfRangeDataStrategy": outOfRangeDataStrategyComboBox.model[outOfRangeDataStrategyComboBox.currentIndex]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1177,6 +1248,10 @@ Flickable {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendConfigurationSettings() {
|
function sendConfigurationSettings() {
|
||||||
|
if (isConfiguring) {
|
||||||
|
// Ignore control value changes during dialog initialization.
|
||||||
|
return;
|
||||||
|
}
|
||||||
var settings = composeConfigurationSettings();
|
var settings = composeConfigurationSettings();
|
||||||
InputConfiguration.setConfigurationSettings(settings, openVrConfiguration.pluginName);
|
InputConfiguration.setConfigurationSettings(settings, openVrConfiguration.pluginName);
|
||||||
updateCalibrationButton();
|
updateCalibrationButton();
|
||||||
|
|
|
@ -279,6 +279,10 @@ void ViveControllerManager::setConfigurationSettings(const QJsonObject configura
|
||||||
_hmdDesktopTracking = configurationSettings["hmdDesktopTracking"].toBool();
|
_hmdDesktopTracking = configurationSettings["hmdDesktopTracking"].toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configurationSettings.contains("eyeTrackingEnabled")) {
|
||||||
|
_eyeTrackingEnabled = configurationSettings["eyeTrackingEnabled"].toBool();
|
||||||
|
}
|
||||||
|
|
||||||
_inputDevice->configureCalibrationSettings(configurationSettings);
|
_inputDevice->configureCalibrationSettings(configurationSettings);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
@ -289,6 +293,7 @@ QJsonObject ViveControllerManager::configurationSettings() {
|
||||||
QJsonObject configurationSettings = _inputDevice->configurationSettings();
|
QJsonObject configurationSettings = _inputDevice->configurationSettings();
|
||||||
configurationSettings["desktopMode"] = _desktopMode;
|
configurationSettings["desktopMode"] = _desktopMode;
|
||||||
configurationSettings["hmdDesktopTracking"] = _hmdDesktopTracking;
|
configurationSettings["hmdDesktopTracking"] = _hmdDesktopTracking;
|
||||||
|
configurationSettings["eyeTrackingEnabled"] = _eyeTrackingEnabled;
|
||||||
return configurationSettings;
|
return configurationSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,7 +806,7 @@ void ViveControllerManager::pluginUpdate(float deltaTime, const controller::Inpu
|
||||||
_registeredWithInputMapper = true;
|
_registeredWithInputMapper = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_viveProEye) {
|
if (_viveProEye && _eyeTrackingEnabled) {
|
||||||
updateEyeTracker(deltaTime, inputCalibrationData);
|
updateEyeTracker(deltaTime, inputCalibrationData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,6 +826,9 @@ void ViveControllerManager::loadSettings() {
|
||||||
_inputDevice->_shoulderWidth = settings.value("shoulderWidth", QVariant(DEFAULT_SHOULDER_WIDTH)).toDouble();
|
_inputDevice->_shoulderWidth = settings.value("shoulderWidth", QVariant(DEFAULT_SHOULDER_WIDTH)).toDouble();
|
||||||
_inputDevice->_outOfRangeDataStrategy = stringToOutOfRangeDataStrategy(settings.value("outOfRangeDataStrategy", QVariant(DEFAULT_OUT_OF_RANGE_STRATEGY)).toString());
|
_inputDevice->_outOfRangeDataStrategy = stringToOutOfRangeDataStrategy(settings.value("outOfRangeDataStrategy", QVariant(DEFAULT_OUT_OF_RANGE_STRATEGY)).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool DEFAULT_EYE_TRACKING_ENABLED = false;
|
||||||
|
_eyeTrackingEnabled = settings.value("eyeTrackingEnabled", QVariant(DEFAULT_EYE_TRACKING_ENABLED)).toBool();
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
@ -835,6 +843,8 @@ void ViveControllerManager::saveSettings() const {
|
||||||
settings.setValue(QString("shoulderWidth"), _inputDevice->_shoulderWidth);
|
settings.setValue(QString("shoulderWidth"), _inputDevice->_shoulderWidth);
|
||||||
settings.setValue(QString("outOfRangeDataStrategy"), outOfRangeDataStrategyToString(_inputDevice->_outOfRangeDataStrategy));
|
settings.setValue(QString("outOfRangeDataStrategy"), outOfRangeDataStrategyToString(_inputDevice->_outOfRangeDataStrategy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.setValue(QString("eyeTrackingEnabled"), _eyeTrackingEnabled);
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,6 +253,7 @@ private:
|
||||||
std::shared_ptr<InputDevice> _inputDevice { std::make_shared<InputDevice>(_system) };
|
std::shared_ptr<InputDevice> _inputDevice { std::make_shared<InputDevice>(_system) };
|
||||||
|
|
||||||
bool _viveProEye { false };
|
bool _viveProEye { false };
|
||||||
|
bool _eyeTrackingEnabled { false };
|
||||||
std::shared_ptr<ViveProEyeReadThread> _viveProEyeReadThread;
|
std::shared_ptr<ViveProEyeReadThread> _viveProEyeReadThread;
|
||||||
EyeDataBuffer _prevEyeData;
|
EyeDataBuffer _prevEyeData;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue