From 44851bbf684e3ac612fe6abacba0c5a430bbc063 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 19 Feb 2019 12:37:17 -0800 Subject: [PATCH] Quest frame player cleanup --- .../questFramePlayer/src/main/cpp/AndroidHelper.cpp | 7 ++----- .../questFramePlayer/src/main/cpp/AndroidHelper.h | 11 ++++------- .../questFramePlayer/src/main/cpp/PlayerWindow.cpp | 8 ++------ .../apps/questFramePlayer/src/main/cpp/PlayerWindow.h | 11 +---------- .../questFramePlayer/src/main/cpp/RenderThread.cpp | 6 +----- .../apps/questFramePlayer/src/main/cpp/RenderThread.h | 4 +--- 6 files changed, 11 insertions(+), 36 deletions(-) diff --git a/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.cpp b/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.cpp index 40cadfaf7d..797040ab69 100644 --- a/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.cpp +++ b/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.cpp @@ -1,9 +1,6 @@ // -// AndroidHelper.cpp -// interface/src -// -// Created by Gabriel Calero & Cristian Duarte on 3/30/18. -// Copyright 2018 High Fidelity, Inc. +// Created by Bradley Austin Davis on 2019/02/15 +// Copyright 2013-2019 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.h b/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.h index 7ee85294f1..ef6722462c 100644 --- a/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.h +++ b/android/apps/questFramePlayer/src/main/cpp/AndroidHelper.h @@ -1,9 +1,6 @@ // -// AndroidHelper.h -// interface/src -// -// Created by Gabriel Calero & Cristian Duarte on 3/30/18. -// Copyright 2018 High Fidelity, Inc. +// Created by Bradley Austin Davis on 2019/02/15 +// Copyright 2013-2019 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -24,8 +21,8 @@ public: void operator=(AndroidHelper const&) = delete; static AndroidHelper& instance() { - static AndroidHelper instance; - return instance; + static AndroidHelper instance; + return instance; } void notifyLoadComplete(); diff --git a/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.cpp b/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.cpp index ec2986298e..8f78b1946a 100644 --- a/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.cpp +++ b/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.cpp @@ -11,15 +11,11 @@ #include PlayerWindow::PlayerWindow() { - installEventFilter(this); - setFlags(Qt::MSWindowsOwnDC | Qt::Window | Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint); + setFlags(Qt::Window); setSurfaceType(QSurface::OpenGLSurface); create(); showFullScreen(); // Ensure the window is visible and the GL context is valid QCoreApplication::processEvents(); - _renderThread.initialize(this); -} - -PlayerWindow::~PlayerWindow() { + _renderThread.initialize(); } diff --git a/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.h b/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.h index e4dd6cef43..5e7dc82781 100644 --- a/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.h +++ b/android/apps/questFramePlayer/src/main/cpp/PlayerWindow.h @@ -8,22 +8,13 @@ #pragma once #include -#include - -#include #include "RenderThread.h" -// Create a simple OpenGL window that renders text in various ways class PlayerWindow : public QWindow { public: PlayerWindow(); - virtual ~PlayerWindow(); - -protected: - //bool eventFilter(QObject* obj, QEvent* event) override; - //void keyPressEvent(QKeyEvent* event) override; + virtual ~PlayerWindow() {} private: - QSettings _settings; RenderThread _renderThread; }; diff --git a/android/apps/questFramePlayer/src/main/cpp/RenderThread.cpp b/android/apps/questFramePlayer/src/main/cpp/RenderThread.cpp index 22cb85a889..78a4487284 100644 --- a/android/apps/questFramePlayer/src/main/cpp/RenderThread.cpp +++ b/android/apps/questFramePlayer/src/main/cpp/RenderThread.cpp @@ -32,8 +32,6 @@ #include "AndroidHelper.h" -//static jobject _activity { nullptr }; - struct HandController{ ovrInputTrackedRemoteCapabilities caps {}; ovrInputStateTrackedRemote state {}; @@ -107,11 +105,10 @@ void RenderThread::move(const glm::vec3& v) { _correction = glm::inverse(glm::translate(mat4(), v)) * _correction; } -void RenderThread::initialize(QWindow* window) { +void RenderThread::initialize() { std::unique_lock lock(_frameLock); setObjectName("RenderThread"); Parent::initialize(); - _window = window; _thread->setObjectName("RenderThread"); } @@ -185,7 +182,6 @@ void RenderThread::handleInput() { const auto &remote = controller.state; if (remote.Joystick.x != 0.0f || remote.Joystick.y != 0.0f) { glm::vec3 translation; - float rotation = 0.0f; if (caps.ControllerCapabilities & ovrControllerCaps_LeftHand) { translation = glm::vec3{0.0f, -remote.Joystick.y, 0.0f}; } else { diff --git a/android/apps/questFramePlayer/src/main/cpp/RenderThread.h b/android/apps/questFramePlayer/src/main/cpp/RenderThread.h index 701cd25f5b..747d0d9e8d 100644 --- a/android/apps/questFramePlayer/src/main/cpp/RenderThread.h +++ b/android/apps/questFramePlayer/src/main/cpp/RenderThread.h @@ -20,11 +20,9 @@ class RenderThread : public GenericThread, ovr::VrHandler { using Parent = GenericThread; public: - QWindow* _window{ nullptr }; std::mutex _mutex; gpu::ContextPointer _gpuContext; // initialized during window creation std::shared_ptr _backend; - std::atomic _presentCount{ 0 }; std::mutex _frameLock; std::queue _pendingFrames; gpu::FramePointer _activeFrame; @@ -39,6 +37,6 @@ public: void handleInput(); void submitFrame(const gpu::FramePointer& frame); - void initialize(QWindow* window); + void initialize(); void renderFrame(); };