mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:24:47 +02:00
Add 1 and 3 point eye tracker calibration
This commit is contained in:
parent
1201073709
commit
fefddb631f
6 changed files with 64 additions and 3 deletions
|
@ -2034,12 +2034,30 @@ void Application::setActiveFaceTracker() {
|
||||||
|
|
||||||
void Application::setActiveEyeTracker() {
|
void Application::setActiveEyeTracker() {
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
bool isEyeTrackingOptionChecked = Menu::getInstance()->isOptionChecked(MenuOption::SMIEyeTracking);
|
bool isEyeTracking = Menu::getInstance()->isOptionChecked(MenuOption::SMIEyeTracking);
|
||||||
|
bool isSimulating = Menu::getInstance()->isOptionChecked(MenuOption::SimulateEyeTracking);
|
||||||
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
||||||
eyeTracker->setEnabled(isEyeTrackingOptionChecked, Menu::getInstance()->isOptionChecked(MenuOption::SimulateEyeTracking));
|
eyeTracker->setEnabled(isEyeTracking, isSimulating);
|
||||||
if (isEyeTrackingOptionChecked && !eyeTracker->isTracking()) {
|
if (isEyeTracking && !eyeTracker->isTracking()) {
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::SMIEyeTracking, false);
|
Menu::getInstance()->setIsOptionChecked(MenuOption::SMIEyeTracking, false);
|
||||||
|
isEyeTracking = false;
|
||||||
}
|
}
|
||||||
|
Menu::getInstance()->getActionForOption(MenuOption::Calibrate1Point)->setEnabled(isEyeTracking && !isSimulating);
|
||||||
|
Menu::getInstance()->getActionForOption(MenuOption::Calibrate3Points)->setEnabled(isEyeTracking && !isSimulating);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::calibrateEyeTracker1Point() {
|
||||||
|
#ifdef HAVE_IVIEWHMD
|
||||||
|
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
||||||
|
eyeTracker->calibrate(1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::calibrateEyeTracker3Points() {
|
||||||
|
#ifdef HAVE_IVIEWHMD
|
||||||
|
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
||||||
|
eyeTracker->calibrate(3);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,6 +409,8 @@ public slots:
|
||||||
void setActiveFaceTracker();
|
void setActiveFaceTracker();
|
||||||
|
|
||||||
void setActiveEyeTracker();
|
void setActiveEyeTracker();
|
||||||
|
void calibrateEyeTracker1Point();
|
||||||
|
void calibrateEyeTracker3Points();
|
||||||
|
|
||||||
void aboutApp();
|
void aboutApp();
|
||||||
void showEditEntitiesHelp();
|
void showEditEntitiesHelp();
|
||||||
|
|
|
@ -440,6 +440,10 @@ Menu::Menu() {
|
||||||
MenuWrapper* eyeTrackingMenu = avatarDebugMenu->addMenu("Eye Tracking");
|
MenuWrapper* eyeTrackingMenu = avatarDebugMenu->addMenu("Eye Tracking");
|
||||||
addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SMIEyeTracking, 0, false,
|
addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SMIEyeTracking, 0, false,
|
||||||
qApp, SLOT(setActiveEyeTracker()));
|
qApp, SLOT(setActiveEyeTracker()));
|
||||||
|
addActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::Calibrate1Point, 0,
|
||||||
|
qApp, SLOT(calibrateEyeTracker1Point()));
|
||||||
|
addActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::Calibrate3Points, 0,
|
||||||
|
qApp, SLOT(calibrateEyeTracker3Points()));
|
||||||
addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SimulateEyeTracking, 0, false,
|
addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SimulateEyeTracking, 0, false,
|
||||||
qApp, SLOT(setActiveEyeTracker()));
|
qApp, SLOT(setActiveEyeTracker()));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -156,6 +156,8 @@ namespace MenuOption {
|
||||||
const QString Bookmarks = "Bookmarks";
|
const QString Bookmarks = "Bookmarks";
|
||||||
const QString CascadedShadows = "Cascaded";
|
const QString CascadedShadows = "Cascaded";
|
||||||
const QString CachesSize = "RAM Caches Size";
|
const QString CachesSize = "RAM Caches Size";
|
||||||
|
const QString Calibrate1Point = "Calibrate - 1 Point...";
|
||||||
|
const QString Calibrate3Points = "Calibrate - 3 Points...";
|
||||||
const QString CalibrateCamera = "Calibrate Camera";
|
const QString CalibrateCamera = "Calibrate Camera";
|
||||||
const QString CenterPlayerInView = "Center Player In View";
|
const QString CenterPlayerInView = "Center Player In View";
|
||||||
const QString Chat = "Chat...";
|
const QString Chat = "Chat...";
|
||||||
|
|
|
@ -143,6 +143,39 @@ void EyeTracker::reset() {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_IVIEWHMD
|
||||||
|
void EyeTracker::calibrate(int points) {
|
||||||
|
smi_CalibrationHMDStruct* calibrationHMDStruct;
|
||||||
|
smi_createCalibrationHMDStruct(&calibrationHMDStruct);
|
||||||
|
|
||||||
|
smi_CalibrationTypeEnum calibrationType;
|
||||||
|
switch (points) {
|
||||||
|
case 1:
|
||||||
|
calibrationType = SMI_ONE_POINT_CALIBRATION;
|
||||||
|
qCDebug(interfaceapp) << "Eye Tracker: One point calibration";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
calibrationType = SMI_THREE_POINT_CALIBRATION;
|
||||||
|
qCDebug(interfaceapp) << "Eye Tracker: Three point calibration";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qCWarning(interfaceapp) << "Eye Tracker: Invalid calibration specified";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
calibrationHMDStruct->type = calibrationType;
|
||||||
|
calibrationHMDStruct->backgroundColor->blue = 0.5;
|
||||||
|
calibrationHMDStruct->backgroundColor->green = 0.5;
|
||||||
|
calibrationHMDStruct->backgroundColor->red = 0.5;
|
||||||
|
calibrationHMDStruct->foregroundColor->blue = 1.0;
|
||||||
|
calibrationHMDStruct->foregroundColor->green = 1.0;
|
||||||
|
calibrationHMDStruct->foregroundColor->red = 1.0;
|
||||||
|
|
||||||
|
smi_setupCalibration(calibrationHMDStruct);
|
||||||
|
smi_calibrate();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
QString EyeTracker::smiReturnValueToString(int value) {
|
QString EyeTracker::smiReturnValueToString(int value) {
|
||||||
switch (value)
|
switch (value)
|
||||||
|
|
|
@ -36,6 +36,8 @@ public:
|
||||||
|
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
void processData(smi_CallbackDataStruct* data);
|
void processData(smi_CallbackDataStruct* data);
|
||||||
|
|
||||||
|
void calibrate(int points);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in a new issue