Merge remote-tracking branch 'upstream/master' into vive-ui

This commit is contained in:
Bradley Austin Davis 2016-06-17 10:56:53 -07:00
commit 5bc8b53d1b
22 changed files with 216 additions and 51 deletions

View file

@ -0,0 +1,62 @@
include(ExternalProject)
set(EXTERNAL_NAME steamworks)
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
set(STEAMWORKS_URL "https://s3.amazonaws.com/hifi-public/dependencies/steamworks_sdk_137.zip")
set(STEAMWORKS_URL_MD5 "95ba9d0e3ddc04f8a8be17d2da806cbb")
ExternalProject_Add(
${EXTERNAL_NAME}
URL ${STEAMWORKS_URL}
URL_MD5 ${STEAMWORKS_URL_MD5}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
)
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/public CACHE TYPE INTERNAL)
if (WIN32)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(ARCH_DIR ${SOURCE_DIR}/redistributable_bin/win64)
set(ARCH_SUFFIX "64")
else()
set(ARCH_DIR ${SOURCE_DIR}/redistributable_bin)
set(ARCH_SUFFIX "")
endif()
set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${ARCH_DIR})
set(${EXTERNAL_NAME_UPPER}_LIB_PATH ${ARCH_DIR})
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/steam_api${ARCH_SUFFIX}.lib" CACHE TYPE INTERNAL)
add_paths_to_fixup_libs("${${EXTERNAL_NAME_UPPER}_DLL_PATH}")
elseif(APPLE)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/osx32/libsteam_api.dylib CACHE TYPE INTERNAL)
set(_STEAMWORKS_LIB_DIR "${SOURCE_DIR}/redistributable_bin/osx32")
ExternalProject_Add_Step(
${EXTERNAL_NAME}
change-install-name
COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking"
COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${_STEAMWORKS_LIB_DIR} -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake
DEPENDEES install
WORKING_DIRECTORY <SOURCE_DIR>
LOG 1
)
elseif(NOT ANDROID)
# FIXME need to account for different architectures
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/linux64/libsteam_api.so CACHE TYPE INTERNAL)
endif()

View file

@ -0,0 +1,13 @@
#
# Copyright 2015 High Fidelity, Inc.
# Created by Clement Brisset on 6/8/2016
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(TARGET_STEAMWORKS)
add_dependency_external_projects(steamworks)
find_package(Steamworks REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${STEAMWORKS_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${STEAMWORKS_LIBRARIES})
endmacro()

View file

@ -0,0 +1,29 @@
#
# FindSteamworks.cmake
#
# Try to find the Steamworks controller library
#
# This module defines the following variables
#
# STEAMWORKS_FOUND - Was Steamworks found
# STEAMWORKS_INCLUDE_DIRS - the Steamworks include directory
# STEAMWORKS_LIBRARIES - Link this to use Steamworks
#
# This module accepts the following variables
#
# STEAMWORKS_ROOT - Can be set to steamworks install path or Windows build path
#
# Created on 6/8/2016 by Clement Brisset
# Copyright 2016 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(SelectLibraryConfigurations)
select_library_configurations(STEAMWORKS)
set(STEAMWORKS_REQUIREMENTS STEAMWORKS_INCLUDE_DIRS STEAMWORKS_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Steamworks DEFAULT_MSG STEAMWORKS_INCLUDE_DIRS STEAMWORKS_LIBRARIES)
mark_as_advanced(STEAMWORKS_LIBRARIES STEAMWORKS_INCLUDE_DIRS STEAMWORKS_SEARCH_DIRS)

View file

@ -139,7 +139,7 @@ link_hifi_libraries(shared octree gpu gl gpu-gl procedural model render
recording fbx networking model-networking entities avatars
audio audio-client animation script-engine physics
render-utils entities-renderer ui auto-updater
controllers plugins display-plugins input-plugins)
controllers plugins display-plugins input-plugins steamworks-wrapper)
# include the binary directory of render-utils for shader includes
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_BINARY_DIR}/libraries/render-utils")

View file

@ -389,7 +389,10 @@ bool setupEssentials(int& argc, char** argv) {
Setting::preInit();
bool previousSessionCrashed = CrashHandler::checkForResetSettings();
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
bool previousSessionCrashed = CrashHandler::checkForResetSettings(suppressPrompt);
CrashHandler::writeRunningMarkerFiler();
qAddPostRoutine(CrashHandler::deleteRunningMarkerFile);
@ -2916,7 +2919,7 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt
}
});
if (success) {
exportTree->writeToJSONFile(filename.toLocal8Bit().constData());
success = exportTree->writeToJSONFile(filename.toLocal8Bit().constData());
// restore the main window's active state
_window->activateWindow();
@ -5145,13 +5148,6 @@ void Application::updateDisplayMode() {
QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) {
resizeGL();
});
QObject::connect(displayPlugin.get(), &DisplayPlugin::outputDeviceLost, [this, displayPluginName] {
PluginManager::getInstance()->disableDisplayPlugin(displayPluginName);
auto menu = Menu::getInstance();
if (menu->menuItemExists(MenuOption::OutputMenu, displayPluginName)) {
menu->removeMenuItem(MenuOption::OutputMenu, displayPluginName);
}
});
first = false;
}

