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
// 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

View file

@ -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();

View file

@ -11,15 +11,11 @@
#include <QtWidgets/QFileDialog>
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();
}

View file

@ -8,22 +8,13 @@
#pragma once
#include <QtGui/QWindow>
#include <QtCore/QSettings>
#include <gpu/Forward.h>
#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;
};

View file

@ -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<std::mutex> 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 {

View file

@ -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<gpu::Backend> _backend;
std::atomic<size_t> _presentCount{ 0 };
std::mutex _frameLock;
std::queue<gpu::FramePointer> _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();
};