mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 06:33:11 +02:00
faceshift drives head mouse, improved reticle
This commit is contained in:
parent
99c866dba4
commit
6d2585a732
1 changed files with 27 additions and 20 deletions
|
@ -2069,16 +2069,15 @@ void Application::updateAvatar(float deltaTime) {
|
|||
|
||||
// Update head mouse from faceshift if active
|
||||
if (_faceshift.isActive()) {
|
||||
//glm::quat headRotation = _faceshift.getHeadRotation();
|
||||
/*
|
||||
_headMouseX = _glWidget->getWidth() / 2 + _faceshift.getHeadAngularVelocity()
|
||||
_headMouseX = max(_headMouseX, 0);
|
||||
_headMouseX = min(_headMouseX, _glWidget->width());
|
||||
_headMouseY = max(_headMouseY, 0);
|
||||
_headMouseY = min(_headMouseY, _glWidget->height());
|
||||
*/
|
||||
|
||||
glm::vec3 headVelocity = _faceshift.getHeadAngularVelocity();
|
||||
|
||||
// sets how quickly head angular rotation moves the head mouse
|
||||
const float HEADMOUSE_FACESHIFT_YAW_SCALE = 40.f;
|
||||
const float HEADMOUSE_FACESHIFT_PITCH_SCALE = 30.f;
|
||||
_headMouseX -= headVelocity.y * HEADMOUSE_FACESHIFT_YAW_SCALE;
|
||||
_headMouseY -= headVelocity.x * HEADMOUSE_FACESHIFT_PITCH_SCALE;
|
||||
}
|
||||
|
||||
if (_serialHeadSensor.isActive()) {
|
||||
|
||||
// Grab latest readings from the gyros
|
||||
|
@ -2094,10 +2093,6 @@ void Application::updateAvatar(float deltaTime) {
|
|||
_headMouseX -= measuredYawRate * HORIZONTAL_PIXELS_PER_DEGREE * deltaTime;
|
||||
_headMouseY -= measuredPitchRate * VERTICAL_PIXELS_PER_DEGREE * deltaTime;
|
||||
}
|
||||
_headMouseX = max(_headMouseX, 0);
|
||||
_headMouseX = min(_headMouseX, _glWidget->width());
|
||||
_headMouseY = max(_headMouseY, 0);
|
||||
_headMouseY = min(_headMouseY, _glWidget->height());
|
||||
|
||||
const float MIDPOINT_OF_SCREEN = 0.5;
|
||||
|
||||
|
@ -2117,6 +2112,13 @@ void Application::updateAvatar(float deltaTime) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// Constrain head-driven mouse to edges of screen
|
||||
_headMouseX = max(_headMouseX, 0);
|
||||
_headMouseX = min(_headMouseX, _glWidget->width());
|
||||
_headMouseY = max(_headMouseY, 0);
|
||||
_headMouseY = min(_headMouseY, _glWidget->height());
|
||||
|
||||
|
||||
if (OculusManager::isConnected()) {
|
||||
float yaw, pitch, roll;
|
||||
|
@ -2668,15 +2670,20 @@ void Application::displayOverlay() {
|
|||
// Display small target box at center or head mouse target that can also be used to measure LOD
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
const int PIXEL_BOX = 20;
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(_headMouseX - PIXEL_BOX/2, _headMouseY - PIXEL_BOX/2);
|
||||
glVertex2f(_headMouseX + PIXEL_BOX/2, _headMouseY - PIXEL_BOX/2);
|
||||
glVertex2f(_headMouseX + PIXEL_BOX/2, _headMouseY + PIXEL_BOX/2);
|
||||
glVertex2f(_headMouseX - PIXEL_BOX/2, _headMouseY + PIXEL_BOX/2);
|
||||
glVertex2f(_headMouseX - PIXEL_BOX/2, _headMouseY - PIXEL_BOX/2);
|
||||
const int PIXEL_BOX = 16;
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(_headMouseX - PIXEL_BOX/2, _headMouseY);
|
||||
glVertex2f(_headMouseX + PIXEL_BOX/2, _headMouseY);
|
||||
glVertex2f(_headMouseX, _headMouseY - PIXEL_BOX/2);
|
||||
glVertex2f(_headMouseX, _headMouseY + PIXEL_BOX/2);
|
||||
glEnd();
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glColor3f(1.f, 0.f, 0.f);
|
||||
glPointSize(3.0f);
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
glBegin(GL_POINTS);
|
||||
glVertex2f(_headMouseX - 1, _headMouseY + 1);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// Show detected levels from the serial I/O ADC channel sensors
|
||||
|
|
Loading…
Reference in a new issue