View file

@ -27,7 +27,7 @@
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
bool CrashHandler::checkForResetSettings() {
bool CrashHandler::checkForResetSettings(bool suppressPrompt) {
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings settings;
settings.beginGroup("Developer");
@ -42,6 +42,10 @@ bool CrashHandler::checkForResetSettings() {
QFile runningMarkerFile(runningMarkerFilePath());
bool wasLikelyCrash = runningMarkerFile.exists();
if (suppressPrompt) {
return wasLikelyCrash;
}
if (wasLikelyCrash || askToResetSettings) {
if (displaySettingsResetOnCrash || askToResetSettings) {
Action action = promptUserForAction(wasLikelyCrash);

View file

@ -17,7 +17,7 @@
class CrashHandler {
public:
static bool checkForResetSettings();
static bool checkForResetSettings(bool suppressPrompt = false);
static void writeRunningMarkerFiler();
static void deleteRunningMarkerFile();

View file

@ -189,7 +189,7 @@ void EntityTreeElement::elementEncodeComplete(EncodeBitstreamParams& params) con
// encoud our parent... this might happen.
if (extraEncodeData->contains(childElement.get())) {
EntityTreeElementExtraEncodeData* childExtraEncodeData
= static_cast<EntityTreeElementExtraEncodeData*>(extraEncodeData->value(childElement.get()));
= static_cast<EntityTreeElementExtraEncodeData*>((*extraEncodeData)[childElement.get()]);
if (wantDebug) {
qCDebug(entities) << "checking child: " << childElement->_cube;

View file

@ -1868,24 +1868,26 @@ bool Octree::readJSONFromStream(unsigned long streamLength, QDataStream& inputSt
return success;
}
void Octree::writeToFile(const char* fileName, OctreeElementPointer element, QString persistAsFileType) {
bool Octree::writeToFile(const char* fileName, OctreeElementPointer element, QString persistAsFileType) {
// make the sure file extension makes sense
QString qFileName = fileNameWithoutExtension(QString(fileName), PERSIST_EXTENSIONS) + "." + persistAsFileType;
QByteArray byteArray = qFileName.toUtf8();
const char* cFileName = byteArray.constData();
bool success = false;
if (persistAsFileType == "svo") {
writeToSVOFile(fileName, element);
success = writeToSVOFile(fileName, element);
} else if (persistAsFileType == "json") {
writeToJSONFile(cFileName, element);
success = writeToJSONFile(cFileName, element);
} else if (persistAsFileType == "json.gz") {
writeToJSONFile(cFileName, element, true);
success = writeToJSONFile(cFileName, element, true);
} else {
qCDebug(octree) << "unable to write octree to file of type" << persistAsFileType;
}
return success;
}
void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool doGzip) {
bool Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool doGzip) {
QVariantMap entityDescription;
qCDebug(octree, "Saving JSON SVO to file %s...", fileName);
@ -1906,7 +1908,7 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element,
bool entityDescriptionSuccess = writeToMap(entityDescription, top, true, true);
if (!entityDescriptionSuccess) {
qCritical("Failed to convert Entities to QVariantMap while saving to json.");
return;
return false;
}
// convert the QVariantMap to JSON
@ -1916,22 +1918,26 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element,
if (doGzip) {
if (!gzip(jsonData, jsonDataForFile, -1)) {
qCritical("unable to gzip data while saving to json.");
return;
return false;
}
} else {
jsonDataForFile = jsonData;
}
QFile persistFile(fileName);
bool success = false;
if (persistFile.open(QIODevice::WriteOnly)) {
persistFile.write(jsonDataForFile);
success = persistFile.write(jsonDataForFile) != -1;
} else {
qCritical("Could not write to JSON description of entities.");
}
return success;
}
void Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) {
qWarning() << "SVO file format depricated. Support for reading SVO files is no longer support and will be removed soon.";
bool Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) {
qWarning() << "SVO file format deprecated. Support for reading SVO files is no longer support and will be removed soon.";
bool success = false;
std::ofstream file(fileName, std::ios::out|std::ios::binary);
@ -2010,8 +2016,12 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element)
}
releaseSceneEncodeData(&extraEncodeData);
success = true;
}
file.close();
return success;
}
unsigned long Octree::getOctreeElementsCount() {

View file

@ -299,9 +299,9 @@ public:
void loadOctreeFile(const char* fileName);
// Octree exporters
void writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo");
void writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false);
void writeToSVOFile(const char* filename, OctreeElementPointer element = NULL);
bool writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo");
bool writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false);
bool writeToSVOFile(const char* filename, OctreeElementPointer element = NULL);
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
bool skipThoseWithBadParents) = 0;

View file

@ -210,10 +210,6 @@ public:
signals:
void recommendedFramebufferSizeChanged(const QSize & size);
// Indicates that this display plugin is no longer valid for use.
// For instance if a user exits Oculus Home or Steam VR while
// using the corresponding plugin, that plugin should be disabled.
void outputDeviceLost();
protected:
void incrementPresentCount();

View file

@ -96,7 +96,9 @@ bool Procedural::parseVersion(const QJsonValue& version) {
bool Procedural::parseUrl(const QUrl& shaderUrl) {
if (!shaderUrl.isValid()) {
qWarning() << "Invalid shader URL: " << shaderUrl;
if (!shaderUrl.isEmpty()) {
qWarning() << "Invalid shader URL: " << shaderUrl;
}
_networkShader.reset();
return false;
}

View file

@ -264,12 +264,18 @@ float snoise(vec2 v) {
return 130.0 * dot(m, g);
}
#define PROCEDURAL 1
//PROCEDURAL_VERSION
#ifdef PROCEDURAL_V1
// shader playback time (in seconds)
uniform float iGlobalTime;
// the dimensions of the object being rendered
uniform vec3 iWorldScale;
#else
// Unimplemented uniforms

View file

@ -0,0 +1,5 @@
set(TARGET_NAME steamworks-wrapper)
setup_hifi_library()
link_hifi_libraries()
target_steamworks()

View file

@ -0,0 +1,19 @@
//
// SteamClient.cpp
// steamworks-wrapper/src/steamworks-wrapper
//
// Created by Clement Brisset on 6/8/16.
// Copyright 2016 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 "SteamClient.h"
#include <steam/steam_api.h>

View file

@ -0,0 +1,21 @@
//
// SteamClient.h
// steamworks-wrapper/src/steamworks-wrapper
//
// Created by Clement Brisset on 6/8/16.
// Copyright 2016 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_SteamClient_h
#define hifi_SteamClient_h
class SteamClient {
};
#endif // hifi_SteamClient_h

View file

@ -134,10 +134,7 @@ void OpenVrDisplayPlugin::resetSensors() {
bool OpenVrDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
handleOpenVrEvents();
if (openVrQuitRequested()) {
emit outputDeviceLost();
return false;
}
double displayFrequency = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float);
double frameDuration = 1.f / displayFrequency;
double vsyncToPhotons = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SecondsFromVsyncToPhotons_Float);

View file

@ -31,11 +31,6 @@ using Lock = std::unique_lock<Mutex>;
static int refCount { 0 };
static Mutex mutex;
static vr::IVRSystem* activeHmd { nullptr };
static bool _openVrQuitRequested { false };
bool openVrQuitRequested() {
return _openVrQuitRequested;
}
static const uint32_t RELEASE_OPENVR_HMD_DELAY_MS = 5000;
@ -89,7 +84,6 @@ void releaseOpenVrSystem() {
if (0 == refCount) {
qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system";
vr::VR_Shutdown();
_openVrQuitRequested = false;
activeHmd = nullptr;
}
}
@ -228,8 +222,8 @@ void handleOpenVrEvents() {
while (activeHmd->PollNextEvent(&event, sizeof(event))) {
switch (event.eventType) {
case vr::VREvent_Quit:
_openVrQuitRequested = true;
activeHmd->AcknowledgeQuit_Exiting();
QMetaObject::invokeMethod(qApp, "quit");
break;
case vr::VREvent_KeyboardDone:
@ -244,7 +238,7 @@ void handleOpenVrEvents() {
default:
break;
}
qDebug() << "OpenVR: Event " << event.eventType;
qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")";
}
}

View file

@ -213,10 +213,6 @@ void ViveControllerManager::renderHand(const controller::Pose& pose, gpu::Batch&
void ViveControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
handleOpenVrEvents();
if (openVrQuitRequested()) {
deactivate();
return;
}
// because update mutates the internal state we need to lock
userInputMapper->withLock([&, this]() {

View file

@ -671,7 +671,6 @@
} else {
for (var i = 0; i < elShapeSections.length; i++) {
console.log("Hiding shape section " + elShapeSections[i])
elShapeSections[i].style.display = 'none';
}
}
@ -805,8 +804,10 @@
}
var activeElement = document.activeElement;
activeElement.select();
if(typeof activeElement.select!=="undefined"){
activeElement.select();
}
}
}
});

View file

@ -48,7 +48,7 @@ var selectedInputMenu = "";
var selectedOutputMenu = "";
function setupAudioMenus() {
Menu.addMenu("Audio > Devices", "Advanced");
Menu.addMenu("Audio > Devices");
Menu.addSeparator("Audio > Devices","Output Audio Device");
var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING);

View file

@ -515,6 +515,20 @@ function maybeInstallDefaultContentSet(onComplete) {
return;
}
console.log("Found contentPath:" + argv.contentPath);
if (argv.contentPath) {
fs.copy(argv.contentPath, getRootHifiDataDirectory(), function (err) {
if (err) {
console.log('Could not copy home content: ' + err);
return console.error(err)
}
console.log('Copied home content over to: ' + getRootHifiDataDirectory());
onComplete();
});
return;
}
// Show popup
var window = new BrowserWindow({
icon: appIcon,