mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-08 02:53:38 +02:00
Removing dead code
This commit is contained in:
parent
9c8e21ec6b
commit
2446080a23
19 changed files with 0 additions and 1212 deletions
|
@ -1,42 +0,0 @@
|
|||
//
|
||||
// InterfaceActivity.java
|
||||
// gvr-interface/java
|
||||
//
|
||||
// Created by Stephen Birarda on 1/26/15.
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
package io.highfidelity.gvrinterface;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.util.Log;
|
||||
import org.qtproject.qt5.android.bindings.QtActivity;
|
||||
|
||||
public class InterfaceActivity extends QtActivity {
|
||||
|
||||
public static native void handleHifiURL(String hifiURLString);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
// Get the intent that started this activity in case we have a hifi:// URL to parse
|
||||
Intent intent = getIntent();
|
||||
if (intent.getAction() == Intent.ACTION_VIEW) {
|
||||
Uri data = intent.getData();
|
||||
|
||||
if (data.getScheme().equals("hifi")) {
|
||||
handleHifiURL(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
set(TARGET_NAME gvr-interface)
|
||||
|
||||
if (ANDROID)
|
||||
set(ANDROID_APK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk-build")
|
||||
set(ANDROID_APK_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk")
|
||||
|
||||
set(ANDROID_SDK_ROOT $ENV{ANDROID_HOME})
|
||||
set(ANDROID_APP_DISPLAY_NAME Interface)
|
||||
set(ANDROID_API_LEVEL 19)
|
||||
set(ANDROID_APK_PACKAGE io.highfidelity.gvrinterface)
|
||||
set(ANDROID_ACTIVITY_NAME io.highfidelity.gvrinterface.InterfaceActivity)
|
||||
set(ANDROID_APK_VERSION_NAME "0.1")
|
||||
set(ANDROID_APK_VERSION_CODE 1)
|
||||
set(ANDROID_APK_FULLSCREEN TRUE)
|
||||
set(ANDROID_DEPLOY_QT_INSTALL "--install")
|
||||
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}")
|
||||
|
||||
setup_hifi_library(Gui AndroidExtras)
|
||||
else ()
|
||||
setup_hifi_project(Gui)
|
||||
endif ()
|
||||
|
||||
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
|
||||
link_hifi_libraries(shared networking audio-client avatars)
|
||||
|
||||
if (ANDROID)
|
||||
find_package(LibOVR)
|
||||
|
||||
if (LIBOVR_FOUND)
|
||||
add_definitions(-DHAVE_LIBOVR)
|
||||
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES} ${LIBOVR_ANDROID_LIBRARIES} ${TURBOJPEG_LIBRARY})
|
||||
include_directories(SYSTEM ${LIBOVR_INCLUDE_DIRS})
|
||||
|
||||
# we need VRLib, so add a project.properties to our apk build folder that says that
|
||||
file(RELATIVE_PATH RELATIVE_VRLIB_PATH ${ANDROID_APK_OUTPUT_DIR} "${LIBOVR_VRLIB_DIR}")
|
||||
file(WRITE "${ANDROID_APK_BUILD_DIR}/project.properties" "android.library.reference.1=${RELATIVE_VRLIB_PATH}")
|
||||
|
||||
list(APPEND IGNORE_COPY_LIBS ${LIBOVR_ANDROID_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
# the presence of a HOCKEY_APP_ID means we are making a beta build
|
||||
if (ANDROID AND HOCKEY_APP_ID)
|
||||
set(HOCKEY_APP_ENABLED true)
|
||||
set(HOCKEY_APP_ACTIVITY "<activity android:name='net.hockeyapp.android.UpdateActivity' />\n")
|
||||
set(ANDROID_ACTIVITY_NAME io.highfidelity.gvrinterface.InterfaceBetaActivity)
|
||||
set(ANDROID_DEPLOY_QT_INSTALL "")
|
||||
set(ANDROID_APK_CUSTOM_NAME "Interface-beta.apk")
|
||||
|
||||
# set the ANDROID_APK_VERSION_CODE to the number of git commits
|
||||
execute_process(
|
||||
COMMAND git rev-list --first-parent --count HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_COUNT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(ANDROID_APK_VERSION_CODE ${GIT_COMMIT_COUNT})
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/InterfaceBetaActivity.java.in" "${ANDROID_APK_BUILD_DIR}/src/io/highfidelity/gvrinterface/InterfaceBetaActivity.java")
|
||||
elseif (ANDROID)
|
||||
set(HOCKEY_APP_ENABLED false)
|
||||
endif ()
|
||||
|
||||
if (ANDROID)
|
||||
|
||||
set(HIFI_URL_INTENT "<intent-filter>\
|
||||
\n <action android:name='android.intent.action.VIEW' />\
|
||||
\n <category android:name='android.intent.category.DEFAULT' />\
|
||||
\n <category android:name='android.intent.category.BROWSABLE' />\
|
||||
\n <data android:scheme='hifi' />\
|
||||
\n </intent-filter>"
|
||||
)
|
||||
|
||||
set(ANDROID_EXTRA_APPLICATION_XML "${HOCKEY_APP_ACTIVITY}")
|
||||
set(ANDROID_EXTRA_ACTIVITY_XML "${HIFI_URL_INTENT}")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/hockeyapp.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/hockeyapp.xml")
|
||||
qt_create_apk()
|
||||
|
||||
endif (ANDROID)
|
Binary file not shown.
Before Width: | Height: | Size: 9.7 KiB |
|
@ -1,73 +0,0 @@
|
|||
//
|
||||
// Client.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#include "Client.h"
|
||||
|
||||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <HifiSockAddr.h>
|
||||
#include <NodeList.h>
|
||||
#include <PacketHeaders.h>
|
||||
|
||||
Client::Client(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
// we need to make sure that required dependencies are created
|
||||
DependencyManager::set<AddressManager>();
|
||||
|
||||
setupNetworking();
|
||||
}
|
||||
|
||||
void Client::setupNetworking() {
|
||||
// once Application order of instantiation is fixed this should be done from AccountManager
|
||||
AccountManager::getInstance().setAuthURL(DEFAULT_NODE_AUTH_URL);
|
||||
|
||||
// setup the NodeList for this client
|
||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||
auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, 0);
|
||||
|
||||
// while datagram processing remains simple for targets using Client, we'll handle datagrams
|
||||
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &Client::processDatagrams);
|
||||
|
||||
// every second, ask the NodeList to check in with the domain server
|
||||
QTimer* domainCheckInTimer = new QTimer(this);
|
||||
domainCheckInTimer->setInterval(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||
connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
|
||||
|
||||
// TODO: once the Client knows its Address on start-up we should be able to immediately send a check in here
|
||||
domainCheckInTimer->start();
|
||||
|
||||
// handle the case where the domain stops talking to us
|
||||
// TODO: can we just have the nodelist do this when it sets up? Is there a user of the NodeList that wouldn't want this?
|
||||
connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
|
||||
}
|
||||
|
||||
void Client::processVerifiedPacket(const HifiSockAddr& senderSockAddr, const QByteArray& incomingPacket) {
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, incomingPacket);
|
||||
}
|
||||
|
||||
void Client::processDatagrams() {
|
||||
HifiSockAddr senderSockAddr;
|
||||
|
||||
static QByteArray incomingPacket;
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
while (DependencyManager::get<NodeList>()->getNodeSocket().hasPendingDatagrams()) {
|
||||
incomingPacket.resize(nodeList->getNodeSocket().pendingDatagramSize());
|
||||
nodeList->getNodeSocket().readDatagram(incomingPacket.data(), incomingPacket.size(),
|
||||
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(incomingPacket)) {
|
||||
processVerifiedPacket(senderSockAddr, incomingPacket);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
//
|
||||
// Client.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#ifndef hifi_Client_h
|
||||
#define hifi_Client_h
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <HifiSockAddr.h>
|
||||
|
||||
class Client : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Client(QObject* parent = 0);
|
||||
|
||||
virtual void cleanupBeforeQuit() = 0;
|
||||
protected:
|
||||
|
||||
void setupNetworking();
|
||||
virtual void processVerifiedPacket(const HifiSockAddr& senderSockAddr, const QByteArray& incomingPacket);
|
||||
private slots:
|
||||
void processDatagrams();
|
||||
};
|
||||
|
||||
#endif // hifi_Client_h
|
|
@ -1,191 +0,0 @@
|
|||
//
|
||||
// GVRInterface.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 11/18/14.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#include "GVRInterface.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||
#include <QtAndroidExtras/QAndroidJniObject>
|
||||
|
||||
#ifdef HAVE_LIBOVR
|
||||
|
||||
#include <KeyState.h>
|
||||
#include <VrApi/VrApi.h>
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
#include "GVRMainWindow.h"
|
||||
#include "RenderingClient.h"
|
||||
|
||||
static QString launchURLString = QString();
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
extern "C" {
|
||||
|
||||
JNIEXPORT void Java_io_highfidelity_gvrinterface_InterfaceActivity_handleHifiURL(JNIEnv *jni, jclass clazz, jstring hifiURLString) {
|
||||
launchURLString = QAndroidJniObject(hifiURLString).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
GVRInterface::GVRInterface(int argc, char* argv[]) :
|
||||
QApplication(argc, argv),
|
||||
_mainWindow(NULL),
|
||||
_inVRMode(false)
|
||||
{
|
||||
setApplicationName("gvr-interface");
|
||||
setOrganizationName("highfidelity");
|
||||
setOrganizationDomain("io");
|
||||
|
||||
if (!launchURLString.isEmpty()) {
|
||||
// did we get launched with a lookup URL? If so it is time to give that to the AddressManager
|
||||
qDebug() << "We were opened via a hifi URL -" << launchURLString;
|
||||
}
|
||||
|
||||
_client = new RenderingClient(this, launchURLString);
|
||||
|
||||
launchURLString = QString();
|
||||
|
||||
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
QAndroidJniEnvironment jniEnv;
|
||||
|
||||
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
||||
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
||||
|
||||
ovr_RegisterHmtReceivers(&*jniEnv, activity);
|
||||
|
||||
// PLATFORMACTIVITY_REMOVAL: Temp workaround for PlatformActivity being
|
||||
// stripped from UnityPlugin. Alternate is to use LOCAL_WHOLE_STATIC_LIBRARIES
|
||||
// but that increases the size of the plugin by ~1MiB
|
||||
OVR::linkerPlatformActivity++;
|
||||
#endif
|
||||
|
||||
// call our idle function whenever we can
|
||||
QTimer* idleTimer = new QTimer(this);
|
||||
connect(idleTimer, &QTimer::timeout, this, &GVRInterface::idle);
|
||||
idleTimer->start(0);
|
||||
|
||||
// call our quit handler before we go down
|
||||
connect(this, &QCoreApplication::aboutToQuit, this, &GVRInterface::handleApplicationQuit);
|
||||
}
|
||||
|
||||
void GVRInterface::handleApplicationQuit() {
|
||||
_client->cleanupBeforeQuit();
|
||||
}
|
||||
|
||||
void GVRInterface::idle() {
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
if (!_inVRMode && ovr_IsHeadsetDocked()) {
|
||||
qDebug() << "The headset just got docked - enter VR mode.";
|
||||
enterVRMode();
|
||||
} else if (_inVRMode) {
|
||||
|
||||
if (ovr_IsHeadsetDocked()) {
|
||||
static int counter = 0;
|
||||
|
||||
// Get the latest head tracking state, predicted ahead to the midpoint of the time
|
||||
// it will be displayed. It will always be corrected to the real values by
|
||||
// time warp, but the closer we get, the less black will be pulled in at the edges.
|
||||
const double now = ovr_GetTimeInSeconds();
|
||||
static double prev;
|
||||
const double rawDelta = now - prev;
|
||||
prev = now;
|
||||
const double clampedPrediction = std::min( 0.1, rawDelta * 2);
|
||||
ovrSensorState sensor = ovrHmd_GetSensorState(OvrHmd, now + clampedPrediction, true );
|
||||
|
||||
auto ovrOrientation = sensor.Predicted.Pose.Orientation;
|
||||
glm::quat newOrientation(ovrOrientation.w, ovrOrientation.x, ovrOrientation.y, ovrOrientation.z);
|
||||
_client->setOrientation(newOrientation);
|
||||
|
||||
if (counter++ % 100000 == 0) {
|
||||
qDebug() << "GetSensorState in frame" << counter << "-"
|
||||
<< ovrOrientation.x << ovrOrientation.y << ovrOrientation.z << ovrOrientation.w;
|
||||
}
|
||||
} else {
|
||||
qDebug() << "The headset was undocked - leaving VR mode.";
|
||||
|
||||
leaveVRMode();
|
||||
}
|
||||
}
|
||||
|
||||
OVR::KeyState& backKeyState = _mainWindow->getBackKeyState();
|
||||
auto backEvent = backKeyState.Update(ovr_GetTimeInSeconds());
|
||||
|
||||
if (backEvent == OVR::KeyState::KEY_EVENT_LONG_PRESS) {
|
||||
qDebug() << "Attemping to start the Platform UI Activity.";
|
||||
ovr_StartPackageActivity(_ovr, PUI_CLASS_NAME, PUI_GLOBAL_MENU);
|
||||
} else if (backEvent == OVR::KeyState::KEY_EVENT_DOUBLE_TAP || backEvent == OVR::KeyState::KEY_EVENT_SHORT_PRESS) {
|
||||
qDebug() << "Got an event we should cancel for!";
|
||||
} else if (backEvent == OVR::KeyState::KEY_EVENT_DOUBLE_TAP) {
|
||||
qDebug() << "The button is down!";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GVRInterface::handleApplicationStateChange(Qt::ApplicationState state) {
|
||||
switch(state) {
|
||||
case Qt::ApplicationActive:
|
||||
qDebug() << "The application is active.";
|
||||
break;
|
||||
case Qt::ApplicationSuspended:
|
||||
qDebug() << "The application is being suspended.";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GVRInterface::enterVRMode() {
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
// Default vrModeParms
|
||||
ovrModeParms vrModeParms;
|
||||
vrModeParms.AsynchronousTimeWarp = true;
|
||||
vrModeParms.AllowPowerSave = true;
|
||||
vrModeParms.DistortionFileName = NULL;
|
||||
vrModeParms.EnableImageServer = false;
|
||||
vrModeParms.CpuLevel = 2;
|
||||
vrModeParms.GpuLevel = 2;
|
||||
vrModeParms.GameThreadTid = 0;
|
||||
|
||||
QAndroidJniEnvironment jniEnv;
|
||||
|
||||
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
||||
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
||||
|
||||
vrModeParms.ActivityObject = activity;
|
||||
|
||||
ovrHmdInfo hmdInfo;
|
||||
_ovr = ovr_EnterVrMode(vrModeParms, &hmdInfo);
|
||||
|
||||
_inVRMode = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void GVRInterface::leaveVRMode() {
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
ovr_LeaveVrMode(_ovr);
|
||||
_inVRMode = false;
|
||||
#endif
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
//
|
||||
// GVRInterface.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 11/18/14.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#ifndef hifi_GVRInterface_h
|
||||
#define hifi_GVRInterface_h
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
class ovrMobile;
|
||||
class ovrHmdInfo;
|
||||
|
||||
// This is set by JNI_OnLoad() when the .so is initially loaded.
|
||||
// Must use to attach each thread that will use JNI:
|
||||
namespace OVR {
|
||||
// PLATFORMACTIVITY_REMOVAL: Temp workaround for PlatformActivity being
|
||||
// stripped from UnityPlugin. Alternate is to use LOCAL_WHOLE_STATIC_LIBRARIES
|
||||
// but that increases the size of the plugin by ~1MiB
|
||||
extern int linkerPlatformActivity;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
class GVRMainWindow;
|
||||
class RenderingClient;
|
||||
class QKeyEvent;
|
||||
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
#endif
|
||||
#define qApp (static_cast<GVRInterface*>(QApplication::instance()))
|
||||
|
||||
class GVRInterface : public QApplication {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GVRInterface(int argc, char* argv[]);
|
||||
RenderingClient* getClient() { return _client; }
|
||||
|
||||
void setMainWindow(GVRMainWindow* mainWindow) { _mainWindow = mainWindow; }
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
private slots:
|
||||
void handleApplicationStateChange(Qt::ApplicationState state);
|
||||
void idle();
|
||||
private:
|
||||
void handleApplicationQuit();
|
||||
|
||||
void enterVRMode();
|
||||
void leaveVRMode();
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
ovrMobile* _ovr;
|
||||
ovrHmdInfo* _hmdInfo;
|
||||
#endif
|
||||
|
||||
GVRMainWindow* _mainWindow;
|
||||
|
||||
RenderingClient* _client;
|
||||
bool _inVRMode;
|
||||
};
|
||||
|
||||
#endif // hifi_GVRInterface_h
|
|
@ -1,176 +0,0 @@
|
|||
//
|
||||
// GVRMainWindow.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/14.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#include "GVRMainWindow.h"
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
|
||||
#ifndef ANDROID
|
||||
|
||||
#include <QtWidgets/QDesktopWidget>
|
||||
|
||||
#elif defined(HAVE_LIBOVR)
|
||||
|
||||
#include <OVR_CAPI.h>
|
||||
|
||||
const float LIBOVR_DOUBLE_TAP_DURATION = 0.25f;
|
||||
const float LIBOVR_LONG_PRESS_DURATION = 0.75f;
|
||||
|
||||
#endif
|
||||
|
||||
#include <AddressManager.h>
|
||||
|
||||
#include "InterfaceView.h"
|
||||
#include "LoginDialog.h"
|
||||
#include "RenderingClient.h"
|
||||
|
||||
|
||||
|
||||
GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
_backKeyState(LIBOVR_DOUBLE_TAP_DURATION, LIBOVR_LONG_PRESS_DURATION),
|
||||
_wasBackKeyDown(false),
|
||||
#endif
|
||||
_mainLayout(NULL),
|
||||
_menuBar(NULL),
|
||||
_loginAction(NULL)
|
||||
{
|
||||
|
||||
#ifndef ANDROID
|
||||
const int NOTE_4_WIDTH = 2560;
|
||||
const int NOTE_4_HEIGHT = 1440;
|
||||
setFixedSize(NOTE_4_WIDTH / 2, NOTE_4_HEIGHT / 2);
|
||||
#endif
|
||||
|
||||
setupMenuBar();
|
||||
|
||||
QWidget* baseWidget = new QWidget(this);
|
||||
|
||||
// setup a layout so we can vertically align to top
|
||||
_mainLayout = new QVBoxLayout(baseWidget);
|
||||
_mainLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
// set the layout on the base widget
|
||||
baseWidget->setLayout(_mainLayout);
|
||||
|
||||
setCentralWidget(baseWidget);
|
||||
|
||||
// add the interface view
|
||||
new InterfaceView(baseWidget);
|
||||
}
|
||||
|
||||
GVRMainWindow::~GVRMainWindow() {
|
||||
delete _menuBar;
|
||||
}
|
||||
|
||||
void GVRMainWindow::keyPressEvent(QKeyEvent* event) {
|
||||
#ifdef ANDROID
|
||||
if (event->key() == Qt::Key_Back) {
|
||||
// got the Android back key, hand off to OVR KeyState
|
||||
_backKeyState.HandleEvent(ovr_GetTimeInSeconds(), true, (_wasBackKeyDown ? 1 : 0));
|
||||
_wasBackKeyDown = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void GVRMainWindow::keyReleaseEvent(QKeyEvent* event) {
|
||||
#ifdef ANDROID
|
||||
if (event->key() == Qt::Key_Back) {
|
||||
// release on the Android back key, hand off to OVR KeyState
|
||||
_backKeyState.HandleEvent(ovr_GetTimeInSeconds(), false, 0);
|
||||
_wasBackKeyDown = false;
|
||||
}
|
||||
#endif
|
||||
QWidget::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void GVRMainWindow::setupMenuBar() {
|
||||
QMenu* fileMenu = new QMenu("File");
|
||||
QMenu* helpMenu = new QMenu("Help");
|
||||
|
||||
_menuBar = new QMenuBar(0);
|
||||
|
||||
_menuBar->addMenu(fileMenu);
|
||||
_menuBar->addMenu(helpMenu);
|
||||
|
||||
QAction* goToAddress = new QAction("Go to Address", fileMenu);
|
||||
connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
|
||||
fileMenu->addAction(goToAddress);
|
||||
|
||||
_loginAction = new QAction("Login", fileMenu);
|
||||
fileMenu->addAction(_loginAction);
|
||||
|
||||
// change the login action depending on our logged in/out state
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
connect(&accountManager, &AccountManager::loginComplete, this, &GVRMainWindow::refreshLoginAction);
|
||||
connect(&accountManager, &AccountManager::logoutComplete, this, &GVRMainWindow::refreshLoginAction);
|
||||
|
||||
// refresh the state now
|
||||
refreshLoginAction();
|
||||
|
||||
QAction* aboutQt = new QAction("About Qt", helpMenu);
|
||||
connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
||||
helpMenu->addAction(aboutQt);
|
||||
|
||||
setMenuBar(_menuBar);
|
||||
}
|
||||
|
||||
void GVRMainWindow::showAddressBar() {
|
||||
// setup the address QInputDialog
|
||||
QInputDialog* addressDialog = new QInputDialog(this);
|
||||
addressDialog->setLabelText("Address");
|
||||
|
||||
// add the address dialog to the main layout
|
||||
_mainLayout->addWidget(addressDialog);
|
||||
|
||||
connect(addressDialog, &QInputDialog::textValueSelected,
|
||||
DependencyManager::get<AddressManager>().data(), &AddressManager::handleLookupString);
|
||||
}
|
||||
|
||||
void GVRMainWindow::showLoginDialog() {
|
||||
LoginDialog* loginDialog = new LoginDialog(this);
|
||||
|
||||
// have the acccount manager handle credentials from LoginDialog
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
connect(loginDialog, &LoginDialog::credentialsEntered, &accountManager, &AccountManager::requestAccessToken);
|
||||
connect(&accountManager, &AccountManager::loginFailed, this, &GVRMainWindow::showLoginFailure);
|
||||
|
||||
_mainLayout->addWidget(loginDialog);
|
||||
}
|
||||
|
||||
void GVRMainWindow::showLoginFailure() {
|
||||
QMessageBox::warning(this, "Login Failed",
|
||||
"Could not log in with that username and password. Please try again!");
|
||||
}
|
||||
|
||||
void GVRMainWindow::refreshLoginAction() {
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
disconnect(_loginAction, &QAction::triggered, &accountManager, 0);
|
||||
|
||||
if (accountManager.isLoggedIn()) {
|
||||
_loginAction->setText("Logout");
|
||||
connect(_loginAction, &QAction::triggered, &accountManager, &AccountManager::logout);
|
||||
} else {
|
||||
_loginAction->setText("Login");
|
||||
connect(_loginAction, &QAction::triggered, this, &GVRMainWindow::showLoginDialog);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
//
|
||||
// GVRMainWindow.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/14.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#ifndef hifi_GVRMainWindow_h
|
||||
#define hifi_GVRMainWindow_h
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
#include <KeyState.h>
|
||||
#endif
|
||||
|
||||
class QKeyEvent;
|
||||
class QMenuBar;
|
||||
class QVBoxLayout;
|
||||
|
||||
class GVRMainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GVRMainWindow(QWidget* parent = 0);
|
||||
~GVRMainWindow();
|
||||
public slots:
|
||||
void showAddressBar();
|
||||
void showLoginDialog();
|
||||
|
||||
void showLoginFailure();
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
OVR::KeyState& getBackKeyState() { return _backKeyState; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void keyReleaseEvent(QKeyEvent* event);
|
||||
private slots:
|
||||
void refreshLoginAction();
|
||||
private:
|
||||
void setupMenuBar();
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
OVR::KeyState _backKeyState;
|
||||
bool _wasBackKeyDown;
|
||||
#endif
|
||||
|
||||
QVBoxLayout* _mainLayout;
|
||||
QMenuBar* _menuBar;
|
||||
QAction* _loginAction;
|
||||
};
|
||||
|
||||
#endif // hifi_GVRMainWindow_h
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// InterfaceView.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/28/14.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#include "InterfaceView.h"
|
||||
|
||||
InterfaceView::InterfaceView(QWidget* parent, Qt::WindowFlags flags) :
|
||||
QOpenGLWidget(parent, flags)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// InterfaceView.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/28/14.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#ifndef hifi_InterfaceView_h
|
||||
#define hifi_InterfaceView_h
|
||||
|
||||
#include <QtWidgets/QOpenGLWidget>
|
||||
|
||||
class InterfaceView : public QOpenGLWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
InterfaceView(QWidget* parent = 0, Qt::WindowFlags flags = 0);
|
||||
};
|
||||
|
||||
#endif // hifi_InterfaceView_h
|
|
@ -1,69 +0,0 @@
|
|||
//
|
||||
// LoginDialog.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 2015-02-03.
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
#include "LoginDialog.h"
|
||||
|
||||
#include <QtWidgets/QDialogButtonBox>
|
||||
#include <QtWidgets/QGridLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
LoginDialog::LoginDialog(QWidget* parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setupGUI();
|
||||
setWindowTitle("Login");
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
void LoginDialog::setupGUI() {
|
||||
// setup a grid layout
|
||||
QGridLayout* formGridLayout = new QGridLayout(this);
|
||||
|
||||
_usernameLineEdit = new QLineEdit(this);
|
||||
|
||||
QLabel* usernameLabel = new QLabel(this);
|
||||
usernameLabel->setText("Username");
|
||||
usernameLabel->setBuddy(_usernameLineEdit);
|
||||
|
||||
formGridLayout->addWidget(usernameLabel, 0, 0);
|
||||
formGridLayout->addWidget(_usernameLineEdit, 1, 0);
|
||||
|
||||
_passwordLineEdit = new QLineEdit(this);
|
||||
_passwordLineEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
QLabel* passwordLabel = new QLabel(this);
|
||||
passwordLabel->setText("Password");
|
||||
passwordLabel->setBuddy(_passwordLineEdit);
|
||||
|
||||
formGridLayout->addWidget(passwordLabel, 2, 0);
|
||||
formGridLayout->addWidget(_passwordLineEdit, 3, 0);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(this);
|
||||
|
||||
QPushButton* okButton = buttons->addButton(QDialogButtonBox::Ok);
|
||||
QPushButton* cancelButton = buttons->addButton(QDialogButtonBox::Cancel);
|
||||
|
||||
okButton->setText("Login");
|
||||
|
||||
connect(cancelButton, &QPushButton::clicked, this, &QDialog::close);
|
||||
connect(okButton, &QPushButton::clicked, this, &LoginDialog::loginButtonClicked);
|
||||
|
||||
formGridLayout->addWidget(buttons, 4, 0, 1, 2);
|
||||
|
||||
setLayout(formGridLayout);
|
||||
}
|
||||
|
||||
void LoginDialog::loginButtonClicked() {
|
||||
emit credentialsEntered(_usernameLineEdit->text(), _passwordLineEdit->text());
|
||||
close();
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
//
|
||||
// LoginDialog.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 2015-02-03.
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
#ifndef hifi_LoginDialog_h
|
||||
#define hifi_LoginDialog_h
|
||||
|
||||
#include <QtWidgets/QDialog>
|
||||
|
||||
class QLineEdit;
|
||||
|
||||
class LoginDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoginDialog(QWidget* parent = 0);
|
||||
signals:
|
||||
void credentialsEntered(const QString& username, const QString& password);
|
||||
private slots:
|
||||
void loginButtonClicked();
|
||||
private:
|
||||
void setupGUI();
|
||||
|
||||
QLineEdit* _usernameLineEdit;
|
||||
QLineEdit* _passwordLineEdit;
|
||||
};
|
||||
|
||||
#endif // hifi_LoginDialog_h
|
|
@ -1,156 +0,0 @@
|
|||
//
|
||||
// RenderingClient.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
#include "RenderingClient.h"
|
||||
|
||||
#include <QtCore/QThread>
|
||||
#include <QtWidgets/QInputDialog>
|
||||
|
||||
#include <AddressManager.h>
|
||||
#include <AudioClient.h>
|
||||
#include <AvatarHashMap.h>
|
||||
#include <NodeList.h>
|
||||
|
||||
RenderingClient* RenderingClient::_instance = NULL;
|
||||
|
||||
RenderingClient::RenderingClient(QObject *parent, const QString& launchURLString) :
|
||||
Client(parent)
|
||||
{
|
||||
_instance = this;
|
||||
|
||||
// connect to AddressManager and pass it the launch URL, if we have one
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
connect(addressManager.data(), &AddressManager::locationChangeRequired, this, &RenderingClient::goToLocation);
|
||||
addressManager->loadSettings(launchURLString);
|
||||
|
||||
// tell the NodeList which node types all rendering clients will want to know about
|
||||
DependencyManager::get<NodeList>()->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer);
|
||||
|
||||
DependencyManager::set<AvatarHashMap>();
|
||||
|
||||
// get our audio client setup on its own thread
|
||||
auto audioClient = DependencyManager::set<AudioClient>();
|
||||
audioClient->setPositionGetter(getPositionForAudio);
|
||||
audioClient->setOrientationGetter(getOrientationForAudio);
|
||||
audioClient->startThread();
|
||||
|
||||
|
||||
connect(&_avatarTimer, &QTimer::timeout, this, &RenderingClient::sendAvatarPacket);
|
||||
_avatarTimer.setInterval(16); // 60 FPS
|
||||
_avatarTimer.start();
|
||||
_fakeAvatar.setDisplayName("GearVR");
|
||||
_fakeAvatar.setFaceModelURL(QUrl(DEFAULT_HEAD_MODEL_URL));
|
||||
_fakeAvatar.setSkeletonModelURL(QUrl(DEFAULT_BODY_MODEL_URL));
|
||||
_fakeAvatar.toByteArray(); // Creates HeadData
|
||||
}
|
||||
|
||||
void RenderingClient::sendAvatarPacket() {
|
||||
_fakeAvatar.setPosition(_position);
|
||||
_fakeAvatar.setHeadOrientation(_orientation);
|
||||
|
||||
QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
|
||||
packet.append(_fakeAvatar.toByteArray());
|
||||
DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
|
||||
_fakeAvatar.sendIdentityPacket();
|
||||
}
|
||||
|
||||
void RenderingClient::cleanupBeforeQuit() {
|
||||
DependencyManager::get<AudioClient>()->cleanupBeforeQuit();
|
||||
// destroy the AudioClient so it and its thread will safely go down
|
||||
DependencyManager::destroy<AudioClient>();
|
||||
}
|
||||
|
||||
void RenderingClient::processVerifiedPacket(const HifiSockAddr& senderSockAddr, const QByteArray& incomingPacket) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
PacketType incomingType = packetTypeForPacket(incomingPacket);
|
||||
|
||||
switch (incomingType) {
|
||||
case PacketTypeAudioEnvironment:
|
||||
case PacketTypeAudioStreamStats:
|
||||
case PacketTypeMixedAudio:
|
||||
case PacketTypeSilentAudioFrame: {
|
||||
|
||||
if (incomingType == PacketTypeAudioStreamStats) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "parseAudioStreamStatsPacket",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
} else if (incomingType == PacketTypeAudioEnvironment) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "parseAudioEnvironmentData",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
} else {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "addReceivedAudioToStream",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
}
|
||||
|
||||
// update having heard from the audio-mixer and record the bytes received
|
||||
SharedNodePointer audioMixer = nodeList->sendingNodeForPacket(incomingPacket);
|
||||
|
||||
if (audioMixer) {
|
||||
audioMixer->setLastHeardMicrostamp(usecTimestampNow());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case PacketTypeBulkAvatarData:
|
||||
case PacketTypeKillAvatar:
|
||||
case PacketTypeAvatarIdentity:
|
||||
case PacketTypeAvatarBillboard: {
|
||||
// update having heard from the avatar-mixer and record the bytes received
|
||||
SharedNodePointer avatarMixer = nodeList->sendingNodeForPacket(incomingPacket);
|
||||
|
||||
if (avatarMixer) {
|
||||
avatarMixer->setLastHeardMicrostamp(usecTimestampNow());
|
||||
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AvatarHashMap>().data(),
|
||||
"processAvatarMixerDatagram",
|
||||
Q_ARG(const QByteArray&, incomingPacket),
|
||||
Q_ARG(const QWeakPointer<Node>&, avatarMixer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Client::processVerifiedPacket(senderSockAddr, incomingPacket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderingClient::goToLocation(const glm::vec3& newPosition,
|
||||
bool hasOrientationChange, const glm::quat& newOrientation,
|
||||
bool shouldFaceLocation) {
|
||||
qDebug().nospace() << "RenderingClient goToLocation - moving to " << newPosition.x << ", "
|
||||
<< newPosition.y << ", " << newPosition.z;
|
||||
|
||||
glm::vec3 shiftedPosition = newPosition;
|
||||
|
||||
if (hasOrientationChange) {
|
||||
qDebug().nospace() << "RenderingClient goToLocation - new orientation is "
|
||||
<< newOrientation.x << ", " << newOrientation.y << ", " << newOrientation.z << ", " << newOrientation.w;
|
||||
|
||||
// orient the user to face the target
|
||||
glm::quat quatOrientation = newOrientation;
|
||||
|
||||
if (shouldFaceLocation) {
|
||||
|
||||
quatOrientation = newOrientation * glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
// move the user a couple units away
|
||||
const float DISTANCE_TO_USER = 2.0f;
|
||||
shiftedPosition = newPosition - quatOrientation * glm::vec3( 0.0f, 0.0f,-1.0f) * DISTANCE_TO_USER;
|
||||
}
|
||||
|
||||
_orientation = quatOrientation;
|
||||
}
|
||||
|
||||
_position = shiftedPosition;
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
//
|
||||
// RenderingClient.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 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
|
||||
//
|
||||
|
||||
|
||||
#ifndef hifi_RenderingClient_h
|
||||
#define hifi_RenderingClient_h
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include <AvatarData.h>
|
||||
|
||||
#include "Client.h"
|
||||
|
||||
class RenderingClient : public Client {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RenderingClient(QObject* parent = 0, const QString& launchURLString = QString());
|
||||
|
||||
const glm::vec3& getPosition() const { return _position; }
|
||||
const glm::quat& getOrientation() const { return _orientation; }
|
||||
void setOrientation(const glm::quat& orientation) { _orientation = orientation; }
|
||||
|
||||
static glm::vec3 getPositionForAudio() { return _instance->getPosition(); }
|
||||
static glm::quat getOrientationForAudio() { return _instance->getOrientation(); }
|
||||
|
||||
virtual void cleanupBeforeQuit();
|
||||
|
||||
private slots:
|
||||
void goToLocation(const glm::vec3& newPosition,
|
||||
bool hasOrientationChange, const glm::quat& newOrientation,
|
||||
bool shouldFaceLocation);
|
||||
void sendAvatarPacket();
|
||||
|
||||
private:
|
||||
virtual void processVerifiedPacket(const HifiSockAddr& senderSockAddr, const QByteArray& incomingPacket);
|
||||
|
||||
static RenderingClient* _instance;
|
||||
|
||||
glm::vec3 _position;
|
||||
glm::quat _orientation;
|
||||
|
||||
QTimer _avatarTimer;
|
||||
AvatarData _fakeAvatar;
|
||||
};
|
||||
|
||||
#endif // hifi_RenderingClient_h
|
|
@ -1,41 +0,0 @@
|
|||
//
|
||||
// InterfaceActivity.java
|
||||
// gvr-interface/java
|
||||
//
|
||||
// Created by Stephen Birarda on 1/26/15.
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
package io.highfidelity.gvrinterface;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
import android.util.Log;
|
||||
import org.qtproject.qt5.android.bindings.QtActivity;
|
||||
|
||||
public class InterfaceActivity extends QtActivity {
|
||||
|
||||
public static native void handleHifiURL(String hifiURLString);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
// Get the intent that started this activity in case we have a hifi:// URL to parse
|
||||
Intent intent = getIntent();
|
||||
if (intent.getAction() == Intent.ACTION_VIEW) {
|
||||
Uri data = intent.getData();
|
||||
|
||||
if (data.getScheme().equals("hifi")) {
|
||||
handleHifiURL(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
//
|
||||
// main.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 11/17/14.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#include "GVRMainWindow.h"
|
||||
#include "GVRInterface.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
GVRInterface app(argc, argv);
|
||||
|
||||
GVRMainWindow mainWindow;
|
||||
#ifdef ANDROID
|
||||
mainWindow.showFullScreen();
|
||||
#else
|
||||
mainWindow.showMaximized();
|
||||
#endif
|
||||
|
||||
app.setMainWindow(&mainWindow);
|
||||
|
||||
return app.exec();
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
//
|
||||
// InterfaceBetaActivity.java
|
||||
// gvr-interface/java
|
||||
//
|
||||
// Created by Stephen Birarda on 1/27/15.
|
||||
// Copyright 2015 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
|
||||
//
|
||||
|
||||
package io.highfidelity.gvrinterface;
|
||||
|
||||
import android.os.Bundle;
|
||||
import net.hockeyapp.android.CrashManager;
|
||||
import net.hockeyapp.android.UpdateManager;
|
||||
|
||||
public class InterfaceBetaActivity extends InterfaceActivity {
|
||||
|
||||
public String _hockeyAppID;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
_hockeyAppID = getString(R.string.HockeyAppID);
|
||||
|
||||
checkForUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
UpdateManager.unregister();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
checkForCrashes();
|
||||
}
|
||||
|
||||
private void checkForCrashes() {
|
||||
CrashManager.register(this, _hockeyAppID);
|
||||
}
|
||||
|
||||
private void checkForUpdates() {
|
||||
// Remove this for store / production builds!
|
||||
UpdateManager.register(this, _hockeyAppID);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="HockeyAppID">${HOCKEY_APP_ID}</string>
|
||||
<bool name="HockeyAppEnabled">${HOCKEY_APP_ENABLED}</bool>
|
||||
</resources>
|
Loading…
Reference in a new issue