Merge pull request #7154 from ZappoMan/hmdHacking

various HMD fixes and improvements
This commit is contained in:
Chris Collins 2016-02-22 09:24:44 -08:00
commit 7074f72e6f
3 changed files with 16 additions and 9 deletions

View file

@ -132,6 +132,7 @@ function maybeGoActive(event) {
}
}
var wasHmdActive = false;
var wasMouseCaptured = false;
function maybeGoAway() {
if (HMD.active !== wasHmdActive) {
wasHmdActive = !wasHmdActive;
@ -139,6 +140,17 @@ function maybeGoAway() {
goAway();
}
}
// If the mouse has gone from captured, to non-captured state,
// then it likely means the person is still in the HMD, but has
// tabbed away from the application (meaning they don't have mouse
// control) and they likely want to go into an away state
if (Reticle.mouseCaptured !== wasMouseCaptured) {
wasMouseCaptured = !wasMouseCaptured;
if (!wasMouseCaptured) {
goAway();
}
}
}
Script.update.connect(maybeGoAway);

View file

@ -3906,16 +3906,8 @@ void Application::resetSensors(bool andReload) {
DependencyManager::get<Faceshift>()->reset();
DependencyManager::get<DdeFaceTracker>()->reset();
DependencyManager::get<EyeTracker>()->reset();
getActiveDisplayPlugin()->resetSensors();
QScreen* currentScreen = _window->windowHandle()->screen();
QWindow* mainWindow = _window->windowHandle();
QPoint windowCenter = mainWindow->geometry().center();
_glWidget->cursor().setPos(currentScreen, windowCenter);
getMyAvatar()->reset(andReload);
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection);
}

View file

@ -101,9 +101,9 @@ public:
void handleLeaveEvent();
QPointF getMouseEventPosition(QMouseEvent* event);
bool shouldCaptureMouse() const;
private:
bool shouldCaptureMouse() const;
void displayOverlayTextureStereo(RenderArgs* renderArgs, float aspectRatio, float fov);
void bindCursorTexture(gpu::Batch& batch, uint8_t cursorId = 0);
@ -162,10 +162,13 @@ class ReticleInterface : public QObject {
Q_PROPERTY(bool visible READ getVisible WRITE setVisible)
Q_PROPERTY(float depth READ getDepth WRITE setDepth)
Q_PROPERTY(glm::vec2 maximumPosition READ getMaximumPosition)
Q_PROPERTY(bool mouseCaptured READ isMouseCaptured)
public:
ReticleInterface(ApplicationCompositor* outer) : QObject(outer), _compositor(outer) {}
Q_INVOKABLE bool isMouseCaptured() { return _compositor->shouldCaptureMouse(); }
Q_INVOKABLE bool getVisible() { return _compositor->getReticleVisible(); }
Q_INVOKABLE void setVisible(bool visible) { _compositor->setReticleVisible(visible); }