Quest frame player cleanup

This commit is contained in:
Brad Davis 2019-02-19 12:37:17 -08:00
parent 0ddb4ecd7c
commit 44851bbf68
6 changed files with 11 additions and 36 deletions

View file

@ -1,9 +1,6 @@
// //
// AndroidHelper.cpp // Created by Bradley Austin Davis on 2019/02/15
// interface/src // Copyright 2013-2019 High Fidelity, Inc.
//
// Created by Gabriel Calero & Cristian Duarte on 3/30/18.
// Copyright 2018 High Fidelity, Inc.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html

View file

@ -1,9 +1,6 @@
// //
// AndroidHelper.h // Created by Bradley Austin Davis on 2019/02/15
// interface/src // Copyright 2013-2019 High Fidelity, Inc.
//
// Created by Gabriel Calero & Cristian Duarte on 3/30/18.
// Copyright 2018 High Fidelity, Inc.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // 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; void operator=(AndroidHelper const&) = delete;
static AndroidHelper& instance() { static AndroidHelper& instance() {
static AndroidHelper instance; static AndroidHelper instance;
return instance; return instance;
} }
void notifyLoadComplete(); void notifyLoadComplete();

View file

@ -11,15 +11,11 @@
#include <QtWidgets/QFileDialog> #include <QtWidgets/QFileDialog>
PlayerWindow::PlayerWindow() { PlayerWindow::PlayerWindow() {
installEventFilter(this); setFlags(Qt::Window);
setFlags(Qt::MSWindowsOwnDC | Qt::Window | Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint);
setSurfaceType(QSurface::OpenGLSurface); setSurfaceType(QSurface::OpenGLSurface);
create(); create();
showFullScreen(); showFullScreen();
// Ensure the window is visible and the GL context is valid // Ensure the window is visible and the GL context is valid
QCoreApplication::processEvents(); QCoreApplication::processEvents();
_renderThread.initialize(this); _renderThread.initialize();
}
PlayerWindow::~PlayerWindow() {
} }

View file

@ -8,22 +8,13 @@
#pragma once #pragma once
#include <QtGui/QWindow> #include <QtGui/QWindow>
#include <QtCore/QSettings>
#include <gpu/Forward.h>
#include "RenderThread.h" #include "RenderThread.h"
// Create a simple OpenGL window that renders text in various ways
class PlayerWindow : public QWindow { class PlayerWindow : public QWindow {
public: public:
PlayerWindow(); PlayerWindow();
virtual ~PlayerWindow(); virtual ~PlayerWindow() {}
protected:
//bool eventFilter(QObject* obj, QEvent* event) override;
//void keyPressEvent(QKeyEvent* event) override;
private: private:
QSettings _settings;
RenderThread _renderThread; RenderThread _renderThread;
}; };

View file

@ -32,8 +32,6 @@
#include "AndroidHelper.h" #include "AndroidHelper.h"
//static jobject _activity { nullptr };
struct HandController{ struct HandController{
ovrInputTrackedRemoteCapabilities caps {}; ovrInputTrackedRemoteCapabilities caps {};
ovrInputStateTrackedRemote state {}; ovrInputStateTrackedRemote state {};
@ -107,11 +105,10 @@ void RenderThread::move(const glm::vec3& v) {
_correction = glm::inverse(glm::translate(mat4(), v)) * _correction; _correction = glm::inverse(glm::translate(mat4(), v)) * _correction;
} }
void RenderThread::initialize(QWindow* window) { void RenderThread::initialize() {
std::unique_lock<std::mutex> lock(_frameLock); std::unique_lock<std::mutex> lock(_frameLock);
setObjectName("RenderThread"); setObjectName("RenderThread");
Parent::initialize(); Parent::initialize();
_window = window;
_thread->setObjectName("RenderThread"); _thread->setObjectName("RenderThread");
} }
@ -185,7 +182,6 @@ void RenderThread::handleInput() {
const auto &remote = controller.state; const auto &remote = controller.state;
if (remote.Joystick.x != 0.0f || remote.Joystick.y != 0.0f) { if (remote.Joystick.x != 0.0f || remote.Joystick.y != 0.0f) {
glm::vec3 translation; glm::vec3 translation;
float rotation = 0.0f;
if (caps.ControllerCapabilities & ovrControllerCaps_LeftHand) { if (caps.ControllerCapabilities & ovrControllerCaps_LeftHand) {
translation = glm::vec3{0.0f, -remote.Joystick.y, 0.0f}; translation = glm::vec3{0.0f, -remote.Joystick.y, 0.0f};
} else { } else {

View file

@ -20,11 +20,9 @@
class RenderThread : public GenericThread, ovr::VrHandler { class RenderThread : public GenericThread, ovr::VrHandler {
using Parent = GenericThread; using Parent = GenericThread;
public: public:
QWindow* _window{ nullptr };
std::mutex _mutex; std::mutex _mutex;
gpu::ContextPointer _gpuContext; // initialized during window creation gpu::ContextPointer _gpuContext; // initialized during window creation
std::shared_ptr<gpu::Backend> _backend; std::shared_ptr<gpu::Backend> _backend;
std::atomic<size_t> _presentCount{ 0 };
std::mutex _frameLock; std::mutex _frameLock;
std::queue<gpu::FramePointer> _pendingFrames; std::queue<gpu::FramePointer> _pendingFrames;
gpu::FramePointer _activeFrame; gpu::FramePointer _activeFrame;
@ -39,6 +37,6 @@ public:
void handleInput(); void handleInput();
void submitFrame(const gpu::FramePointer& frame); void submitFrame(const gpu::FramePointer& frame);
void initialize(QWindow* window); void initialize();
void renderFrame(); void renderFrame();
}; };