From ffb3cf53aaf053063c26d6c2a2c58e03610e890e Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 30 May 2013 16:34:59 -0700 Subject: [PATCH] Added "Gyro Eye Offset" menu option to drive the eye offset from the gyros. --- interface/src/Application.cpp | 15 ++++++++++----- interface/src/Application.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e7b6ee1d80..140d47dc3c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -299,11 +299,13 @@ void Application::paintGL() { } else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { _myCamera.setTargetPosition(_myAvatar.getSpringyHeadPosition()); - _myCamera.setTargetRotation(_myAvatar.getHead().getWorldAlignedOrientation()); + _myCamera.setTargetRotation(_gyroEyeOffset->isChecked() ? _myAvatar.getWorldAlignedOrientation() : + _myAvatar.getHead().getWorldAlignedOrientation()); } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { _myCamera.setTargetPosition(_myAvatar.getHeadPosition()); - _myCamera.setTargetRotation(_myAvatar.getHead().getWorldAlignedOrientation()); + _myCamera.setTargetRotation(_gyroEyeOffset->isChecked() ? _myAvatar.getWorldAlignedOrientation() : + _myAvatar.getHead().getWorldAlignedOrientation()); } // important... @@ -1124,6 +1126,7 @@ void Application::initMenu() { optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true); (_gyroLook = optionsMenu->addAction("Gyro Look"))->setCheckable(true); _gyroLook->setChecked(true); + (_gyroEyeOffset = optionsMenu->addAction("Gyro Eye Offset"))->setCheckable(true); (_mouseLook = optionsMenu->addAction("Mouse Look"))->setCheckable(true); _mouseLook->setChecked(false); (_showHeadMouse = optionsMenu->addAction("Head Mouse"))->setCheckable(true); @@ -1294,9 +1297,11 @@ void Application::updateAvatar(float deltaTime) { _headMouseY = max(_headMouseY, 0); _headMouseY = min(_headMouseY, _glWidget->height()); - _eyeOffsetVelocity += _serialPort.getLastAcceleration() * deltaTime; - _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + _eyeOffsetVelocity * deltaTime); - resizeGL(_glWidget->width(), _glWidget->height()); + if (_gyroEyeOffset->isChecked()) { + _eyeOffsetVelocity += _serialPort.getLastAcceleration() * deltaTime; + _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + _eyeOffsetVelocity * deltaTime); + resizeGL(_glWidget->width(), _glWidget->height()); + } if (OculusManager::isConnected()) { float yaw, pitch, roll; diff --git a/interface/src/Application.h b/interface/src/Application.h index 540ce1796e..d4caeca329 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -143,6 +143,7 @@ private: QAction* _lookingInMirror; // Are we currently rendering one's own head as if in mirror? QAction* _echoAudioMode; // Are we asking the mixer to echo back our audio? QAction* _gyroLook; // Whether to allow the gyro data from head to move your view + QAction* _gyroEyeOffset; // Whether to allow the gyro data to move your eye offset QAction* _mouseLook; // Whether the have the mouse near edge of screen move your view QAction* _showHeadMouse; // Whether the have the mouse near edge of screen move your view QAction* _transmitterDrives; // Whether to have Transmitter data move/steer the Avatar