diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index bc35d2f2f8..3615b80cda 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -89,7 +89,7 @@ if (APPLE)
string(REGEX MATCH "^[0-9]+\\.[0-9]+" OSX_VERSION ${OSX_VERSION})
message(STATUS "Detected OS X version = ${OSX_VERSION}")
- set(OSX_SDK "${OSX_VERSION}" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH")
+ set(OSX_SDK "${OSX_VERSION}" CACHE STRING "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH")
# set our OS X deployment target
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
diff --git a/cmake/externals/LibOVR/CMakeLists.txt b/cmake/externals/LibOVR/CMakeLists.txt
index 481753f7e0..53c4c2976c 100644
--- a/cmake/externals/LibOVR/CMakeLists.txt
+++ b/cmake/externals/LibOVR/CMakeLists.txt
@@ -27,12 +27,12 @@ if (WIN32)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
set(LIBOVR_DIR ${INSTALL_DIR})
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${LIBOVR_DIR}/Include CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${LIBOVR_DIR}/Lib/LibOVRd.lib CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${LIBOVR_DIR}/Lib/LibOVR.lib CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${LIBOVR_DIR}/Include CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${LIBOVR_DIR}/Lib/LibOVRd.lib CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${LIBOVR_DIR}/Lib/LibOVR.lib CACHE STRING INTERNAL)
include(SelectLibraryConfigurations)
select_library_configurations(LIBOVR)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARIES} CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARIES} CACHE STRING INTERNAL)
elseif(APPLE)
@@ -50,11 +50,11 @@ elseif(APPLE)
# In theory we should use the Headers path inside the framework, as seen here
# but unfortunately Oculus doesn't seem to have figured out automated testing
# so they released a framework with missing headers.
- #set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Lib/Mac/Release/LibOVR.framework/Headers/ CACHE TYPE INTERNAL)
+ #set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Lib/Mac/Release/LibOVR.framework/Headers/ CACHE STRING INTERNAL)
# Work around the broken framework by using a different path for the headers.
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Include CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/LibOVR/Lib/Mac/Release/LibOVR.framework/LibOVR CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Include CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/LibOVR/Lib/Mac/Release/LibOVR.framework/LibOVR CACHE STRING INTERNAL)
@@ -74,8 +74,8 @@ elseif(NOT ANDROID)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libovr.a CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG "" CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libovr.a CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG "" CACHE STRING INTERNAL)
find_package(Threads REQUIRED)
find_package(X11 REQUIRED)
@@ -89,8 +89,8 @@ elseif(NOT ANDROID)
select_library_configurations(${EXTERNAL_NAME_UPPER})
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Include ${SOURCE_DIR}/LibOVR/Src CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARY} ${${EXTERNAL_NAME_UPPER}_LIBRARY_EXTRAS} CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/LibOVR/Include ${SOURCE_DIR}/LibOVR/Src CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARY} ${${EXTERNAL_NAME_UPPER}_LIBRARY_EXTRAS} CACHE STRING INTERNAL)
endif()
# Hide this external target (for ide users)
diff --git a/cmake/externals/LibOVRPlatform/CMakeLists.txt b/cmake/externals/LibOVRPlatform/CMakeLists.txt
index 895efa9357..adf89823f2 100644
--- a/cmake/externals/LibOVRPlatform/CMakeLists.txt
+++ b/cmake/externals/LibOVRPlatform/CMakeLists.txt
@@ -20,12 +20,12 @@ if (WIN32)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/Windows/LibOVRPlatform64_1.lib CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/Windows/LibOVRPlatform64_1.lib CACHE STRING INTERNAL)
else()
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/Windows/LibOVRPlatform32_1.lib CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/Windows/LibOVRPlatform32_1.lib CACHE STRING INTERNAL)
endif()
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/Include CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/Include CACHE STRING INTERNAL)
endif ()
# Hide this external target (for ide users)
diff --git a/cmake/externals/hifiAudioCodec/CMakeLists.txt b/cmake/externals/hifiAudioCodec/CMakeLists.txt
index 8a8e2573d5..5d439cd519 100644
--- a/cmake/externals/hifiAudioCodec/CMakeLists.txt
+++ b/cmake/externals/hifiAudioCodec/CMakeLists.txt
@@ -36,10 +36,10 @@ set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
-set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE INTERNAL)
+set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE STRING INTERNAL)
if (WIN32)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/audio.lib CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/audio.lib CACHE STRING INTERNAL)
else()
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/libaudio.a CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/libaudio.a CACHE STRING INTERNAL)
endif()
diff --git a/cmake/externals/neuron/CMakeLists.txt b/cmake/externals/neuron/CMakeLists.txt
index 5ac38bc442..049e175354 100644
--- a/cmake/externals/neuron/CMakeLists.txt
+++ b/cmake/externals/neuron/CMakeLists.txt
@@ -21,9 +21,9 @@ set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
# set include dir
if(WIN32)
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS "${SOURCE_DIR}/NeuronDataReader_Windows/include" CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS "${SOURCE_DIR}/NeuronDataReader_Windows/include" CACHE STRING INTERNAL)
elseif(APPLE)
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS "${SOURCE_DIR}/NeuronDataReader_Mac/include" CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS "${SOURCE_DIR}/NeuronDataReader_Mac/include" CACHE STRING INTERNAL)
else()
# Unsupported
endif()
@@ -37,16 +37,16 @@ if(WIN32)
endif()
set(${EXTERNAL_NAME_UPPER}_LIB_PATH "${SOURCE_DIR}/NeuronDataReader_Windows/lib/${ARCH_DIR}")
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.lib" CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.lib" CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.lib" CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.lib" CACHE STRING INTERNAL)
add_paths_to_fixup_libs("${${EXTERNAL_NAME_UPPER}_LIB_PATH}")
elseif(APPLE)
set(${EXTERNAL_NAME_UPPER}_LIB_PATH "${SOURCE_DIR}/NeuronDataReader_Mac/dylib")
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.dylib" CACHE TYPE INTERNAL)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.dylib" CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.dylib" CACHE STRING INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/NeuronDataReader.dylib" CACHE STRING INTERNAL)
add_paths_to_fixup_libs("${${EXTERNAL_NAME_UPPER}_LIB_PATH}")
diff --git a/cmake/externals/sixense/CMakeLists.txt b/cmake/externals/sixense/CMakeLists.txt
index 17d2f98e2d..35f7758820 100644
--- a/cmake/externals/sixense/CMakeLists.txt
+++ b/cmake/externals/sixense/CMakeLists.txt
@@ -30,7 +30,7 @@ set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
-set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE INTERNAL)
+set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE STRING INTERNAL)
if (WIN32)
@@ -52,7 +52,7 @@ if (WIN32)
set(${EXTERNAL_NAME_UPPER}_LIB_PATH "${SOURCE_DIR}/lib/${ARCH_DIR}/release_dll")
endif()
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/sixense${ARCH_SUFFIX}.lib" CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/sixense${ARCH_SUFFIX}.lib" CACHE STRING INTERNAL)
add_paths_to_fixup_libs("${${EXTERNAL_NAME_UPPER}_DLL_PATH}")
elseif(APPLE)
@@ -62,7 +62,7 @@ elseif(APPLE)
elseif(NOT ANDROID)
# FIXME need to account for different architectures
- set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/lib/linux_x64/release/libsixense_x64.so CACHE TYPE INTERNAL)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/lib/linux_x64/release/libsixense_x64.so CACHE STRING INTERNAL)
endif()
diff --git a/cmake/externals/steamworks/CMakeLists.txt b/cmake/externals/steamworks/CMakeLists.txt
index 30b3926436..eb61d22f8b 100644
--- a/cmake/externals/steamworks/CMakeLists.txt
+++ b/cmake/externals/steamworks/CMakeLists.txt
@@ -21,7 +21,7 @@ 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)
+set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/public CACHE STRING INTERNAL)
if (WIN32)
@@ -36,12 +36,12 @@ if (WIN32)
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)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/steam_api${ARCH_SUFFIX}.lib" CACHE STRING 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(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/osx32/libsteam_api.dylib CACHE STRING INTERNAL)
set(_STEAMWORKS_LIB_DIR "${SOURCE_DIR}/redistributable_bin/osx32")
ExternalProject_Add_Step(
@@ -57,6 +57,6 @@ elseif(APPLE)
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)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/linux64/libsteam_api.so CACHE STRING INTERNAL)
endif()
diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt
index 436cae79a1..1788922ef2 100644
--- a/cmake/externals/tbb/CMakeLists.txt
+++ b/cmake/externals/tbb/CMakeLists.txt
@@ -102,6 +102,6 @@ if (DEFINED _TBB_LIB_DIR)
endif ()
if (DEFINED ${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE)
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List of tbb include directories")
+ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE STRING "List of tbb include directories")
endif ()
diff --git a/cmake/macros/TargetBreakpad.cmake b/cmake/macros/TargetBreakpad.cmake
index dac581d6c7..58626ad17b 100644
--- a/cmake/macros/TargetBreakpad.cmake
+++ b/cmake/macros/TargetBreakpad.cmake
@@ -8,7 +8,7 @@
macro(TARGET_BREAKPAD)
if (ANDROID)
set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/breakpad)
- set(BREAKPAD_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+ set(BREAKPAD_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE STRING INTERNAL)
set(LIB_DIR ${INSTALL_DIR}/lib)
list(APPEND BREAKPAD_LIBRARIES ${LIB_DIR}/libbreakpad_client.a)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BREAKPAD_INCLUDE_DIRS})
diff --git a/cmake/macros/TargetBullet.cmake b/cmake/macros/TargetBullet.cmake
index 1f4050dd42..843b03ac13 100644
--- a/cmake/macros/TargetBullet.cmake
+++ b/cmake/macros/TargetBullet.cmake
@@ -8,7 +8,7 @@
macro(TARGET_BULLET)
if (ANDROID)
set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/bullet)
- set(BULLET_INCLUDE_DIRS "${INSTALL_DIR}/include/bullet" CACHE TYPE INTERNAL)
+ set(BULLET_INCLUDE_DIRS "${INSTALL_DIR}/include/bullet" CACHE STRING INTERNAL)
set(LIB_DIR ${INSTALL_DIR}/lib)
list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletDynamics.a)
diff --git a/cmake/macros/TargetDraco.cmake b/cmake/macros/TargetDraco.cmake
index 9dbfa865b8..520786d4c3 100755
--- a/cmake/macros/TargetDraco.cmake
+++ b/cmake/macros/TargetDraco.cmake
@@ -3,7 +3,7 @@ macro(TARGET_DRACO)
find_library(LIBPATH ${LIB} PATHS )
if (ANDROID)
set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/draco)
- set(DRACO_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+ set(DRACO_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE STRING INTERNAL)
set(LIB_DIR ${INSTALL_DIR}/lib)
list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdraco.a)
list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdracodec.a)
@@ -21,4 +21,4 @@ macro(TARGET_DRACO)
select_library_configurations(DRACO)
target_link_libraries(${TARGET_NAME} ${DRACO_LIBRARY})
endif()
-endmacro()
\ No newline at end of file
+endmacro()
diff --git a/cmake/macros/TargetHifiAudioCodec.cmake b/cmake/macros/TargetHifiAudioCodec.cmake
index 98c24e684c..4eaccc4f25 100644
--- a/cmake/macros/TargetHifiAudioCodec.cmake
+++ b/cmake/macros/TargetHifiAudioCodec.cmake
@@ -9,9 +9,9 @@ macro(TARGET_HIFIAUDIOCODEC)
if (ANDROID)
set(HIFIAC_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/hifiAC/codecSDK)
set(HIFIAC_LIB_DIR "${HIFIAC_INSTALL_DIR}/Release")
- set(HIFIAC_INCLUDE_DIRS "${HIFIAC_INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+ set(HIFIAC_INCLUDE_DIRS "${HIFIAC_INSTALL_DIR}/include" CACHE STRING INTERNAL)
list(APPEND HIFIAC_LIBS "${HIFIAC_LIB_DIR}/libaudio.a")
- set(HIFIAC_LIBRARIES ${HIFIAC_LIBS} CACHE TYPE INTERNAL)
+ set(HIFIAC_LIBRARIES ${HIFIAC_LIBS} CACHE STRING INTERNAL)
else()
add_dependency_external_projects(hifiAudioCodec)
target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS})
diff --git a/cmake/macros/TargetNvtt.cmake b/cmake/macros/TargetNvtt.cmake
index 8227355cb9..c2f243563f 100644
--- a/cmake/macros/TargetNvtt.cmake
+++ b/cmake/macros/TargetNvtt.cmake
@@ -9,12 +9,12 @@ macro(TARGET_NVTT)
if (ANDROID)
set(NVTT_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/nvtt)
set(NVTT_LIB_DIR "${NVTT_INSTALL_DIR}/lib")
- set(NVTT_INCLUDE_DIRS "${NVTT_INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+ set(NVTT_INCLUDE_DIRS "${NVTT_INSTALL_DIR}/include" CACHE STRING INTERNAL)
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvcore.so")
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvmath.so")
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvimage.so")
list(APPEND NVTT_LIBS "${NVTT_LIB_DIR}/libnvtt.so")
- set(NVTT_LIBRARIES ${NVTT_LIBS} CACHE TYPE INTERNAL)
+ set(NVTT_LIBRARIES ${NVTT_LIBS} CACHE STRING INTERNAL)
target_include_directories(${TARGET_NAME} PRIVATE ${NVTT_INCLUDE_DIRS})
else()
find_library(NVTT_LIBRARY_RELEASE nvtt PATHS ${VCPKG_INSTALL_ROOT}/lib NO_DEFAULT_PATH)
diff --git a/cmake/macros/TargetOpenSSL.cmake b/cmake/macros/TargetOpenSSL.cmake
index 3faaab5801..f74015201d 100644
--- a/cmake/macros/TargetOpenSSL.cmake
+++ b/cmake/macros/TargetOpenSSL.cmake
@@ -8,8 +8,8 @@
macro(TARGET_OPENSSL)
if (ANDROID)
set(OPENSSL_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/openssl)
- set(OPENSSL_INCLUDE_DIR "${OPENSSL_INSTALL_DIR}/include" CACHE TYPE INTERNAL)
- set(OPENSSL_LIBRARIES "${OPENSSL_INSTALL_DIR}/lib/libcrypto.a;${OPENSSL_INSTALL_DIR}/lib/libssl.a" CACHE TYPE INTERNAL)
+ set(OPENSSL_INCLUDE_DIR "${OPENSSL_INSTALL_DIR}/include" CACHE STRING INTERNAL)
+ set(OPENSSL_LIBRARIES "${OPENSSL_INSTALL_DIR}/lib/libcrypto.a;${OPENSSL_INSTALL_DIR}/lib/libssl.a" CACHE STRING INTERNAL)
else()
# using VCPKG for OpenSSL
find_package(OpenSSL REQUIRED)
diff --git a/cmake/macros/TargetPolyvox.cmake b/cmake/macros/TargetPolyvox.cmake
index 9db6b522c7..b2c4e30dd2 100644
--- a/cmake/macros/TargetPolyvox.cmake
+++ b/cmake/macros/TargetPolyvox.cmake
@@ -8,7 +8,7 @@
macro(TARGET_POLYVOX)
if (ANDROID)
set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/polyvox)
- set(POLYVOX_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+ set(POLYVOX_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE STRING INTERNAL)
set(LIB_DIR ${INSTALL_DIR}/lib)
list(APPEND POLYVOX_LIBRARIES ${LIB_DIR}/libPolyVoxUtil.so)
list(APPEND POLYVOX_LIBRARIES ${LIB_DIR}/Release/libPolyVoxCore.so)
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index 8f864cb88a..4fce236e31 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -9,6 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
+
#include "Application.h"
#include
@@ -50,6 +51,7 @@
#include
#include
+
#include
#include
#include
@@ -193,6 +195,8 @@
#include "scripting/KeyboardScriptingInterface.h"
#include "scripting/RefreshRateScriptingInterface.h"
+
+
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
#include "SpeechRecognizer.h"
#endif
@@ -241,7 +245,7 @@
#include "webbrowser/WebBrowserSuggestionsEngine.h"
#include
-#include
+
#include "AboutUtil.h"
#include
@@ -263,7 +267,7 @@
// On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
// FIXME seems to be broken.
extern "C" {
-_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
+ _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}
#endif
@@ -276,8 +280,6 @@ _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
Q_LOGGING_CATEGORY(trace_app_input_mouse, "trace.app.input.mouse")
-#define PLATFORM 1
-
using namespace std;
static QTimer locationUpdateTimer;
@@ -334,9 +336,9 @@ static const float INITIAL_QUERY_RADIUS = 10.0f; // priority radius for entitie
static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
-Setting::Handle maxOctreePacketsPerSecond{ "maxOctreePPS", DEFAULT_MAX_OCTREE_PPS };
+Setting::Handle maxOctreePacketsPerSecond{"maxOctreePPS", DEFAULT_MAX_OCTREE_PPS};
-Setting::Handle loginDialogPoppedUp{ "loginDialogPoppedUp", false };
+Setting::Handle loginDialogPoppedUp{"loginDialogPoppedUp", false};
static const QUrl AVATAR_INPUTS_BAR_QML = PathUtils::qmlUrl("AvatarInputsBar.qml");
static const QUrl MIC_BAR_APPLICATION_QML = PathUtils::qmlUrl("hifi/audio/MicBarApplication.qml");
@@ -347,7 +349,7 @@ static const QString NO_MOVEMENT_MAPPING_NAME = "Standard to Action (No Movement
static const QString NO_MOVEMENT_MAPPING_JSON = PathUtils::resourcesPath() + "/controllers/standard_nomovement.json";
static const QString MARKETPLACE_CDN_HOSTNAME = "mpassets.highfidelity.com";
-static const int INTERVAL_TO_CHECK_HMD_WORN_STATUS = 500; // milliseconds
+static const int INTERVAL_TO_CHECK_HMD_WORN_STATUS = 500; // milliseconds
static const QString DESKTOP_DISPLAY_PLUGIN_NAME = "Desktop";
static const QString ACTIVE_DISPLAY_PLUGIN_SETTING_NAME = "activeDisplayPlugin";
static const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
@@ -358,25 +360,26 @@ static const float FOCUS_HIGHLIGHT_EXPANSION_FACTOR = 1.05f;
#if defined(Q_OS_ANDROID)
static const QString TESTER_FILE = "/sdcard/_hifi_test_device.txt";
#endif
-const std::vector>
- Application::_acceptedExtensions{ { SVO_EXTENSION, &Application::importSVOFromURL },
- { SVO_JSON_EXTENSION, &Application::importSVOFromURL },
- { AVA_JSON_EXTENSION, &Application::askToWearAvatarAttachmentUrl },
- { JSON_EXTENSION, &Application::importJSONFromURL },
- { JS_EXTENSION, &Application::askToLoadScript },
- { FST_EXTENSION, &Application::askToSetAvatarUrl },
- { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },
- { CONTENT_ZIP_EXTENSION, &Application::askToReplaceDomainContent },
- { ZIP_EXTENSION, &Application::importFromZIP },
- { JPG_EXTENSION, &Application::importImage },
- { PNG_EXTENSION, &Application::importImage } };
+const std::vector> Application::_acceptedExtensions {
+ { SVO_EXTENSION, &Application::importSVOFromURL },
+ { SVO_JSON_EXTENSION, &Application::importSVOFromURL },
+ { AVA_JSON_EXTENSION, &Application::askToWearAvatarAttachmentUrl },
+ { JSON_EXTENSION, &Application::importJSONFromURL },
+ { JS_EXTENSION, &Application::askToLoadScript },
+ { FST_EXTENSION, &Application::askToSetAvatarUrl },
+ { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },
+ { CONTENT_ZIP_EXTENSION, &Application::askToReplaceDomainContent },
+ { ZIP_EXTENSION, &Application::importFromZIP },
+ { JPG_EXTENSION, &Application::importImage },
+ { PNG_EXTENSION, &Application::importImage }
+};
class DeadlockWatchdogThread : public QThread {
public:
static const unsigned long HEARTBEAT_UPDATE_INTERVAL_SECS = 1;
- static const unsigned long MAX_HEARTBEAT_AGE_USECS = 120 * USECS_PER_SECOND; // 2 mins with no checkin probably a deadlock
- static const int WARNING_ELAPSED_HEARTBEAT = 500 * USECS_PER_MSEC; // warn if elapsed heartbeat average is large
- static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples
+ static const unsigned long MAX_HEARTBEAT_AGE_USECS = 120 * USECS_PER_SECOND; // 2 mins with no checkin probably a deadlock
+ static const int WARNING_ELAPSED_HEARTBEAT = 500 * USECS_PER_MSEC; // warn if elapsed heartbeat average is large
+ static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples
// Set the heartbeat on launch
DeadlockWatchdogThread() {
@@ -384,10 +387,14 @@ public:
// Give the heartbeat an initial value
_heartbeat = usecTimestampNow();
_paused = false;
- connect(qApp, &QCoreApplication::aboutToQuit, [this] { _quit = true; });
+ connect(qApp, &QCoreApplication::aboutToQuit, [this] {
+ _quit = true;
+ });
}
- void setMainThreadID(Qt::HANDLE threadID) { _mainThreadID = threadID; }
+ void setMainThreadID(Qt::HANDLE threadID) {
+ _mainThreadID = threadID;
+ }
static void updateHeartbeat() {
auto now = usecTimestampNow();
@@ -408,7 +415,9 @@ public:
lambda();
resume();
}
- static void pause() { _paused = true; }
+ static void pause() {
+ _paused = true;
+ }
static void resume() {
// Update the heartbeat BEFORE resuming the checks
@@ -423,49 +432,55 @@ public:
if (_paused) {
continue;
}
- uint64_t lastHeartbeat =
- _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us
+ uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us
uint64_t now = usecTimestampNow();
auto lastHeartbeatAge = (now > lastHeartbeat) ? now - lastHeartbeat : 0;
auto elapsedMovingAverage = _movingAverage.getAverage();
if (elapsedMovingAverage > _maxElapsedAverage) {
- qCDebug(interfaceapp_deadlock)
- << "DEADLOCK WATCHDOG WARNING:"
- << "lastHeartbeatAge:" << lastHeartbeatAge << "elapsedMovingAverage:" << elapsedMovingAverage
- << "maxElapsed:" << _maxElapsed << "PREVIOUS maxElapsedAverage:" << _maxElapsedAverage
+ qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
+ << "lastHeartbeatAge:" << lastHeartbeatAge
+ << "elapsedMovingAverage:" << elapsedMovingAverage
+ << "maxElapsed:" << _maxElapsed
+ << "PREVIOUS maxElapsedAverage:" << _maxElapsedAverage
<< "NEW maxElapsedAverage:" << elapsedMovingAverage << "** NEW MAX ELAPSED AVERAGE **"
<< "samples:" << _movingAverage.getSamples();
_maxElapsedAverage = elapsedMovingAverage;
}
if (lastHeartbeatAge > _maxElapsed) {
- qCDebug(interfaceapp_deadlock)
- << "DEADLOCK WATCHDOG WARNING:"
- << "lastHeartbeatAge:" << lastHeartbeatAge << "elapsedMovingAverage:" << elapsedMovingAverage
- << "PREVIOUS maxElapsed:" << _maxElapsed << "NEW maxElapsed:" << lastHeartbeatAge << "** NEW MAX ELAPSED **"
- << "maxElapsedAverage:" << _maxElapsedAverage << "samples:" << _movingAverage.getSamples();
+ qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
+ << "lastHeartbeatAge:" << lastHeartbeatAge
+ << "elapsedMovingAverage:" << elapsedMovingAverage
+ << "PREVIOUS maxElapsed:" << _maxElapsed
+ << "NEW maxElapsed:" << lastHeartbeatAge << "** NEW MAX ELAPSED **"
+ << "maxElapsedAverage:" << _maxElapsedAverage
+ << "samples:" << _movingAverage.getSamples();
_maxElapsed = lastHeartbeatAge;
}
if (elapsedMovingAverage > WARNING_ELAPSED_HEARTBEAT) {
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
- << "lastHeartbeatAge:" << lastHeartbeatAge
- << "elapsedMovingAverage:" << elapsedMovingAverage << "** OVER EXPECTED VALUE **"
- << "maxElapsed:" << _maxElapsed << "maxElapsedAverage:" << _maxElapsedAverage
- << "samples:" << _movingAverage.getSamples();
+ << "lastHeartbeatAge:" << lastHeartbeatAge
+ << "elapsedMovingAverage:" << elapsedMovingAverage << "** OVER EXPECTED VALUE **"
+ << "maxElapsed:" << _maxElapsed
+ << "maxElapsedAverage:" << _maxElapsedAverage
+ << "samples:" << _movingAverage.getSamples();
}
if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) {
- qCDebug(interfaceapp_deadlock)
- << "DEADLOCK DETECTED -- "
- << "lastHeartbeatAge:" << lastHeartbeatAge << "[ lastHeartbeat :" << lastHeartbeat << "now:" << now << " ]"
- << "elapsedMovingAverage:" << elapsedMovingAverage << "maxElapsed:" << _maxElapsed
- << "maxElapsedAverage:" << _maxElapsedAverage << "samples:" << _movingAverage.getSamples();
+ qCDebug(interfaceapp_deadlock) << "DEADLOCK DETECTED -- "
+ << "lastHeartbeatAge:" << lastHeartbeatAge
+ << "[ lastHeartbeat :" << lastHeartbeat
+ << "now:" << now << " ]"
+ << "elapsedMovingAverage:" << elapsedMovingAverage
+ << "maxElapsed:" << _maxElapsed
+ << "maxElapsedAverage:" << _maxElapsedAverage
+ << "samples:" << _movingAverage.getSamples();
-// Don't actually crash in debug builds, in case this apparent deadlock is simply from
-// the developer actively debugging code
-#ifdef NDEBUG
+ // Don't actually crash in debug builds, in case this apparent deadlock is simply from
+ // the developer actively debugging code
+ #ifdef NDEBUG
deadlockDetectionCrash();
-#endif
+ #endif
}
}
}
@@ -476,7 +491,7 @@ public:
static std::atomic _maxElapsedAverage;
static ThreadSafeMovingAverage _movingAverage;
- bool _quit{ false };
+ bool _quit { false };
Qt::HANDLE _mainThreadID = nullptr;
};
@@ -501,7 +516,8 @@ bool isDomainURL(QUrl url) {
// url.scheme() != HIFI_URL_SCHEME_HTTPS
return false;
}
- if (url.path().endsWith(".json", Qt::CaseInsensitive) || url.path().endsWith(".json.gz", Qt::CaseInsensitive)) {
+ if (url.path().endsWith(".json", Qt::CaseInsensitive) ||
+ url.path().endsWith(".json.gz", Qt::CaseInsensitive)) {
return true;
}
return false;
@@ -515,7 +531,7 @@ public:
return staticInstance;
}
- bool nativeEventFilter(const QByteArray& eventType, void* msg, long* result) Q_DECL_OVERRIDE {
+ bool nativeEventFilter(const QByteArray &eventType, void* msg, long* result) Q_DECL_OVERRIDE {
if (eventType == "windows_generic_MSG") {
MSG* message = (MSG*)msg;
@@ -543,12 +559,12 @@ public:
}
if (message->message == WM_DEVICECHANGE) {
- const float MIN_DELTA_SECONDS = 2.0f; // de-bounce signal
+ const float MIN_DELTA_SECONDS = 2.0f; // de-bounce signal
static float lastTriggerTime = 0.0f;
const float deltaSeconds = secTimestampNow() - lastTriggerTime;
lastTriggerTime = secTimestampNow();
if (deltaSeconds > MIN_DELTA_SECONDS) {
- Midi::USBchanged(); // re-scan the MIDI bus
+ Midi::USBchanged(); // re-scan the MIDI bus
}
}
}
@@ -559,35 +575,38 @@ public:
class LambdaEvent : public QEvent {
std::function _fun;
-
public:
- LambdaEvent(const std::function& fun) : QEvent(static_cast(ApplicationEvent::Lambda)), _fun(fun) {}
- LambdaEvent(std::function&& fun) : QEvent(static_cast(ApplicationEvent::Lambda)), _fun(fun) {}
+ LambdaEvent(const std::function & fun) :
+ QEvent(static_cast(ApplicationEvent::Lambda)), _fun(fun) {
+ }
+ LambdaEvent(std::function && fun) :
+ QEvent(static_cast(ApplicationEvent::Lambda)), _fun(fun) {
+ }
void call() const { _fun(); }
};
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
- QString logMessage = LogHandler::getInstance().printMessage((LogMsgType)type, context, message);
+ QString logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message);
if (!logMessage.isEmpty()) {
#ifdef Q_OS_ANDROID
- const char* local = logMessage.toStdString().c_str();
+ const char * local=logMessage.toStdString().c_str();
switch (type) {
case QtDebugMsg:
- __android_log_write(ANDROID_LOG_DEBUG, "Interface", local);
+ __android_log_write(ANDROID_LOG_DEBUG,"Interface",local);
break;
case QtInfoMsg:
- __android_log_write(ANDROID_LOG_INFO, "Interface", local);
+ __android_log_write(ANDROID_LOG_INFO,"Interface",local);
break;
case QtWarningMsg:
- __android_log_write(ANDROID_LOG_WARN, "Interface", local);
+ __android_log_write(ANDROID_LOG_WARN,"Interface",local);
break;
case QtCriticalMsg:
- __android_log_write(ANDROID_LOG_ERROR, "Interface", local);
+ __android_log_write(ANDROID_LOG_ERROR,"Interface",local);
break;
case QtFatalMsg:
default:
- __android_log_write(ANDROID_LOG_FATAL, "Interface", local);
+ __android_log_write(ANDROID_LOG_FATAL,"Interface",local);
abort();
}
#else
@@ -596,21 +615,21 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
}
}
-class ApplicationMeshProvider : public scriptable::ModelProviderFactory {
+
+class ApplicationMeshProvider : public scriptable::ModelProviderFactory {
public:
virtual scriptable::ModelProviderPointer lookupModelProvider(const QUuid& uuid) override {
bool success;
if (auto nestable = DependencyManager::get()->find(uuid, success).lock()) {
auto type = nestable->getNestableType();
#ifdef SCRIPTABLE_MESH_DEBUG
- qCDebug(interfaceapp) << "ApplicationMeshProvider::lookupModelProvider" << uuid
- << SpatiallyNestable::nestableTypeToString(type);
+ qCDebug(interfaceapp) << "ApplicationMeshProvider::lookupModelProvider" << uuid << SpatiallyNestable::nestableTypeToString(type);
#endif
switch (type) {
- case NestableType::Entity:
- return getEntityModelProvider(static_cast(uuid));
- case NestableType::Avatar:
- return getAvatarModelProvider(uuid);
+ case NestableType::Entity:
+ return getEntityModelProvider(static_cast(uuid));
+ case NestableType::Avatar:
+ return getAvatarModelProvider(uuid);
}
}
return nullptr;
@@ -645,9 +664,10 @@ private:
/**jsdoc
* The Controller.Hardware.Application
object has properties representing Interface's state. The property
- * values are integer IDs, uniquely identifying each output. Read-only. These can be mapped to actions or functions or
- * Controller.Standard
items in a {@link RouteObject} mapping (e.g., using the {@link RouteObject#when} method).
- * Each data value is either 1.0
for "true" or 0.0
for "false".
+ * values are integer IDs, uniquely identifying each output. Read-only.
+ * These states can be mapped to actions or functions or Controller.Standard
items in a {@link RouteObject}
+ * mapping (e.g., using the {@link RouteObject#when} method). Each data value is either 1.0
for "true" or
+ * 0.0
for "false".
*
*
* Property | Type | Data | Description |
@@ -661,13 +681,17 @@ private:
* CameraIndependent | number | number | The camera is in independent mode. |
* CameraEntity | number | number | The camera is in entity mode. |
* InHMD | number | number | The user is in HMD mode. |
- * AdvancedMovement | number | number | Advanced movement controls are enabled.
- * |
+ * AdvancedMovement | number | number | Advanced movement (walking) controls are
+ * enabled. |
+ * StrafeEnabled | number | number | Strafing is enabled |
* LeftHandDominant | number | number | Dominant hand set to left. |
* RightHandDominant | number | number | Dominant hand set to right. |
* SnapTurn | number | number | Snap turn is enabled. |
* Grounded | number | number | The user's avatar is on the ground. |
* NavigationFocused | number | number | Not used. |
+ * PlatformWindows | number | number | The operating system is Windows. |
+ * PlatformMac | number | number | The operating system is Mac. |
+ * PlatformAndroid | number | number | The operating system is Android. |
*
*
* @typedef {object} Controller.Hardware-Application
@@ -707,7 +731,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
// HRS: I could not figure out how to move these any earlier in startup, so when using this option, be sure to also supply
// --allowMultipleInstances
- auto reportAndQuit = [&](const char* commandSwitch, std::function report) {
+ auto reportAndQuit = [&](const char* commandSwitch, std::function report) {
const char* reportfile = getCmdOption(argc, constArgv, commandSwitch);
// Reports to the specified file, because stdout is set up to be captured for logging.
if (reportfile) {
@@ -715,9 +739,9 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
if (fp) {
report(fp);
fclose(fp);
- if (!runningMarkerExisted) { // don't leave ours around
+ if (!runningMarkerExisted) { // don't leave ours around
RunningMarker runingMarker(RUNNING_MARKER_FILENAME);
- runingMarker.deleteRunningMarkerFile(); // happens in deleter, but making the side-effect explicit.
+ runingMarker.deleteRunningMarkerFile(); // happens in deleter, but making the side-effect explicit.
}
_exit(0);
}
@@ -727,7 +751,9 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
auto version = protocolVersionsSignatureBase64();
fputs(version.toLatin1().data(), fp);
});
- reportAndQuit("--version", [&](FILE* fp) { fputs(BuildInfo::VERSION.toLatin1().data(), fp); });
+ reportAndQuit("--version", [&](FILE* fp) {
+ fputs(BuildInfo::VERSION.toLatin1().data(), fp);
+ });
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
const int listenPort = portStr ? atoi(portStr) : INVALID_PORT;
@@ -746,7 +772,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
qApp->setProperty(hifi::properties::STANDALONE, isStandalone);
// Ignore any previous crashes if running from command line with a test script.
- bool inTestMode{ false };
+ bool inTestMode { false };
for (int i = 0; i < argc; ++i) {
QString parameter(argv[i]);
if (parameter == TEST_SCRIPT_COMMAND) {
@@ -755,7 +781,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
}
}
- bool previousSessionCrashed{ false };
+ bool previousSessionCrashed { false };
if (!inTestMode) {
previousSessionCrashed = CrashRecoveryHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
}
@@ -801,7 +827,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
audioDLLPath += "/audioWin7";
}
QCoreApplication::addLibraryPath(audioDLLPath);
-#endif
+#endif
DependencyManager::registerInheritance();
DependencyManager::registerInheritance();
@@ -819,7 +845,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
DependencyManager::set();
DependencyManager::set();
#if defined(Q_OS_ANDROID)
- DependencyManager::set(); // use the default user agent getter
+ DependencyManager::set(); // use the default user agent getter
#else
DependencyManager::set(std::bind(&Application::getUserAgent, qApp));
#endif
@@ -833,8 +859,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
DependencyManager::set(NodeType::Agent, listenPort);
DependencyManager::set();
DependencyManager::set();
- DependencyManager::set<
- ModelFormatRegistry>(); // ModelFormatRegistry must be defined before ModelCache. See the ModelCache constructor.
+ DependencyManager::set(); // ModelFormatRegistry must be defined before ModelCache. See the ModelCache constructor.
DependencyManager::set();
DependencyManager::set();
DependencyManager::set();
@@ -886,11 +911,10 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
DependencyManager::set();
DependencyManager::set();
DependencyManager::set();
- controller::StateController::setStateVariables(
- { { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR, STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON,
- STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED,
- STATE_NAV_FOCUSED, STATE_PLATFORM_WINDOWS, STATE_PLATFORM_MAC, STATE_PLATFORM_ANDROID, STATE_LEFT_HAND_DOMINANT,
- STATE_RIGHT_HAND_DOMINANT, STATE_STRAFE_ENABLED } });
+ controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR,
+ STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT,
+ STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED,
+ STATE_PLATFORM_WINDOWS, STATE_PLATFORM_MAC, STATE_PLATFORM_ANDROID, STATE_LEFT_HAND_DOMINANT, STATE_RIGHT_HAND_DOMINANT, STATE_STRAFE_ENABLED } });
DependencyManager::set();
DependencyManager::set();
DependencyManager::set();
@@ -928,7 +952,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
// continuing to overburden Application.cpp
QUuid _keyboardFocusHighlightID;
-OffscreenGLCanvas* _qmlShareContext{ nullptr };
+OffscreenGLCanvas* _qmlShareContext { nullptr };
// FIXME hack access to the internal share context for the Chromium helper
// Normally we'd want to use QWebEngine::initialize(), but we can't because
@@ -938,11 +962,11 @@ OffscreenGLCanvas* _qmlShareContext{ nullptr };
// So instead we create a new offscreen context to share with the QGLWidget,
// and manually set THAT to be the shared context for the Chromium helper
#if !defined(DISABLE_QML)
-OffscreenGLCanvas* _chromiumShareContext{ nullptr };
+OffscreenGLCanvas* _chromiumShareContext { nullptr };
#endif
-Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext* context);
-Q_GUI_EXPORT QOpenGLContext* qt_gl_global_share_context();
+Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
Setting::Handle sessionRunTime{ "sessionRunTime", 0 };
@@ -963,35 +987,41 @@ QSharedPointer getOffscreenUI() {
#endif
}
-void Application::InitializePlatform() {
- platform::create();
-
- if (platform::enumerateProcessors()) {
- std::string test = platform::getProcessor(0);
- }
-}
-
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runningMarkerExisted) :
- QApplication(argc, argv), _window(new MainWindow(desktop())), _sessionRunTimer(startupTimer),
+ QApplication(argc, argv),
+ _window(new MainWindow(desktop())),
+ _sessionRunTimer(startupTimer),
#ifndef Q_OS_ANDROID
_logger(new FileLogger(this)),
#endif
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
- _entitySimulation(new PhysicalEntitySimulation()), _physicsEngine(new PhysicsEngine(Vectors::ZERO)),
- _entityClipboard(new EntityTree()), _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
+ _entitySimulation(new PhysicalEntitySimulation()),
+ _physicsEngine(new PhysicsEngine(Vectors::ZERO)),
+ _entityClipboard(new EntityTree()),
+ _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
_hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT),
- _desktopTabletScale("desktopTabletScale", DEFAULT_DESKTOP_TABLET_SCALE_PERCENT), _firstRun(Settings::firstRun, true),
+ _desktopTabletScale("desktopTabletScale", DEFAULT_DESKTOP_TABLET_SCALE_PERCENT),
+ _firstRun(Settings::firstRun, true),
_desktopTabletBecomesToolbarSetting("desktopTabletBecomesToolbar", DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR),
_hmdTabletBecomesToolbarSetting("hmdTabletBecomesToolbar", DEFAULT_HMD_TABLET_BECOMES_TOOLBAR),
_preferStylusOverLaserSetting("preferStylusOverLaser", DEFAULT_PREFER_STYLUS_OVER_LASER),
_preferAvatarFingerOverStylusSetting("preferAvatarFingerOverStylus", DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS),
_constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true),
_preferredCursor("preferredCursor", DEFAULT_CURSOR_NAME),
- _miniTabletEnabledSetting("miniTabletEnabled", DEFAULT_MINI_TABLET_ENABLED), _scaleMirror(1.0f), _mirrorYawOffset(0.0f),
- _raiseMirror(0.0f), _enableProcessOctreeThread(true), _lastNackTime(usecTimestampNow()),
- _lastSendDownstreamAudioStats(usecTimestampNow()), _notifiedPacketVersionMismatchThisDomain(false),
- _maxOctreePPS(maxOctreePacketsPerSecond.get()), _lastFaceTrackerUpdate(0), _snapshotSound(nullptr), _sampleSound(nullptr) {
+ _miniTabletEnabledSetting("miniTabletEnabled", DEFAULT_MINI_TABLET_ENABLED),
+ _scaleMirror(1.0f),
+ _mirrorYawOffset(0.0f),
+ _raiseMirror(0.0f),
+ _enableProcessOctreeThread(true),
+ _lastNackTime(usecTimestampNow()),
+ _lastSendDownstreamAudioStats(usecTimestampNow()),
+ _notifiedPacketVersionMismatchThisDomain(false),
+ _maxOctreePPS(maxOctreePacketsPerSecond.get()),
+ _lastFaceTrackerUpdate(0),
+ _snapshotSound(nullptr),
+ _sampleSound(nullptr)
+{
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
@@ -1008,6 +1038,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// This is done so as not break previous command line scripts
if (testScriptPath.left(HIFI_URL_SCHEME_HTTP.length()) == HIFI_URL_SCHEME_HTTP ||
testScriptPath.left(HIFI_URL_SCHEME_FTP.length()) == HIFI_URL_SCHEME_FTP) {
+
setProperty(hifi::properties::TEST, QUrl::fromUserInput(testScriptPath));
} else if (QFileInfo(testScriptPath).exists()) {
setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));
@@ -1032,7 +1063,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// make sure the debug draw singleton is initialized on the main thread.
DebugDraw::getInstance().removeMarker("");
- PluginContainer* pluginContainer = dynamic_cast(this); // set the container for any plugins that care
+ PluginContainer* pluginContainer = dynamic_cast(this); // set the container for any plugins that care
PluginManager::getInstance()->setContainer(pluginContainer);
QThreadPool::globalInstance()->setMaxThreadCount(MIN_PROCESSING_THREAD_POOL_SIZE);
@@ -1043,10 +1074,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto controllerScriptingInterface = DependencyManager::get().data();
_controllerScriptingInterface = dynamic_cast(controllerScriptingInterface);
- connect(PluginManager::getInstance().data(), &PluginManager::inputDeviceRunningChanged, controllerScriptingInterface,
- &controller::ScriptingInterface::updateRunningInputDevices);
+ connect(PluginManager::getInstance().data(), &PluginManager::inputDeviceRunningChanged,
+ controllerScriptingInterface, &controller::ScriptingInterface::updateRunningInputDevices);
- EntityTree::setEntityClicksCapturedOperator([this] { return _controllerScriptingInterface->areEntityClicksCaptured(); });
+ EntityTree::setEntityClicksCapturedOperator([this] {
+ return _controllerScriptingInterface->areEntityClicksCaptured();
+ });
_entityClipboard->createRootElement();
@@ -1054,11 +1087,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
installNativeEventFilter(&MyNativeEventFilter::getInstance());
#endif
-#ifdef PLATFORM
- InitializePlatform();
-#endif
-
-
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/fontawesome-webfont.ttf");
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/hifi-glyphs.ttf");
@@ -1073,7 +1101,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Cairo-SemiBold.ttf");
_window->setWindowTitle("High Fidelity Interface");
- Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
+ Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
auto nodeList = DependencyManager::get();
nodeList->startThread();
@@ -1129,8 +1157,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
bool isStore = property(hifi::properties::OCULUS_STORE).toBool();
- DependencyManager::get()->setLimitedCommerce(
- isStore); // Or we could make it a separate arg, or if either arg is set, etc. And should this instead by a hifi::properties?
+ DependencyManager::get()->setLimitedCommerce(isStore); // Or we could make it a separate arg, or if either arg is set, etc. And should this instead by a hifi::properties?
updateHeartbeat();
@@ -1164,16 +1191,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
return myAvatar ? myAvatar->getOrientationForAudio() : Quaternions::IDENTITY;
});
- recording::Frame::registerFrameHandler(AudioConstants::getAudioFrameName(),
- [&audioIO](recording::Frame::ConstPointer frame) {
- audioIO->handleRecordedAudioInput(frame->data);
- });
+ recording::Frame::registerFrameHandler(AudioConstants::getAudioFrameName(), [&audioIO](recording::Frame::ConstPointer frame) {
+ audioIO->handleRecordedAudioInput(frame->data);
+ });
connect(audioIO, &AudioClient::inputReceived, [](const QByteArray& audio) {
static auto recorder = DependencyManager::get();
if (recorder->isRecording()) {
- static const recording::FrameType AUDIO_FRAME_TYPE =
- recording::Frame::registerFrameType(AudioConstants::getAudioFrameName());
+ static const recording::FrameType AUDIO_FRAME_TYPE = recording::Frame::registerFrameType(AudioConstants::getAudioFrameName());
recorder->recordFrame(AUDIO_FRAME_TYPE, audio);
}
});
@@ -1190,8 +1215,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(&domainHandler, SIGNAL(domainURLChanged(QUrl)), SLOT(domainURLChanged(QUrl)));
connect(&domainHandler, SIGNAL(redirectToErrorDomainURL(QUrl)), SLOT(goToErrorDomainURL(QUrl)));
- connect(&domainHandler, &DomainHandler::domainURLChanged,
- [](QUrl domainURL) { setCrashAnnotation("domain", domainURL.toString().toStdString()); });
+ connect(&domainHandler, &DomainHandler::domainURLChanged, [](QUrl domainURL){
+ setCrashAnnotation("domain", domainURL.toString().toStdString());
+ });
connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));
connect(&domainHandler, SIGNAL(connectedToDomain(QUrl)), SLOT(updateWindowTitle()));
connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));
@@ -1219,21 +1245,20 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// We could clear ATP assets only when changing domains, but it's possible that the domain you are connected
// to has gone down and switched to a new content set, so when you reconnect the cached ATP assets will no longer be valid.
- connect(&domainHandler, &DomainHandler::disconnectedFromDomain, DependencyManager::get().data(),
- &ScriptCache::clearATPScriptsFromCache);
+ connect(&domainHandler, &DomainHandler::disconnectedFromDomain, DependencyManager::get().data(), &ScriptCache::clearATPScriptsFromCache);
// update our location every 5 seconds in the metaverse server, assuming that we are authenticated with one
const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * MSECS_PER_SECOND;
auto discoverabilityManager = DependencyManager::get();
connect(&locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
- connect(&locationUpdateTimer, &QTimer::timeout, DependencyManager::get().data(),
- &AddressManager::storeCurrentAddress);
+ connect(&locationUpdateTimer, &QTimer::timeout,
+ DependencyManager::get().data(), &AddressManager::storeCurrentAddress);
locationUpdateTimer.start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
// if we get a domain change, immediately attempt update location in metaverse server
- connect(&nodeList->getDomainHandler(), &DomainHandler::connectedToDomain, discoverabilityManager.data(),
- &DiscoverabilityManager::updateLocation);
+ connect(&nodeList->getDomainHandler(), &DomainHandler::connectedToDomain,
+ discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
// send a location update immediately
discoverabilityManager->updateLocation();
@@ -1246,7 +1271,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch);
// you might think we could just do this in NodeList but we only want this connection for Interface
- connect(&nodeList->getDomainHandler(), SIGNAL(limitOfSilentDomainCheckInsReached()), nodeList.data(), SLOT(reset()));
+ connect(&nodeList->getDomainHandler(), SIGNAL(limitOfSilentDomainCheckInsReached()),
+ nodeList.data(), SLOT(reset()));
auto dialogsManager = DependencyManager::get();
#if defined(Q_OS_ANDROID)
@@ -1264,21 +1290,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
// use our MyAvatar position and quat for address manager path
- addressManager->setPositionGetter([this] { return getMyAvatar()->getWorldFeetPosition(); });
- addressManager->setOrientationGetter([this] { return getMyAvatar()->getWorldOrientation(); });
+ addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldFeetPosition(); });
+ addressManager->setOrientationGetter([this]{ return getMyAvatar()->getWorldOrientation(); });
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateThreadPoolCount);
- connect(this, &Application::activeDisplayPluginChanged, this, []() {
+ connect(this, &Application::activeDisplayPluginChanged, this, [](){
qApp->setProperty(hifi::properties::HMD, qApp->isHMDMode());
auto displayPlugin = qApp->getActiveDisplayPlugin();
setCrashAnnotation("display_plugin", displayPlugin->getName().toStdString());
setCrashAnnotation("hmd", displayPlugin->isHmd() ? "1" : "0");
});
connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateSystemTabletMode);
- connect(this, &Application::activeDisplayPluginChanged, this, [&]() {
+ connect(this, &Application::activeDisplayPluginChanged, this, [&](){
if (getLoginDialogPoppedUp()) {
auto dialogsManager = DependencyManager::get();
auto keyboard = DependencyManager::get();
@@ -1301,10 +1327,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
});
// Save avatar location immediately after a teleport.
- connect(myAvatar.get(), &MyAvatar::positionGoneTo, DependencyManager::get().data(),
- &AddressManager::storeCurrentAddress);
+ connect(myAvatar.get(), &MyAvatar::positionGoneTo,
+ DependencyManager::get().data(), &AddressManager::storeCurrentAddress);
- connect(myAvatar.get(), &MyAvatar::skeletonModelURLChanged, []() {
+ connect(myAvatar.get(), &MyAvatar::skeletonModelURLChanged, [](){
QUrl avatarURL = qApp->getMyAvatar()->getSkeletonModelURL();
setCrashAnnotation("avatar", avatarURL.toString().toStdString());
});
@@ -1314,30 +1340,26 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
{
auto scriptEngines = DependencyManager::get().data();
- scriptEngines->registerScriptInitializer(
- [this](ScriptEnginePointer engine) { registerScriptEngineWithApplicationServices(engine); });
+ scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine) {
+ registerScriptEngineWithApplicationServices(engine);
+ });
- connect(scriptEngines, &ScriptEngines::scriptCountChanged, this,
- [this] {
- auto scriptEngines = DependencyManager::get();
- if (scriptEngines->getRunningScripts().isEmpty()) {
- getMyAvatar()->clearScriptableSettings();
- }
- },
- Qt::QueuedConnection);
+ connect(scriptEngines, &ScriptEngines::scriptCountChanged, this, [this] {
+ auto scriptEngines = DependencyManager::get();
+ if (scriptEngines->getRunningScripts().isEmpty()) {
+ getMyAvatar()->clearScriptableSettings();
+ }
+ }, Qt::QueuedConnection);
- connect(scriptEngines, &ScriptEngines::scriptsReloading, this,
- [this] {
- getEntities()->reloadEntityScripts();
- loadAvatarScripts(getMyAvatar()->getScriptUrls());
- },
- Qt::QueuedConnection);
+ connect(scriptEngines, &ScriptEngines::scriptsReloading, this, [this] {
+ getEntities()->reloadEntityScripts();
+ loadAvatarScripts(getMyAvatar()->getScriptUrls());
+ }, Qt::QueuedConnection);
- connect(scriptEngines, &ScriptEngines::scriptLoadError, this,
- [](const QString& filename, const QString& error) {
- OffscreenUi::asyncWarning(nullptr, "Error Loading Script", filename + " failed to load.");
- },
- Qt::QueuedConnection);
+ connect(scriptEngines, &ScriptEngines::scriptLoadError,
+ this, [](const QString& filename, const QString& error) {
+ OffscreenUi::asyncWarning(nullptr, "Error Loading Script", filename + " failed to load.");
+ }, Qt::QueuedConnection);
}
#ifdef _WIN32
@@ -1347,13 +1369,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// tell the NodeList instance who to tell the domain server we care about
nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer
- << NodeType::EntityServer << NodeType::AssetServer
- << NodeType::MessagesMixer << NodeType::EntityScriptServer);
+ << NodeType::EntityServer << NodeType::AssetServer << NodeType::MessagesMixer << NodeType::EntityScriptServer);
// connect to the packet sent signal of the _entityEditSender
connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
- connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this,
- &Application::addingEntityWithCertificate);
+ connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this, &Application::addingEntityWithCertificate);
QString concurrentDownloadsStr = getCmdOption(argc, constArgv, "--concurrent-downloads");
bool success;
@@ -1415,8 +1435,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto audioScriptingInterface = DependencyManager::set();
auto audioIO = DependencyManager::get().data();
connect(audioIO, &AudioClient::mutedByMixer, audioScriptingInterface.data(), &AudioScriptingInterface::mutedByMixer);
- connect(audioIO, &AudioClient::receivedFirstPacket, audioScriptingInterface.data(),
- &AudioScriptingInterface::receivedFirstPacket);
+ connect(audioIO, &AudioClient::receivedFirstPacket, audioScriptingInterface.data(), &AudioScriptingInterface::receivedFirstPacket);
connect(audioIO, &AudioClient::disconnected, audioScriptingInterface.data(), &AudioScriptingInterface::disconnected);
connect(audioIO, &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) {
auto audioClient = DependencyManager::get();
@@ -1429,8 +1448,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
audioScriptingInterface->environmentMuted();
}
});
- connect(this, &Application::activeDisplayPluginChanged,
- reinterpret_cast(audioScriptingInterface.data()), &scripting::Audio::onContextChanged);
+ QSharedPointer scriptingAudioSharedPointer = qSharedPointerDynamicCast(DependencyManager::get());
+ if (scriptingAudioSharedPointer) {
+ connect(this, &Application::activeDisplayPluginChanged,
+ scriptingAudioSharedPointer.data(), &scripting::Audio::onContextChanged);
+ }
}
// Create the rendering engine. This can be slow on some machines due to lots of
@@ -1439,7 +1461,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
qCDebug(interfaceapp, "Initialized Render Engine.");
// Overlays need to exist before we set the ContextOverlayInterface dependency
- _overlays.init(); // do this before scripts load
+ _overlays.init(); // do this before scripts load
DependencyManager::set();
auto offscreenUi = getOffscreenUI();
@@ -1491,8 +1513,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
updateHeartbeat();
static const QString TESTER = "HIFI_TESTER";
- bool isTester = false;
-#if defined(Q_OS_ANDROID)
+ bool isTester = false;
+#if defined (Q_OS_ANDROID)
// Since we cannot set environment variables in Android we use a file presence
// to denote that this is a testing device
QFileInfo check_tester_file(TESTER_FILE);
@@ -1501,7 +1523,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
constexpr auto INSTALLER_INI_NAME = "installer.ini";
auto iniPath = QDir(applicationDirPath()).filePath(INSTALLER_INI_NAME);
- QFile installerFile{ iniPath };
+ QFile installerFile { iniPath };
std::unordered_map installerKeyValues;
if (installerFile.open(QIODevice::ReadOnly)) {
while (!installerFile.atEnd()) {
@@ -1548,27 +1570,29 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
static const QString TESTER = "HIFI_TESTER";
auto gpuIdent = GPUIdent::getInstance();
auto glContextData = getGLContextData();
- QJsonObject properties = { { "version", applicationVersion() },
- { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) || isTester },
- { "installer_campaign", installerCampaign },
- { "installer_type", installerType },
- { "build_type", BuildInfo::BUILD_TYPE_STRING },
- { "previousSessionCrashed", _previousSessionCrashed },
- { "previousSessionRuntime", sessionRunTime.get() },
- { "cpu_architecture", QSysInfo::currentCpuArchitecture() },
- { "kernel_type", QSysInfo::kernelType() },
- { "kernel_version", QSysInfo::kernelVersion() },
- { "os_type", QSysInfo::productType() },
- { "os_version", QSysInfo::productVersion() },
- { "gpu_name", gpuIdent->getName() },
- { "gpu_driver", gpuIdent->getDriver() },
- { "gpu_memory", static_cast(gpuIdent->getMemory()) },
- { "gl_version_int", glVersionToInteger(glContextData.value("version").toString()) },
- { "gl_version", glContextData["version"] },
- { "gl_vender", glContextData["vendor"] },
- { "gl_sl_version", glContextData["sl_version"] },
- { "gl_renderer", glContextData["renderer"] },
- { "ideal_thread_count", QThread::idealThreadCount() } };
+ QJsonObject properties = {
+ { "version", applicationVersion() },
+ { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) || isTester },
+ { "installer_campaign", installerCampaign },
+ { "installer_type", installerType },
+ { "build_type", BuildInfo::BUILD_TYPE_STRING },
+ { "previousSessionCrashed", _previousSessionCrashed },
+ { "previousSessionRuntime", sessionRunTime.get() },
+ { "cpu_architecture", QSysInfo::currentCpuArchitecture() },
+ { "kernel_type", QSysInfo::kernelType() },
+ { "kernel_version", QSysInfo::kernelVersion() },
+ { "os_type", QSysInfo::productType() },
+ { "os_version", QSysInfo::productVersion() },
+ { "gpu_name", gpuIdent->getName() },
+ { "gpu_driver", gpuIdent->getDriver() },
+ { "gpu_memory", static_cast(gpuIdent->getMemory()) },
+ { "gl_version_int", glVersionToInteger(glContextData.value("version").toString()) },
+ { "gl_version", glContextData["version"] },
+ { "gl_vender", glContextData["vendor"] },
+ { "gl_sl_version", glContextData["sl_version"] },
+ { "gl_renderer", glContextData["renderer"] },
+ { "ideal_thread_count", QThread::idealThreadCount() }
+ };
auto macVersion = QSysInfo::macVersion();
if (macVersion != QSysInfo::MV_None) {
properties["os_osx_version"] = QSysInfo::macVersion();
@@ -1605,7 +1629,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// For now we're going to set the PPS for outbound packets to be super high, this is
// probably not the right long term solution. But for now, we're going to do this to
// allow you to move an entity around in your hand
- _entityEditSender.setPacketsPerSecond(3000); // super high!!
+ _entityEditSender.setPacketsPerSecond(3000); // super high!!
// Make sure we don't time out during slow operations at startup
updateHeartbeat();
@@ -1613,16 +1637,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
// FIXME -- I'm a little concerned about this.
- connect(myAvatar->getSkeletonModel().get(), &SkeletonModel::skeletonLoaded, this, &Application::checkSkeleton,
- Qt::QueuedConnection);
+ connect(myAvatar->getSkeletonModel().get(), &SkeletonModel::skeletonLoaded,
+ this, &Application::checkSkeleton, Qt::QueuedConnection);
// Setup the userInputMapper with the actions
auto userInputMapper = DependencyManager::get();
connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) {
using namespace controller;
auto tabletScriptingInterface = DependencyManager::get();
- auto audioScriptingInterface =
- reinterpret_cast(DependencyManager::get().data());
+ QSharedPointer audioScriptingInterface = qSharedPointerDynamicCast(DependencyManager::get());
{
auto actionEnum = static_cast(action);
int key = Qt::Key_unknown;
@@ -1630,10 +1653,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
bool navAxis = false;
switch (actionEnum) {
case Action::TOGGLE_PUSHTOTALK:
- if (state > 0.0f) {
- audioScriptingInterface->setPushingToTalk(true);
- } else if (state <= 0.0f) {
- audioScriptingInterface->setPushingToTalk(false);
+ if (audioScriptingInterface) {
+ if (state > 0.0f) {
+ audioScriptingInterface->setPushingToTalk(true);
+ } else if (state <= 0.0f) {
+ audioScriptingInterface->setPushingToTalk(false);
+ }
}
break;
@@ -1704,7 +1729,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
if (action == controller::toInt(controller::Action::RETICLE_CLICK)) {
auto reticlePos = getApplicationCompositor().getReticlePosition();
- QPoint localPos(reticlePos.x, reticlePos.y); // both hmd and desktop already handle this in our coordinates.
+ QPoint localPos(reticlePos.x, reticlePos.y); // both hmd and desktop already handle this in our coordinates.
if (state) {
QMouseEvent mousePress(QEvent::MouseButtonPress, localPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
sendEvent(_glWidget, &mousePress);
@@ -1714,7 +1739,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
sendEvent(_glWidget, &mouseRelease);
_reticleClickPressed = false;
}
- return; // nothing else to do
+ return; // nothing else to do
}
if (state) {
@@ -1739,7 +1764,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_applicationStateDevice = userInputMapper->getStateDevice();
- _applicationStateDevice->setInputVariant(STATE_IN_HMD, []() -> float { return qApp->isHMDMode() ? 1 : 0; });
+ _applicationStateDevice->setInputVariant(STATE_IN_HMD, []() -> float {
+ return qApp->isHMDMode() ? 1 : 0;
+ });
_applicationStateDevice->setInputVariant(STATE_CAMERA_FULL_SCREEN_MIRROR, []() -> float {
return qApp->getCamera().getMode() == CAMERA_MODE_MIRROR ? 1 : 0;
});
@@ -1755,8 +1782,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_applicationStateDevice->setInputVariant(STATE_CAMERA_INDEPENDENT, []() -> float {
return qApp->getCamera().getMode() == CAMERA_MODE_INDEPENDENT ? 1 : 0;
});
- _applicationStateDevice->setInputVariant(STATE_SNAP_TURN,
- []() -> float { return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0; });
+ _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float {
+ return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0;
+ });
_applicationStateDevice->setInputVariant(STATE_ADVANCED_MOVEMENT_CONTROLS, []() -> float {
return qApp->getMyAvatar()->useAdvancedMovementControls() ? 1 : 0;
});
@@ -1766,8 +1794,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_applicationStateDevice->setInputVariant(STATE_RIGHT_HAND_DOMINANT, []() -> float {
return qApp->getMyAvatar()->getDominantHand() == "right" ? 1 : 0;
});
- _applicationStateDevice->setInputVariant(STATE_STRAFE_ENABLED,
- []() -> float { return qApp->getMyAvatar()->getStrafeEnabled() ? 1 : 0; });
+ _applicationStateDevice->setInputVariant(STATE_STRAFE_ENABLED, []() -> float {
+ return qApp->getMyAvatar()->getStrafeEnabled() ? 1 : 0;
+ });
_applicationStateDevice->setInputVariant(STATE_GROUNDED, []() -> float {
return qApp->getMyAvatar()->getCharacterController()->onGround() ? 1 : 0;
@@ -1792,12 +1821,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
});
_applicationStateDevice->setInputVariant(STATE_PLATFORM_ANDROID, []() -> float {
#if defined(Q_OS_ANDROID)
- return 1;
+ return 1 ;
#else
return 0;
#endif
});
+
getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::STARTUP);
// Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings
@@ -1823,30 +1853,28 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Make sure we don't time out during slow operations at startup
updateHeartbeat();
QTimer* settingsTimer = new QTimer();
- moveToNewNamedThread(settingsTimer, "Settings Thread",
- [this, settingsTimer] {
- // This needs to run on the settings thread, so we need to pass the `settingsTimer` as the
- // receiver object, otherwise it will run on the application thread and trigger a warning
- // about trying to kill the timer on the main thread.
- connect(qApp, &Application::beforeAboutToQuit, settingsTimer, [this, settingsTimer] {
- // Disconnect the signal from the save settings
- QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
- // Stop the settings timer
- settingsTimer->stop();
- // Delete it (this will trigger the thread destruction
- settingsTimer->deleteLater();
- // Mark the settings thread as finished, so we know we can safely save in the main application
- // shutdown code
- _settingsGuard.trigger();
- });
+ moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{
+ // This needs to run on the settings thread, so we need to pass the `settingsTimer` as the
+ // receiver object, otherwise it will run on the application thread and trigger a warning
+ // about trying to kill the timer on the main thread.
+ connect(qApp, &Application::beforeAboutToQuit, settingsTimer, [this, settingsTimer]{
+ // Disconnect the signal from the save settings
+ QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
+ // Stop the settings timer
+ settingsTimer->stop();
+ // Delete it (this will trigger the thread destruction
+ settingsTimer->deleteLater();
+ // Mark the settings thread as finished, so we know we can safely save in the main application
+ // shutdown code
+ _settingsGuard.trigger();
+ });
- int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
- settingsTimer->setSingleShot(false);
- settingsTimer->setInterval(SAVE_SETTINGS_INTERVAL); // 10s, Qt::CoarseTimer acceptable
- QObject::connect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
- settingsTimer->start();
- },
- QThread::LowestPriority);
+ int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
+ settingsTimer->setSingleShot(false);
+ settingsTimer->setInterval(SAVE_SETTINGS_INTERVAL); // 10s, Qt::CoarseTimer acceptable
+ QObject::connect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
+ settingsTimer->start();
+ }, QThread::LowestPriority);
if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_MIN); // So that camera doesn't auto-switch to third person.
@@ -1858,15 +1886,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
AudioInjector::setLocalAudioInterface(audioIO);
auto audioScriptingInterface = DependencyManager::get();
audioScriptingInterface->setLocalAudioInterface(audioIO);
- connect(audioIO, &AudioClient::noiseGateOpened, audioScriptingInterface.data(),
- &AudioScriptingInterface::noiseGateOpened);
- connect(audioIO, &AudioClient::noiseGateClosed, audioScriptingInterface.data(),
- &AudioScriptingInterface::noiseGateClosed);
+ connect(audioIO, &AudioClient::noiseGateOpened, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateOpened);
+ connect(audioIO, &AudioClient::noiseGateClosed, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateClosed);
connect(audioIO, &AudioClient::inputReceived, audioScriptingInterface.data(), &AudioScriptingInterface::inputReceived);
}
this->installEventFilter(this);
+
+
#ifdef HAVE_DDE
auto ddeTracker = DependencyManager::get();
ddeTracker->init();
@@ -1882,20 +1910,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// If launched from Steam, let it handle updates
const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater";
bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1;
- bool buildCanUpdate =
- BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable || BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master;
+ bool buildCanUpdate = BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable
+ || BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master;
if (!noUpdater && buildCanUpdate) {
constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only";
auto applicationUpdater = DependencyManager::set();
- AutoUpdater::InstallerType type = installerType == INSTALLER_TYPE_CLIENT_ONLY ? AutoUpdater::InstallerType::CLIENT_ONLY
- : AutoUpdater::InstallerType::FULL;
+ AutoUpdater::InstallerType type = installerType == INSTALLER_TYPE_CLIENT_ONLY
+ ? AutoUpdater::InstallerType::CLIENT_ONLY : AutoUpdater::InstallerType::FULL;
applicationUpdater->setInstallerType(type);
applicationUpdater->setInstallerCampaign(installerCampaign);
- connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(),
- &DialogsManager::showUpdateDialog);
+ connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
applicationUpdater->checkForUpdate();
}
@@ -1914,9 +1941,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto keyboard = DependencyManager::get();
if (getEntities()->wantsKeyboardFocus(id)) {
setKeyboardFocusEntity(id);
- } else if (
- !keyboard->containsID(
- id)) { // FIXME: this is a hack to make the keyboard work for now, since the keys would otherwise steal focus
+ } else if (!keyboard->containsID(id)) { // FIXME: this is a hack to make the keyboard work for now, since the keys would otherwise steal focus
setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
}
}
@@ -1925,63 +1950,57 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(pointerManager.data(), &PointerManager::triggerBeginOverlay, keyboardFocusOperator);
auto entityScriptingInterface = DependencyManager::get();
- connect(entityScriptingInterface.data(), &EntityScriptingInterface::deletingEntity, this,
- [this](const EntityItemID& entityItemID) {
- if (entityItemID == _keyboardFocusedEntity.get()) {
- setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
- }
- },
- Qt::QueuedConnection);
-
- EntityTreeRenderer::setAddMaterialToEntityOperator(
- [this](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
- if (_aboutToQuit) {
- return false;
- }
-
- auto renderable = getEntities()->renderableForEntityId(entityID);
- if (renderable) {
- renderable->addMaterial(material, parentMaterialName);
- return true;
- }
+ connect(entityScriptingInterface.data(), &EntityScriptingInterface::deletingEntity, this, [this](const EntityItemID& entityItemID) {
+ if (entityItemID == _keyboardFocusedEntity.get()) {
+ setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
+ }
+ }, Qt::QueuedConnection);
+ EntityTreeRenderer::setAddMaterialToEntityOperator([this](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
+ if (_aboutToQuit) {
return false;
- });
- EntityTreeRenderer::setRemoveMaterialFromEntityOperator(
- [this](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
- if (_aboutToQuit) {
- return false;
- }
+ }
- auto renderable = getEntities()->renderableForEntityId(entityID);
- if (renderable) {
- renderable->removeMaterial(material, parentMaterialName);
- return true;
- }
+ auto renderable = getEntities()->renderableForEntityId(entityID);
+ if (renderable) {
+ renderable->addMaterial(material, parentMaterialName);
+ return true;
+ }
+ return false;
+ });
+ EntityTreeRenderer::setRemoveMaterialFromEntityOperator([this](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
+ if (_aboutToQuit) {
return false;
- });
+ }
- EntityTreeRenderer::setAddMaterialToAvatarOperator(
- [](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
- auto avatarManager = DependencyManager::get();
- auto avatar = avatarManager->getAvatarBySessionID(avatarID);
- if (avatar) {
- avatar->addMaterial(material, parentMaterialName);
- return true;
- }
- return false;
- });
- EntityTreeRenderer::setRemoveMaterialFromAvatarOperator(
- [](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
- auto avatarManager = DependencyManager::get();
- auto avatar = avatarManager->getAvatarBySessionID(avatarID);
- if (avatar) {
- avatar->removeMaterial(material, parentMaterialName);
- return true;
- }
- return false;
- });
+ auto renderable = getEntities()->renderableForEntityId(entityID);
+ if (renderable) {
+ renderable->removeMaterial(material, parentMaterialName);
+ return true;
+ }
+
+ return false;
+ });
+
+ EntityTreeRenderer::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
+ auto avatarManager = DependencyManager::get();
+ auto avatar = avatarManager->getAvatarBySessionID(avatarID);
+ if (avatar) {
+ avatar->addMaterial(material, parentMaterialName);
+ return true;
+ }
+ return false;
+ });
+ EntityTreeRenderer::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
+ auto avatarManager = DependencyManager::get();
+ auto avatar = avatarManager->getAvatarBySessionID(avatarID);
+ if (avatar) {
+ avatar->removeMaterial(material, parentMaterialName);
+ return true;
+ }
+ return false;
+ });
EntityTree::setGetEntityObjectOperator([this](const QUuid& id) -> QObject* {
auto entities = getEntities();
@@ -2008,7 +2027,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
return QSizeF(0.0f, 0.0f);
});
- connect(this, &Application::aboutToQuit, [this]() { setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); });
+ connect(this, &Application::aboutToQuit, [this]() {
+ setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
+ });
// Add periodic checks to send user activity data
static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000;
@@ -2027,6 +2048,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
QTimer* sendStatsTimer = new QTimer(this);
sendStatsTimer->setInterval(SEND_STATS_INTERVAL_MS); // 10s, Qt::CoarseTimer acceptable
connect(sendStatsTimer, &QTimer::timeout, this, [this]() {
+
QJsonObject properties = {};
MemoryInfo memInfo;
if (getMemoryInfo(memInfo)) {
@@ -2037,8 +2059,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// content location and build info - useful for filtering stats
auto addressManager = DependencyManager::get();
- auto currentDomain = addressManager->currentShareableAddress(true).toString(); // domain only
- auto currentPath = addressManager->currentPath(true); // with orientation
+ auto currentDomain = addressManager->currentShareableAddress(true).toString(); // domain only
+ auto currentPath = addressManager->currentPath(true); // with orientation
properties["current_domain"] = currentDomain;
properties["current_path"] = currentPath;
properties["build_version"] = BuildInfo::VERSION;
@@ -2102,24 +2124,24 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
startedRequests["atp"] = statTracker->getStat(STAT_ATP_REQUEST_STARTED).toInt();
startedRequests["http"] = statTracker->getStat(STAT_HTTP_REQUEST_STARTED).toInt();
startedRequests["file"] = statTracker->getStat(STAT_FILE_REQUEST_STARTED).toInt();
- startedRequests["total"] =
- startedRequests["atp"].toInt() + startedRequests["http"].toInt() + startedRequests["file"].toInt();
+ startedRequests["total"] = startedRequests["atp"].toInt() + startedRequests["http"].toInt()
+ + startedRequests["file"].toInt();
properties["started_requests"] = startedRequests;
QJsonObject successfulRequests;
successfulRequests["atp"] = statTracker->getStat(STAT_ATP_REQUEST_SUCCESS).toInt();
successfulRequests["http"] = statTracker->getStat(STAT_HTTP_REQUEST_SUCCESS).toInt();
successfulRequests["file"] = statTracker->getStat(STAT_FILE_REQUEST_SUCCESS).toInt();
- successfulRequests["total"] =
- successfulRequests["atp"].toInt() + successfulRequests["http"].toInt() + successfulRequests["file"].toInt();
+ successfulRequests["total"] = successfulRequests["atp"].toInt() + successfulRequests["http"].toInt()
+ + successfulRequests["file"].toInt();
properties["successful_requests"] = successfulRequests;
QJsonObject failedRequests;
failedRequests["atp"] = statTracker->getStat(STAT_ATP_REQUEST_FAILED).toInt();
failedRequests["http"] = statTracker->getStat(STAT_HTTP_REQUEST_FAILED).toInt();
failedRequests["file"] = statTracker->getStat(STAT_FILE_REQUEST_FAILED).toInt();
- failedRequests["total"] =
- failedRequests["atp"].toInt() + failedRequests["http"].toInt() + failedRequests["file"].toInt();
+ failedRequests["total"] = failedRequests["atp"].toInt() + failedRequests["http"].toInt()
+ + failedRequests["file"].toInt();
properties["failed_requests"] = failedRequests;
QJsonObject cacheRequests;
@@ -2164,18 +2186,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
totalServerOctreeElements += i->second.getTotalElements();
}
- properties["local_octree_elements"] = (qint64)OctreeElement::getInternalNodeCount();
- properties["server_octree_elements"] = (qint64)totalServerOctreeElements;
+ properties["local_octree_elements"] = (qint64) OctreeElement::getInternalNodeCount();
+ properties["server_octree_elements"] = (qint64) totalServerOctreeElements;
properties["active_display_plugin"] = getActiveDisplayPlugin()->getName();
properties["using_hmd"] = isHMDMode();
_autoSwitchDisplayModeSupportedHMDPlugin = nullptr;
- foreach (DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
- if (displayPlugin->isHmd() && displayPlugin->getSupportsAutoSwitch()) {
+ foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
+ if (displayPlugin->isHmd() &&
+ displayPlugin->getSupportsAutoSwitch()) {
_autoSwitchDisplayModeSupportedHMDPlugin = displayPlugin;
- _autoSwitchDisplayModeSupportedHMDPluginName = _autoSwitchDisplayModeSupportedHMDPlugin->getName();
- _previousHMDWornStatus = _autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible();
+ _autoSwitchDisplayModeSupportedHMDPluginName =
+ _autoSwitchDisplayModeSupportedHMDPlugin->getName();
+ _previousHMDWornStatus =
+ _autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible();
break;
}
}
@@ -2183,7 +2208,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
if (_autoSwitchDisplayModeSupportedHMDPlugin) {
if (getActiveDisplayPlugin() != _autoSwitchDisplayModeSupportedHMDPlugin &&
!_autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
- startHMDStandBySession();
+ startHMDStandBySession();
}
// Poll periodically to check whether the user has worn HMD or not. Switch Display mode accordingly.
// If the user wears HMD then switch to VR mode. If the user removes HMD then switch to Desktop mode.
@@ -2209,8 +2234,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// controller::Pose considers two poses to be different if either are invalid. In our case, we actually
// want to consider the pose to be unchanged if it was invalid and still is invalid, so we check that first.
properties["hand_pose_changed"] =
- ((leftHandPose.valid || lastLeftHandPose.valid) && (leftHandPose != lastLeftHandPose)) ||
- ((rightHandPose.valid || lastRightHandPose.valid) && (rightHandPose != lastRightHandPose));
+ ((leftHandPose.valid || lastLeftHandPose.valid) && (leftHandPose != lastLeftHandPose))
+ || ((rightHandPose.valid || lastRightHandPose.valid) && (rightHandPose != lastRightHandPose));
lastLeftHandPose = leftHandPose;
lastRightHandPose = rightHandPose;
@@ -2221,12 +2246,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Periodically check for count of nearby avatars
static int lastCountOfNearbyAvatars = -1;
QTimer* checkNearbyAvatarsTimer = new QTimer(this);
- checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok
+ checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok
connect(checkNearbyAvatarsTimer, &QTimer::timeout, this, []() {
auto avatarManager = DependencyManager::get();
int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getWorldPosition(),
- NEARBY_AVATAR_RADIUS_METERS) -
- 1;
+ NEARBY_AVATAR_RADIUS_METERS) - 1;
if (nearbyAvatars != lastCountOfNearbyAvatars) {
lastCountOfNearbyAvatars = nearbyAvatars;
UserActivityLogger::getInstance().logAction("nearby_avatars", { { "count", nearbyAvatars } });
@@ -2235,7 +2259,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
checkNearbyAvatarsTimer->start();
// Track user activity event when we receive a mute packet
- auto onMutedByMixer = []() { UserActivityLogger::getInstance().logAction("received_mute_packet"); };
+ auto onMutedByMixer = []() {
+ UserActivityLogger::getInstance().logAction("received_mute_packet");
+ };
connect(DependencyManager::get().data(), &AudioClient::mutedByMixer, this, onMutedByMixer);
// Track when the address bar is opened
@@ -2265,16 +2291,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Monitor model assets (e.g., from Clara.io) added to the world that may need resizing.
static const int ADD_ASSET_TO_WORLD_TIMER_INTERVAL_MS = 1000;
- _addAssetToWorldResizeTimer.setInterval(ADD_ASSET_TO_WORLD_TIMER_INTERVAL_MS); // 1s, Qt::CoarseTimer acceptable
+ _addAssetToWorldResizeTimer.setInterval(ADD_ASSET_TO_WORLD_TIMER_INTERVAL_MS); // 1s, Qt::CoarseTimer acceptable
connect(&_addAssetToWorldResizeTimer, &QTimer::timeout, this, &Application::addAssetToWorldCheckModelSize);
// Auto-update and close adding asset to world info message box.
static const int ADD_ASSET_TO_WORLD_INFO_TIMEOUT_MS = 5000;
- _addAssetToWorldInfoTimer.setInterval(ADD_ASSET_TO_WORLD_INFO_TIMEOUT_MS); // 5s, Qt::CoarseTimer acceptable
+ _addAssetToWorldInfoTimer.setInterval(ADD_ASSET_TO_WORLD_INFO_TIMEOUT_MS); // 5s, Qt::CoarseTimer acceptable
_addAssetToWorldInfoTimer.setSingleShot(true);
connect(&_addAssetToWorldInfoTimer, &QTimer::timeout, this, &Application::addAssetToWorldInfoTimeout);
static const int ADD_ASSET_TO_WORLD_ERROR_TIMEOUT_MS = 8000;
- _addAssetToWorldErrorTimer.setInterval(ADD_ASSET_TO_WORLD_ERROR_TIMEOUT_MS); // 8s, Qt::CoarseTimer acceptable
+ _addAssetToWorldErrorTimer.setInterval(ADD_ASSET_TO_WORLD_ERROR_TIMEOUT_MS); // 8s, Qt::CoarseTimer acceptable
_addAssetToWorldErrorTimer.setSingleShot(true);
connect(&_addAssetToWorldErrorTimer, &QTimer::timeout, this, &Application::addAssetToWorldErrorTimeout);
@@ -2286,8 +2312,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged);
- DependencyManager::get()->setShouldPickHUDOperator(
- []() { return DependencyManager::get()->isHMDMode(); });
+ DependencyManager::get()->setShouldPickHUDOperator([]() { return DependencyManager::get()->isHMDMode(); });
DependencyManager::get()->setCalculatePos2DFromHUDOperator([this](const glm::vec3& intersection) {
const glm::vec2 MARGIN(25.0f);
glm::vec2 maxPos = _controllerScriptingInterface->getViewportDimensions() - MARGIN;
@@ -2297,10 +2322,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Setup the mouse ray pick and related operators
{
- auto mouseRayPick = std::make_shared(Vectors::ZERO, Vectors::UP,
- PickFilter(PickScriptingInterface::PICK_ENTITIES() |
- PickScriptingInterface::PICK_LOCAL_ENTITIES()),
- 0.0f, true);
+ auto mouseRayPick = std::make_shared(Vectors::ZERO, Vectors::UP, PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_LOCAL_ENTITIES()), 0.0f, true);
mouseRayPick->parentTransform = std::make_shared();
mouseRayPick->setJointState(PickQuery::JOINT_STATE_MOUSE);
auto mouseRayPickID = DependencyManager::get()->addPick(PickQuery::Ray, mouseRayPick);
@@ -2326,8 +2348,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
DependencyManager::get()->setPrecisionPicking(rayPickID, value);
});
- EntityItem::setBillboardRotationOperator([](const glm::vec3& position, const glm::quat& rotation,
- BillboardMode billboardMode, const glm::vec3& frustumPos) {
+ EntityItem::setBillboardRotationOperator([](const glm::vec3& position, const glm::quat& rotation, BillboardMode billboardMode, const glm::vec3& frustumPos) {
if (billboardMode == BillboardMode::YAW) {
//rotate about vertical to face the camera
glm::vec3 dPosition = frustumPos - position;
@@ -2353,12 +2374,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
return viewFrustum.getPosition();
});
- DependencyManager::get()->setKickConfirmationOperator(
- [this](const QUuid& nodeID) { userKickConfirmation(nodeID); });
+ DependencyManager::get()->setKickConfirmationOperator([this] (const QUuid& nodeID) { userKickConfirmation(nodeID); });
- render::entities::WebEntityRenderer::setAcquireWebSurfaceOperator([=](const QString& url, bool htmlContent,
- QSharedPointer& webSurface,
- bool& cachedWebSurface) {
+ render::entities::WebEntityRenderer::setAcquireWebSurfaceOperator([=](const QString& url, bool htmlContent, QSharedPointer& webSurface, bool& cachedWebSurface) {
bool isTablet = url == TabletScriptingInterface::QML;
if (htmlContent) {
webSurface = DependencyManager::get()->acquire(render::entities::WebEntityRenderer::QML);
@@ -2372,8 +2390,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
QObject::connect(webSurface.data(), &hifi::qml::OffscreenSurface::rootContextCreated, rootItemLoadedFunctor);
}
auto surfaceContext = webSurface->getSurfaceContext();
- surfaceContext->setContextProperty("KeyboardScriptingInterface",
- DependencyManager::get().data());
+ surfaceContext->setContextProperty("KeyboardScriptingInterface", DependencyManager::get().data());
} else {
// FIXME: the tablet should use the OffscreenQmlSurfaceCache
webSurface = QSharedPointer(new OffscreenQmlSurface(), [](OffscreenQmlSurface* webSurface) {
@@ -2384,9 +2401,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
});
});
auto rootItemLoadedFunctor = [webSurface, url, isTablet] {
- Application::setupQmlSurface(webSurface->getSurfaceContext(), isTablet || url == LOGIN_DIALOG.toString() ||
- url == AVATAR_INPUTS_BAR_QML.toString() ||
- url == BUBBLE_ICON_QML.toString());
+ Application::setupQmlSurface(webSurface->getSurfaceContext(), isTablet || url == LOGIN_DIALOG.toString() || url == AVATAR_INPUTS_BAR_QML.toString() ||
+ url == BUBBLE_ICON_QML.toString());
};
if (webSurface->getRootItem()) {
rootItemLoadedFunctor();
@@ -2400,9 +2416,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
const uint8_t TABLET_FPS = 90;
webSurface->setMaxFps(isTablet ? TABLET_FPS : DEFAULT_MAX_FPS);
});
- render::entities::WebEntityRenderer::setReleaseWebSurfaceOperator([=](QSharedPointer& webSurface,
- bool& cachedWebSurface,
- std::vector& connections) {
+ render::entities::WebEntityRenderer::setReleaseWebSurfaceOperator([=](QSharedPointer& webSurface, bool& cachedWebSurface, std::vector& connections) {
QQuickItem* rootItem = webSurface->getRootItem();
// Fix for crash in QtWebEngineCore when rapidly switching domains
@@ -2511,10 +2525,10 @@ QString Application::getUserAgent() {
return userAgent;
}
- QString userAgent = "Mozilla/5.0 (HighFidelityInterface/" + BuildInfo::VERSION + "; " + QSysInfo::productType() + " " +
- QSysInfo::productVersion() + ")";
+ QString userAgent = "Mozilla/5.0 (HighFidelityInterface/" + BuildInfo::VERSION + "; "
+ + QSysInfo::productType() + " " + QSysInfo::productVersion() + ")";
- auto formatPluginName = [](QString name) -> QString { return name.trimmed().replace(" ", "-"); };
+ auto formatPluginName = [](QString name) -> QString { return name.trimmed().replace(" ", "-"); };
// For each plugin, add to userAgent
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
@@ -2523,7 +2537,7 @@ QString Application::getUserAgent() {
userAgent += " " + formatPluginName(dp->getName());
}
}
- auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
+ auto inputPlugins= PluginManager::getInstance()->getInputPlugins();
for (auto& ip : inputPlugins) {
if (ip->isActive()) {
userAgent += " " + formatPluginName(ip->getName());
@@ -2557,7 +2571,7 @@ void Application::checkChangeCursor() {
QMutexLocker locker(&_changeCursorLock);
if (_cursorNeedsChanging) {
#ifdef Q_OS_MAC
- auto cursorTarget = _window; // OSX doesn't seem to provide for hiding the cursor only on the GL widget
+ auto cursorTarget = _window; // OSX doesn't seem to provide for hiding the cursor only on the GL widget
#else
// On windows and linux, hiding the top level cursor also means it's invisible when hovering over the
// window menu, which is a pain, so only hide it for the GL surface
@@ -2596,7 +2610,7 @@ void Application::onAboutToQuit() {
_firstRun.set(false);
}
- foreach (auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
+ foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
if (inputPlugin->isActive()) {
inputPlugin->deactivate();
}
@@ -2609,7 +2623,8 @@ void Application::onAboutToQuit() {
loginDialogPoppedUp.set(false);
getActiveDisplayPlugin()->deactivate();
- if (_autoSwitchDisplayModeSupportedHMDPlugin && _autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
+ if (_autoSwitchDisplayModeSupportedHMDPlugin
+ && _autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
_autoSwitchDisplayModeSupportedHMDPlugin->endSession();
}
// use the CloseEventSender via a QThread to send an event that says the user asked for the app to close
@@ -2671,7 +2686,7 @@ void Application::cleanupBeforeQuit() {
nodeList->getPacketReceiver().setShouldDropPackets(true);
}
- getEntities()->shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
+ getEntities()->shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
// Clear any queued processing (I/O, FBX/OBJ/Texture parsing)
QThreadPool::globalInstance()->clear();
@@ -2680,7 +2695,7 @@ void Application::cleanupBeforeQuit() {
// FIXME: Something is still holding on to the ScriptEnginePointers contained in ScriptEngines, and they hold backpointers to ScriptEngines,
// so this doesn't shut down properly
- DependencyManager::get()->shutdownScripting(); // stop all currently running global scripts
+ DependencyManager::get()->shutdownScripting(); // stop all currently running global scripts
// These classes hold ScriptEnginePointers, so they must be destroyed before ScriptEngines
// Must be done after shutdownScripting in case any scripts try to access these things
{
@@ -2724,7 +2739,7 @@ void Application::cleanupBeforeQuit() {
DependencyManager::destroy();
#endif
- DependencyManager::destroy(); // Must be destroyed before TabletScriptingInterface
+ DependencyManager::destroy(); // Must be destroyed before TabletScriptingInterface
// stop QML
DependencyManager::destroy();
@@ -2765,14 +2780,14 @@ Application::~Application() {
avatarManager->handleProcessedPhysicsTransaction(transaction);
avatarManager->deleteAllAvatars();
-
+
auto myCharacterController = getMyAvatar()->getCharacterController();
myCharacterController->clearDetailedMotionStates();
-
+
myCharacterController->buildPhysicsTransaction(transaction);
_physicsEngine->processTransaction(transaction);
myCharacterController->handleProcessedPhysicsTransaction(transaction);
-
+
_physicsEngine->setCharacterController(nullptr);
// the _shapeManager should have zero references
@@ -2802,7 +2817,7 @@ Application::~Application() {
DependencyManager::destroy();
- DependencyManager::destroy(); // must be destroyed before the FramebufferCache
+ DependencyManager::destroy(); // must be destroyed before the FramebufferCache
DependencyManager::destroy();
@@ -2876,7 +2891,7 @@ void Application::initializeGL() {
if (!nsightActive()) {
_chromiumShareContext = new OffscreenGLCanvas();
_chromiumShareContext->setObjectName("ChromiumShareContext");
- auto format = QSurfaceFormat::defaultFormat();
+ auto format =QSurfaceFormat::defaultFormat();
#ifdef Q_OS_MAC
// On mac, the primary shared OpenGL context must be a 3.2 core context,
// or chromium flips out and spews error spam (but renders fine)
@@ -2895,6 +2910,7 @@ void Application::initializeGL() {
}
#endif
+
_glWidget->createContext(globalShareContext);
if (!_glWidget->makeCurrent()) {
@@ -2903,7 +2919,7 @@ void Application::initializeGL() {
#if !defined(DISABLE_QML)
QStringList chromiumFlags;
- // Bug 21993: disable microphone and camera input
+ // Bug 21993: disable microphone and camera input
chromiumFlags << "--use-fake-device-for-media-stream";
// Disable signed distance field font rendering on ATI/AMD GPUs, due to
// https://highfidelity.manuscript.com/f/cases/13677/Text-showing-up-white-on-Marketplace-app
@@ -2940,6 +2956,7 @@ void Application::initializeGL() {
}
#endif
+
// Build an offscreen GL context for the main thread.
_glWidget->makeCurrent();
glClearColor(0.2f, 0.2f, 0.2f, 1);
@@ -2957,18 +2974,18 @@ void Application::initializeDisplayPlugins() {
auto defaultDisplayPlugin = displayPlugins.at(0);
// Once time initialization code
DisplayPluginPointer targetDisplayPlugin;
- foreach (auto displayPlugin, displayPlugins) {
+ foreach(auto displayPlugin, displayPlugins) {
displayPlugin->setContext(_graphicsEngine.getGPUContext());
if (displayPlugin->getName() == lastActiveDisplayPluginName) {
targetDisplayPlugin = displayPlugin;
}
QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged,
- [this](const QSize& size) { resizeGL(); });
+ [this](const QSize& size) { resizeGL(); });
QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset);
if (displayPlugin->isHmd()) {
auto hmdDisplayPlugin = dynamic_cast(displayPlugin.get());
QObject::connect(hmdDisplayPlugin, &HmdDisplayPlugin::hmdMountedChanged,
- DependencyManager::get().data(), &HMDScriptingInterface::mountedChanged);
+ DependencyManager::get().data(), &HMDScriptingInterface::mountedChanged);
QObject::connect(hmdDisplayPlugin, &HmdDisplayPlugin::hmdVisibleChanged, this, &Application::hmdVisibleChanged);
}
}
@@ -3005,8 +3022,7 @@ void Application::showLoginScreen() {
auto dialogsManager = DependencyManager::get();
if (!accountManager->isLoggedIn()) {
if (!isHMDMode()) {
- auto toolbar =
- DependencyManager::get()->getToolbar("com.highfidelity.interface.toolbar.system");
+ auto toolbar = DependencyManager::get()->getToolbar("com.highfidelity.interface.toolbar.system");
toolbar->writeProperty("visible", false);
}
_loginDialogPoppedUp = true;
@@ -3035,64 +3051,60 @@ void Application::initializeUi() {
QmlContextCallback commerceCallback = [](QQmlContext* context) {
context->setContextProperty("Commerce", DependencyManager::get().data());
};
- OffscreenQmlSurface::addWhitelistContextHandler(
- {
- QUrl{ "hifi/commerce/checkout/Checkout.qml" },
- QUrl{ "hifi/commerce/common/CommerceLightbox.qml" },
- QUrl{ "hifi/commerce/common/EmulatedMarketplaceHeader.qml" },
- QUrl{ "hifi/commerce/common/FirstUseTutorial.qml" },
- QUrl{ "hifi/commerce/common/sendAsset/SendAsset.qml" },
- QUrl{ "hifi/commerce/common/SortableListModel.qml" },
- QUrl{ "hifi/commerce/inspectionCertificate/InspectionCertificate.qml" },
- QUrl{ "hifi/commerce/marketplaceItemTester/MarketplaceItemTester.qml" },
- QUrl{ "hifi/commerce/purchases/PurchasedItem.qml" },
- QUrl{ "hifi/commerce/purchases/Purchases.qml" },
- QUrl{ "hifi/commerce/wallet/Help.qml" },
- QUrl{ "hifi/commerce/wallet/NeedsLogIn.qml" },
- QUrl{ "hifi/commerce/wallet/PassphraseChange.qml" },
- QUrl{ "hifi/commerce/wallet/PassphraseModal.qml" },
- QUrl{ "hifi/commerce/wallet/PassphraseSelection.qml" },
- QUrl{ "hifi/commerce/wallet/Wallet.qml" },
- QUrl{ "hifi/commerce/wallet/WalletHome.qml" },
- QUrl{ "hifi/commerce/wallet/WalletSetup.qml" },
- QUrl{ "hifi/dialogs/security/Security.qml" },
- QUrl{ "hifi/dialogs/security/SecurityImageChange.qml" },
- QUrl{ "hifi/dialogs/security/SecurityImageModel.qml" },
- QUrl{ "hifi/dialogs/security/SecurityImageSelection.qml" },
- QUrl{ "hifi/tablet/TabletMenu.qml" },
- QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
- },
- commerceCallback);
+ OffscreenQmlSurface::addWhitelistContextHandler({
+ QUrl{ "hifi/commerce/checkout/Checkout.qml" },
+ QUrl{ "hifi/commerce/common/CommerceLightbox.qml" },
+ QUrl{ "hifi/commerce/common/EmulatedMarketplaceHeader.qml" },
+ QUrl{ "hifi/commerce/common/FirstUseTutorial.qml" },
+ QUrl{ "hifi/commerce/common/sendAsset/SendAsset.qml" },
+ QUrl{ "hifi/commerce/common/SortableListModel.qml" },
+ QUrl{ "hifi/commerce/inspectionCertificate/InspectionCertificate.qml" },
+ QUrl{ "hifi/commerce/marketplaceItemTester/MarketplaceItemTester.qml"},
+ QUrl{ "hifi/commerce/purchases/PurchasedItem.qml" },
+ QUrl{ "hifi/commerce/purchases/Purchases.qml" },
+ QUrl{ "hifi/commerce/wallet/Help.qml" },
+ QUrl{ "hifi/commerce/wallet/NeedsLogIn.qml" },
+ QUrl{ "hifi/commerce/wallet/PassphraseChange.qml" },
+ QUrl{ "hifi/commerce/wallet/PassphraseModal.qml" },
+ QUrl{ "hifi/commerce/wallet/PassphraseSelection.qml" },
+ QUrl{ "hifi/commerce/wallet/Wallet.qml" },
+ QUrl{ "hifi/commerce/wallet/WalletHome.qml" },
+ QUrl{ "hifi/commerce/wallet/WalletSetup.qml" },
+ QUrl{ "hifi/dialogs/security/Security.qml" },
+ QUrl{ "hifi/dialogs/security/SecurityImageChange.qml" },
+ QUrl{ "hifi/dialogs/security/SecurityImageModel.qml" },
+ QUrl{ "hifi/dialogs/security/SecurityImageSelection.qml" },
+ QUrl{ "hifi/tablet/TabletMenu.qml" },
+ QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
+ }, commerceCallback);
QmlContextCallback marketplaceCallback = [](QQmlContext* context) {
context->setContextProperty("MarketplaceScriptingInterface", new QmlMarketplace());
};
- OffscreenQmlSurface::addWhitelistContextHandler(
- {
- QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
- },
- marketplaceCallback);
+ OffscreenQmlSurface::addWhitelistContextHandler({
+ QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
+ }, marketplaceCallback);
QmlContextCallback platformInfoCallback = [](QQmlContext* context) {
context->setContextProperty("PlatformInfo", new PlatformInfoScriptingInterface());
};
- OffscreenQmlSurface::addWhitelistContextHandler(
- {
- QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
- QUrl{ "hifi/commerce/purchases/Purchases.qml" },
- QUrl{ "hifi/commerce/wallet/Wallet.qml" },
- QUrl{ "hifi/commerce/wallet/WalletHome.qml" },
- QUrl{ "hifi/tablet/TabletAddressDialog.qml" },
- QUrl{ "hifi/Card.qml" },
- QUrl{ "hifi/Pal.qml" },
- QUrl{ "hifi/NameCard.qml" },
- },
- platformInfoCallback);
+ OffscreenQmlSurface::addWhitelistContextHandler({
+ QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
+ QUrl{ "hifi/commerce/purchases/Purchases.qml" },
+ QUrl{ "hifi/commerce/wallet/Wallet.qml" },
+ QUrl{ "hifi/commerce/wallet/WalletHome.qml" },
+ QUrl{ "hifi/tablet/TabletAddressDialog.qml" },
+ QUrl{ "hifi/Card.qml" },
+ QUrl{ "hifi/Pal.qml" },
+ QUrl{ "hifi/NameCard.qml" },
+ }, platformInfoCallback);
QmlContextCallback ttsCallback = [](QQmlContext* context) {
context->setContextProperty("TextToSpeech", DependencyManager::get().data());
};
- OffscreenQmlSurface::addWhitelistContextHandler({ QUrl{ "hifi/tts/TTS.qml" } }, ttsCallback);
+ OffscreenQmlSurface::addWhitelistContextHandler({
+ QUrl{ "hifi/tts/TTS.qml" }
+ }, ttsCallback);
qmlRegisterType("Hifi", 1, 0, "ResourceImageItem");
qmlRegisterType("Hifi", 1, 0, "Preference");
qmlRegisterType("HifiWeb", 1, 0, "WebBrowserSuggestionsEngine");
@@ -3103,15 +3115,18 @@ void Application::initializeUi() {
}
auto offscreenUi = getOffscreenUI();
- connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootContextCreated, this,
- &Application::onDesktopRootContextCreated);
- connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootItemCreated, this, &Application::onDesktopRootItemCreated);
+ connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootContextCreated,
+ this, &Application::onDesktopRootContextCreated);
+ connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootItemCreated,
+ this, &Application::onDesktopRootItemCreated);
#if !defined(DISABLE_QML)
offscreenUi->setProxyWindow(_window->windowHandle());
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
// support the window management and scripting proxies for VR use
- DeadlockWatchdogThread::withPause([&] { offscreenUi->createDesktop(PathUtils::qmlUrl("hifi/Desktop.qml")); });
+ DeadlockWatchdogThread::withPause([&] {
+ offscreenUi->createDesktop(PathUtils::qmlUrl("hifi/Desktop.qml"));
+ });
// FIXME either expose so that dialogs can set this themselves or
// do better detection in the offscreen UI of what has focus
offscreenUi->setNavigationFocused(false);
@@ -3135,7 +3150,7 @@ void Application::initializeUi() {
});
offscreenUi->resume();
#endif
- connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r) {
+ connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
resizeGL();
if (_touchscreenVirtualPadDevice) {
_touchscreenVirtualPadDevice->resize();
@@ -3144,7 +3159,7 @@ void Application::initializeUi() {
// This will set up the input plugins UI
_activeInputPlugins.clear();
- foreach (auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
+ foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
if (KeyboardMouseDevice::NAME == inputPlugin->getName()) {
_keyboardMouseDevice = std::dynamic_pointer_cast(inputPlugin);
}
@@ -3155,8 +3170,10 @@ void Application::initializeUi() {
_touchscreenVirtualPadDevice = std::dynamic_pointer_cast(inputPlugin);
#if defined(ANDROID_APP_INTERFACE)
auto& virtualPadManager = VirtualPad::Manager::instance();
- connect(&virtualPadManager, &VirtualPad::Manager::hapticFeedbackRequested, this,
- [](int duration) { AndroidHelper::instance().performHapticFeedback(duration); });
+ connect(&virtualPadManager, &VirtualPad::Manager::hapticFeedbackRequested,
+ this, [](int duration) {
+ AndroidHelper::instance().performHapticFeedback(duration);
+ });
#endif
}
}
@@ -3164,9 +3181,10 @@ void Application::initializeUi() {
auto compositorHelper = DependencyManager::get();
connect(compositorHelper.data(), &CompositorHelper::allowMouseCaptureChanged, this, [=] {
if (isHMDMode()) {
- auto compositorHelper = DependencyManager::get(); // don't capture outer smartpointer
- showCursor(compositorHelper->getAllowMouseCapture() ? Cursor::Manager::lookupIcon(_preferredCursor.get())
- : Cursor::Icon::SYSTEM);
+ auto compositorHelper = DependencyManager::get(); // don't capture outer smartpointer
+ showCursor(compositorHelper->getAllowMouseCapture() ?
+ Cursor::Manager::lookupIcon(_preferredCursor.get()) :
+ Cursor::Icon::SYSTEM);
}
});
@@ -3177,10 +3195,8 @@ void Application::initializeUi() {
if (rootObject == TabletScriptingInterface::QML) {
// in Qt 5.10.0 there is already an "Audio" object in the QML context
// though I failed to find it (from QtMultimedia??). So.. let it be "AudioScriptingInterface"
- surfaceContext->setContextProperty("AudioScriptingInterface",
- DependencyManager::get().data());
- surfaceContext->setContextProperty("Account",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ surfaceContext->setContextProperty("AudioScriptingInterface", DependencyManager::get().data());
+ surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
}
});
@@ -3196,12 +3212,10 @@ void Application::initializeUi() {
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
// first sort the plugins into groupings: standard, advanced, developer
std::stable_sort(displayPlugins.begin(), displayPlugins.end(),
- [](const DisplayPluginPointer& a, const DisplayPluginPointer& b) -> bool {
- return a->getGrouping() < b->getGrouping();
- });
+ [](const DisplayPluginPointer& a, const DisplayPluginPointer& b) -> bool { return a->getGrouping() < b->getGrouping(); });
int dpIndex = 1;
// concatenate the groupings into a single list in the order: standard, advanced, developer
- for (const auto& displayPlugin : displayPlugins) {
+ for(const auto& displayPlugin : displayPlugins) {
addDisplayPluginToMenu(displayPlugin, dpIndex, _displayPlugin == displayPlugin);
dpIndex++;
}
@@ -3212,15 +3226,18 @@ void Application::initializeUi() {
}
#endif
+
// The display plugins are created before the menu now, so we need to do this here to hide the menu bar
// now that it exists
if (_window && _window->isFullScreen()) {
setFullscreen(nullptr, true);
}
+
setIsInterstitialMode(true);
}
+
void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
auto engine = surfaceContext->engine();
// in Qt 5.10.0 there is already an "Audio" object in the QML context
@@ -3255,8 +3272,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
surfaceContext->setContextProperty("AvatarList", DependencyManager::get().data());
surfaceContext->setContextProperty("Users", DependencyManager::get().data());
- surfaceContext->setContextProperty("UserActivityLogger",
- DependencyManager::get().data());
+ surfaceContext->setContextProperty("UserActivityLogger", DependencyManager::get().data());
surfaceContext->setContextProperty("Camera", &_myCamera);
@@ -3281,10 +3297,8 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get().data());
- surfaceContext->setContextProperty("Account",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
- surfaceContext->setContextProperty("GlobalServices",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ surfaceContext->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
surfaceContext->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance());
surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
@@ -3342,10 +3356,12 @@ void Application::userKickConfirmation(const QUuid& nodeID) {
}
QString kickMessage = "Do you wish to kick " + userName + " from your domain";
- ModalDialogListener* dlg = OffscreenUi::asyncQuestion("Kick User", kickMessage, QMessageBox::Yes | QMessageBox::No);
+ ModalDialogListener* dlg = OffscreenUi::asyncQuestion("Kick User", kickMessage,
+ QMessageBox::Yes | QMessageBox::No);
if (dlg->getDialogItem()) {
- QObject::connect(dlg, &ModalDialogListener::response, this, [=](QVariant answer) {
+
+ QObject::connect(dlg, &ModalDialogListener::response, this, [=] (QVariant answer) {
QObject::disconnect(dlg, &ModalDialogListener::response, this, nullptr);
bool yes = (static_cast(answer.toInt()) == QMessageBox::Yes);
@@ -3364,16 +3380,14 @@ void Application::userKickConfirmation(const QUuid& nodeID) {
void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditionalContextProperties) {
surfaceContext->setContextProperty("Users", DependencyManager::get().data());
surfaceContext->setContextProperty("HMD", DependencyManager::get().data());
- surfaceContext->setContextProperty("UserActivityLogger",
- DependencyManager::get().data());
+ surfaceContext->setContextProperty("UserActivityLogger", DependencyManager::get().data());
surfaceContext->setContextProperty("Preferences", DependencyManager::get().data());
surfaceContext->setContextProperty("Vec3", new Vec3());
surfaceContext->setContextProperty("Quat", new Quat());
surfaceContext->setContextProperty("MyAvatar", DependencyManager::get()->getMyAvatar().get());
surfaceContext->setContextProperty("Entities", DependencyManager::get().data());
surfaceContext->setContextProperty("Snapshot", DependencyManager::get().data());
- surfaceContext->setContextProperty("KeyboardScriptingInterface",
- DependencyManager::get().data());
+ surfaceContext->setContextProperty("KeyboardScriptingInterface", DependencyManager::get().data());
if (setAdditionalContextProperties) {
auto tabletScriptingInterface = DependencyManager::get();
@@ -3386,10 +3400,8 @@ void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditiona
surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
surfaceContext->setContextProperty("RefreshRate", new RefreshRateScriptingInterface());
- surfaceContext->setContextProperty("Account",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
- surfaceContext->setContextProperty("GlobalServices",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ surfaceContext->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
surfaceContext->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance());
// in Qt 5.10.0 there is already an "Audio" object in the QML context
@@ -3409,16 +3421,14 @@ void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditiona
surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get().data());
surfaceContext->setContextProperty("SoundCache", DependencyManager::get().data());
surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get().data());
- surfaceContext->setContextProperty("Render",
- AbstractViewStateInterface::instance()->getRenderEngine()->getConfiguration().get());
+ surfaceContext->setContextProperty("Render", AbstractViewStateInterface::instance()->getRenderEngine()->getConfiguration().get());
surfaceContext->setContextProperty("Workload", qApp->getGameWorkload()._engine->getConfiguration().get());
surfaceContext->setContextProperty("Controller", DependencyManager::get().data());
surfaceContext->setContextProperty("Pointers", DependencyManager::get().data());
surfaceContext->setContextProperty("Window", DependencyManager::get().data());
surfaceContext->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface());
surfaceContext->setContextProperty("HiFiAbout", AboutUtil::getInstance());
- surfaceContext->setContextProperty("WalletScriptingInterface",
- DependencyManager::get().data());
+ surfaceContext->setContextProperty("WalletScriptingInterface", DependencyManager::get().data());
surfaceContext->setContextProperty("ResourceRequestObserver", DependencyManager::get().data());
}
}
@@ -3438,17 +3448,20 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
// Using the latter will cause the camera to wobble with idle animations,
// or with changes from the face tracker
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
- _thirdPersonHMDCameraBoomValid = false;
+ _thirdPersonHMDCameraBoomValid= false;
if (isHMDMode()) {
mat4 camMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
_myCamera.setPosition(extractTranslation(camMat));
_myCamera.setOrientation(glmExtractRotation(camMat));
- } else {
+ }
+ else {
_myCamera.setPosition(myAvatar->getDefaultEyePosition());
_myCamera.setOrientation(myAvatar->getMyHead()->getHeadOrientation());
}
- } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
+ }
+ else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
if (isHMDMode()) {
+
if (!_thirdPersonHMDCameraBoomValid) {
const glm::vec3 CAMERA_OFFSET = glm::vec3(0.0f, 0.0f, 0.7f);
_thirdPersonHMDCameraBoom = cancelOutRollAndPitch(myAvatar->getHMDSensorOrientation()) * CAMERA_OFFSET;
@@ -3457,29 +3470,32 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
glm::mat4 thirdPersonCameraSensorToWorldMatrix = myAvatar->getSensorToWorldMatrix();
- const glm::vec3 cameraPos =
- myAvatar->getHMDSensorPosition() + _thirdPersonHMDCameraBoom * myAvatar->getBoomLength();
+ const glm::vec3 cameraPos = myAvatar->getHMDSensorPosition() + _thirdPersonHMDCameraBoom * myAvatar->getBoomLength();
glm::mat4 sensorCameraMat = createMatFromQuatAndPos(myAvatar->getHMDSensorOrientation(), cameraPos);
glm::mat4 worldCameraMat = thirdPersonCameraSensorToWorldMatrix * sensorCameraMat;
_myCamera.setOrientation(glm::normalize(glmExtractRotation(worldCameraMat)));
_myCamera.setPosition(extractTranslation(worldCameraMat));
- } else {
+ }
+ else {
_thirdPersonHMDCameraBoomValid = false;
_myCamera.setOrientation(myAvatar->getHead()->getOrientation());
if (isOptionChecked(MenuOption::CenterPlayerInView)) {
- _myCamera.setPosition(myAvatar->getDefaultEyePosition() + _myCamera.getOrientation() * boomOffset);
- } else {
- _myCamera.setPosition(myAvatar->getDefaultEyePosition() + myAvatar->getWorldOrientation() * boomOffset);
+ _myCamera.setPosition(myAvatar->getDefaultEyePosition()
+ + _myCamera.getOrientation() * boomOffset);
+ }
+ else {
+ _myCamera.setPosition(myAvatar->getDefaultEyePosition()
+ + myAvatar->getWorldOrientation() * boomOffset);
}
}
- } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
- _thirdPersonHMDCameraBoomValid = false;
+ }
+ else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
+ _thirdPersonHMDCameraBoomValid= false;
if (isHMDMode()) {
- auto mirrorBodyOrientation =
- myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _mirrorYawOffset, 0.0f));
+ auto mirrorBodyOrientation = myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _mirrorYawOffset, 0.0f));
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
// Mirror HMD yaw and roll
@@ -3496,24 +3512,26 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
// Mirror HMD lateral offsets
hmdOffset.x = -hmdOffset.x;
- _myCamera.setPosition(
- myAvatar->getDefaultEyePosition() + glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0) +
- mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror +
- mirrorBodyOrientation * hmdOffset);
- } else {
+ _myCamera.setPosition(myAvatar->getDefaultEyePosition()
+ + glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
+ + mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror
+ + mirrorBodyOrientation * hmdOffset);
+ }
+ else {
auto userInputMapper = DependencyManager::get();
const float YAW_SPEED = TWO_PI / 5.0f;
float deltaYaw = userInputMapper->getActionState(controller::Action::YAW) * YAW_SPEED * deltaTime;
_mirrorYawOffset += deltaYaw;
_myCamera.setOrientation(myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _mirrorYawOffset, 0.0f)));
- _myCamera.setPosition(myAvatar->getDefaultEyePosition() +
- glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0) +
- (myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, _mirrorYawOffset, 0.0f))) *
- glm::vec3(0.0f, 0.0f, -1.0f) * myAvatar->getBoomLength() * _scaleMirror);
+ _myCamera.setPosition(myAvatar->getDefaultEyePosition()
+ + glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
+ + (myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, _mirrorYawOffset, 0.0f))) *
+ glm::vec3(0.0f, 0.0f, -1.0f) * myAvatar->getBoomLength() * _scaleMirror);
}
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
- } else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) {
- _thirdPersonHMDCameraBoomValid = false;
+ }
+ else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) {
+ _thirdPersonHMDCameraBoomValid= false;
EntityItemPointer cameraEntity = _myCamera.getCameraEntityPointer();
if (cameraEntity != nullptr) {
if (isHMDMode()) {
@@ -3521,7 +3539,8 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
_myCamera.setOrientation(cameraEntity->getWorldOrientation() * hmdRotation);
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
_myCamera.setPosition(cameraEntity->getWorldPosition() + (hmdRotation * hmdOffset));
- } else {
+ }
+ else {
_myCamera.setOrientation(cameraEntity->getWorldOrientation());
_myCamera.setPosition(cameraEntity->getWorldPosition());
}
@@ -3541,6 +3560,7 @@ void Application::runTests() {
}
void Application::faceTrackerMuteToggled() {
+
QAction* muteAction = Menu::getInstance()->getActionForOption(MenuOption::MuteFaceTracking);
Q_CHECK_PTR(muteAction);
bool isMuted = getSelectedFaceTracker()->isMuted();
@@ -3587,8 +3607,9 @@ void Application::setPreferredCursor(const QString& cursorName) {
if (_displayPlugin && _displayPlugin->isHmd()) {
_preferredCursor.set(cursorName.isEmpty() ? DEFAULT_CURSOR_NAME : cursorName);
- } else {
- _preferredCursor.set(cursorName.isEmpty() ? Cursor::Manager::getIconName(Cursor::Icon::SYSTEM) : cursorName);
+ }
+ else {
+ _preferredCursor.set(cursorName.isEmpty() ? Cursor::Manager::getIconName(Cursor::Icon::SYSTEM) : cursorName);
}
showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get()));
@@ -3644,8 +3665,7 @@ void Application::showHelp() {
QUrlQuery queryString;
queryString.addQueryItem("handControllerName", handControllerName);
queryString.addQueryItem("defaultTab", defaultTab);
- TabletProxy* tablet =
- dynamic_cast(DependencyManager::get()->getTablet(SYSTEM_TABLET));
+ TabletProxy* tablet = dynamic_cast(DependencyManager::get()->getTablet(SYSTEM_TABLET));
tablet->gotoWebScreen(PathUtils::resourcesUrl() + INFO_HELP_PATH + "?" + queryString.toString());
DependencyManager::get()->openTablet();
//InfoView::show(INFO_HELP_PATH, false, queryString.toString());
@@ -3685,8 +3705,8 @@ void Application::resizeGL() {
// FIXME the aspect ratio for stereo displays is incorrect based on this.
float aspectRatio = displayPlugin->getRecommendedAspectRatio();
- _myCamera.setProjection(
- glm::perspective(glm::radians(_fieldOfView.get()), aspectRatio, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
+ _myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()), aspectRatio,
+ DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
// Possible change in aspect ratio
{
QMutexLocker viewLocker(&_viewMutex);
@@ -3703,12 +3723,14 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll());
- enum HandControllerType
- {
+ enum HandControllerType {
Vive,
Oculus
};
- static const std::map MIN_CONTENT_VERSION = { { Vive, 1 }, { Oculus, 27 } };
+ static const std::map MIN_CONTENT_VERSION = {
+ { Vive, 1 },
+ { Oculus, 27 }
+ };
// Get sandbox content set version
auto acDirPath = PathUtils::getAppDataPath() + "../../" + BuildInfo::MODIFIED_ORGANIZATION + "/assignment-client/";
@@ -3718,7 +3740,7 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
QFile contentVersionFile(contentVersionPath);
if (contentVersionFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString line = contentVersionFile.readAll();
- contentVersion = line.toInt(); // returns 0 if conversion fails
+ contentVersion = line.toInt(); // returns 0 if conversion fails
}
// Get controller availability
@@ -3736,8 +3758,7 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
bool isUsingHMD = _displayPlugin->isHmd();
bool isUsingHMDAndHandControllers = hasHMD && hasHandControllers && isUsingHMD;
- qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers
- << ", Using HMD: " << isUsingHMDAndHandControllers;
+ qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers << ", Using HMD: " << isUsingHMDAndHandControllers;
// when --url in command line, teleport to location
const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
@@ -3759,8 +3780,8 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
// If this is a first run we short-circuit the address passed in
if (_firstRun.get()) {
- DependencyManager::get()->goToEntry();
- sentTo = SENT_TO_ENTRY;
+ DependencyManager::get()->goToEntry();
+ sentTo = SENT_TO_ENTRY;
_firstRun.set(false);
} else {
@@ -3779,21 +3800,22 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
sentTo = SENT_TO_PREVIOUS_LOCATION;
}
- UserActivityLogger::getInstance().logAction("startup_sent_to",
- { { "sent_to", sentTo },
- { "sandbox_is_running", sandboxIsRunning },
- { "has_hmd", hasHMD },
- { "has_hand_controllers", hasHandControllers },
- { "is_using_hmd", isUsingHMD },
- { "is_using_hmd_and_hand_controllers", isUsingHMDAndHandControllers },
- { "content_version", contentVersion } });
+ UserActivityLogger::getInstance().logAction("startup_sent_to", {
+ { "sent_to", sentTo },
+ { "sandbox_is_running", sandboxIsRunning },
+ { "has_hmd", hasHMD },
+ { "has_hand_controllers", hasHandControllers },
+ { "is_using_hmd", isUsingHMD },
+ { "is_using_hmd_and_hand_controllers", isUsingHMDAndHandControllers },
+ { "content_version", contentVersion }
+ });
_connectionMonitor.init();
}
bool Application::importJSONFromURL(const QString& urlString) {
// we only load files that terminate in just .json (not .svo.json and not .ava.json)
- QUrl jsonURL{ urlString };
+ QUrl jsonURL { urlString };
emit svoImportRequested(urlString);
return true;
@@ -3939,18 +3961,19 @@ bool Application::handleKeyEventForFocusedEntity(QEvent* event) {
if (_keyboardFocusedEntity.get() != UNKNOWN_ENTITY_ID) {
switch (event->type()) {
case QEvent::KeyPress:
- case QEvent::KeyRelease: {
- auto eventHandler = getEntities()->getEventHandler(_keyboardFocusedEntity.get());
- if (eventHandler) {
- event->setAccepted(false);
- QCoreApplication::sendEvent(eventHandler, event);
- if (event->isAccepted()) {
- _lastAcceptedKeyPress = usecTimestampNow();
- return true;
+ case QEvent::KeyRelease:
+ {
+ auto eventHandler = getEntities()->getEventHandler(_keyboardFocusedEntity.get());
+ if (eventHandler) {
+ event->setAccepted(false);
+ QCoreApplication::sendEvent(eventHandler, event);
+ if (event->isAccepted()) {
+ _lastAcceptedKeyPress = usecTimestampNow();
+ return true;
+ }
}
+ break;
}
- break;
- }
default:
break;
}
@@ -3986,18 +4009,19 @@ static void dumpEventQueue(QThread* thread) {
qDebug() << " " << type;
}
}
-#endif // DEBUG_EVENT_QUEUE
+#endif // DEBUG_EVENT_QUEUE
-bool Application::notify(QObject* object, QEvent* event) {
+bool Application::notify(QObject * object, QEvent * event) {
if (thread() == QThread::currentThread()) {
PROFILE_RANGE_IF_LONGER(app, "notify", 2)
return QApplication::notify(object, event);
- }
-
+ }
+
return QApplication::notify(object, event);
}
bool Application::event(QEvent* event) {
+
if (_aboutToQuit) {
return false;
}
@@ -4029,7 +4053,7 @@ bool Application::event(QEvent* event) {
dumpEventQueue(QThread::currentThread());
}
}
-#endif // DEBUG_EVENT_QUEUE
+#endif // DEBUG_EVENT_QUEUE
_pendingIdleEvent.store(false);
@@ -4053,9 +4077,6 @@ bool Application::event(QEvent* event) {
case QEvent::KeyRelease:
keyReleaseEvent(static_cast(event));
return true;
- case QEvent::FocusIn:
- focusInEvent(static_cast(event));
- return true;
case QEvent::FocusOut:
focusOutEvent(static_cast(event));
return true;
@@ -4093,10 +4114,16 @@ bool Application::event(QEvent* event) {
}
bool Application::eventFilter(QObject* object, QEvent* event) {
+
if (_aboutToQuit && event->type() != QEvent::DeferredDelete && event->type() != QEvent::Destroy) {
return true;
}
+ auto eventType = event->type();
+ if (eventType == QEvent::KeyPress || eventType == QEvent::KeyRelease || eventType == QEvent::MouseMove) {
+ getRefreshRateManager().resetInactiveTimer();
+ }
+
if (event->type() == QEvent::Leave) {
getApplicationCompositor().handleLeaveEvent();
}
@@ -4134,7 +4161,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
_keysPressed.insert(event->key(), *event);
}
- _controllerScriptingInterface->emitKeyPressEvent(event); // send events to any registered scripts
+ _controllerScriptingInterface->emitKeyPressEvent(event); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isKeyCaptured(event) || isInterstitialMode()) {
return;
@@ -4224,10 +4251,9 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_G:
if (isShifted && isMeta && Menu::getInstance() && Menu::getInstance()->getMenu("Developer")->isVisible()) {
static const QString HIFI_FRAMES_FOLDER_VAR = "HIFI_FRAMES_FOLDER";
- static const QString GPU_FRAME_FOLDER =
- QProcessEnvironment::systemEnvironment().contains(HIFI_FRAMES_FOLDER_VAR)
- ? QProcessEnvironment::systemEnvironment().value(HIFI_FRAMES_FOLDER_VAR)
- : "hifiFrames";
+ static const QString GPU_FRAME_FOLDER = QProcessEnvironment::systemEnvironment().contains(HIFI_FRAMES_FOLDER_VAR)
+ ? QProcessEnvironment::systemEnvironment().value(HIFI_FRAMES_FOLDER_VAR)
+ : "hifiFrames";
static QString GPU_FRAME_TEMPLATE = GPU_FRAME_FOLDER + "/{DATE}_{TIME}";
QString fullPath = FileUtils::computeDocumentPath(FileUtils::replaceDateTimeTokens(GPU_FRAME_TEMPLATE));
if (FileUtils::canCreateFile(fullPath)) {
@@ -4287,6 +4313,10 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (isMeta) {
auto audioClient = DependencyManager::get();
audioClient->setMuted(!audioClient->isMuted());
+ QSharedPointer audioScriptingInterface = qSharedPointerDynamicCast(DependencyManager::get());
+ if (audioScriptingInterface && audioScriptingInterface->getPTT()) {
+ audioScriptingInterface->setPushingToTalk(!audioClient->isMuted());
+ }
}
break;
@@ -4306,18 +4336,16 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (!isShifted && !isMeta && !isOption && !event->isAutoRepeat()) {
AudioInjectorOptions options;
options.localOnly = true;
- options.positionSet = false; // system sound
+ options.positionSet = false; // system sound
options.stereo = true;
Setting::Handle notificationSounds{ MenuOption::NotificationSounds, true };
Setting::Handle notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true };
if (notificationSounds.get() && notificationSoundSnapshot.get()) {
if (_snapshotSoundInjector) {
- DependencyManager::get()->setOptionsAndRestart(_snapshotSoundInjector,
- options);
+ DependencyManager::get()->setOptionsAndRestart(_snapshotSoundInjector, options);
} else {
- _snapshotSoundInjector =
- DependencyManager::get()->playSound(_snapshotSound, options);
+ _snapshotSoundInjector = DependencyManager::get()->playSound(_snapshotSound, options);
}
}
takeSnapshot(true);
@@ -4338,7 +4366,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
} else {
showCursor(Cursor::Icon::DEFAULT);
}
- } else if (!event->isAutoRepeat()) {
+ } else if (!event->isAutoRepeat()){
resetSensors(true);
}
break;
@@ -4398,7 +4426,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
AndroidHelper::instance().requestActivity("Home", false);
}
#endif
- _controllerScriptingInterface->emitKeyReleaseEvent(event); // send events to any registered scripts
+ _controllerScriptingInterface->emitKeyReleaseEvent(event); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isKeyCaptured(event)) {
@@ -4408,25 +4436,16 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
if (_keyboardMouseDevice->isActive()) {
_keyboardMouseDevice->keyReleaseEvent(event);
}
-}
-void Application::focusInEvent(QFocusEvent* event) {
- if (!_aboutToQuit && _startUpFinished) {
- getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::RUNNING);
- }
}
void Application::focusOutEvent(QFocusEvent* event) {
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
- foreach (auto inputPlugin, inputPlugins) {
+ foreach(auto inputPlugin, inputPlugins) {
if (inputPlugin->isActive()) {
inputPlugin->pluginFocusOutEvent();
}
}
-
- if (!_aboutToQuit && _startUpFinished) {
- getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::UNFOCUS);
- }
// FIXME spacemouse code still needs cleanup
#if 0
//SpacemouseDevice::getInstance().focusOutEvent();
@@ -4444,7 +4463,7 @@ void Application::synthesizeKeyReleasEvents() {
QHash keysPressed;
std::swap(keysPressed, _keysPressed);
for (auto& ev : keysPressed) {
- QKeyEvent synthesizedEvent{ QKeyEvent::KeyRelease, ev.key(), Qt::NoModifier, ev.text() };
+ QKeyEvent synthesizedEvent { QKeyEvent::KeyRelease, ev.key(), Qt::NoModifier, ev.text() };
keyReleaseEvent(&synthesizedEvent);
}
}
@@ -4461,7 +4480,7 @@ void Application::maybeToggleMenuVisible(QMouseEvent* event) const {
if (event->pos().y() <= MENU_TOGGLE_AREA) {
menuBar->setVisible(true);
}
- } else {
+ } else {
if (event->pos().y() > MENU_TOGGLE_AREA) {
menuBar->setVisible(false);
}
@@ -4481,7 +4500,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
// compositor reticle
// handleRealMouseMoveEvent() will return true, if we shouldn't process the event further
if (!compositor.fakeEventActive() && compositor.handleRealMouseMoveEvent()) {
- return; // bail
+ return; // bail
}
#if !defined(DISABLE_QML)
@@ -4501,14 +4520,17 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
buttons |= Qt::LeftButton;
}
- QMouseEvent mappedEvent(event->type(), transformedPos, event->screenPos(), button, buttons, event->modifiers());
+ QMouseEvent mappedEvent(event->type(),
+ transformedPos,
+ event->screenPos(), button,
+ buttons, event->modifiers());
if (compositor.getReticleVisible() || !isHMDMode() || !compositor.getReticleOverDesktop() ||
getOverlays().getOverlayAtPoint(glm::vec2(transformedPos.x(), transformedPos.y())) != UNKNOWN_ENTITY_ID) {
getEntities()->mouseMoveEvent(&mappedEvent);
}
- _controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts
+ _controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isMouseCaptured()) {
@@ -4538,12 +4560,11 @@ void Application::mousePressEvent(QMouseEvent* event) {
QPointF transformedPos;
#endif
- QMouseEvent mappedEvent(event->type(), transformedPos, event->screenPos(), event->button(), event->buttons(),
- event->modifiers());
+ QMouseEvent mappedEvent(event->type(), transformedPos, event->screenPos(), event->button(), event->buttons(), event->modifiers());
QUuid result = getEntities()->mousePressEvent(&mappedEvent);
setKeyboardFocusEntity(getEntities()->wantsKeyboardFocus(result) ? result : UNKNOWN_ENTITY_ID);
- _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts
+ _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isMouseCaptured()) {
@@ -4576,8 +4597,10 @@ void Application::mouseDoublePressEvent(QMouseEvent* event) {
#else
QPointF transformedPos;
#endif
- QMouseEvent mappedEvent(event->type(), transformedPos, event->screenPos(), event->button(), event->buttons(),
- event->modifiers());
+ QMouseEvent mappedEvent(event->type(),
+ transformedPos,
+ event->screenPos(), event->button(),
+ event->buttons(), event->modifiers());
getEntities()->mouseDoublePressEvent(&mappedEvent);
// if one of our scripts have asked to capture this event, then stop processing it
@@ -4589,6 +4612,7 @@ void Application::mouseDoublePressEvent(QMouseEvent* event) {
}
void Application::mouseReleaseEvent(QMouseEvent* event) {
+
#if !defined(DISABLE_QML)
auto offscreenUi = getOffscreenUI();
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
@@ -4596,12 +4620,14 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
#else
QPointF transformedPos;
#endif
- QMouseEvent mappedEvent(event->type(), transformedPos, event->screenPos(), event->button(), event->buttons(),
- event->modifiers());
+ QMouseEvent mappedEvent(event->type(),
+ transformedPos,
+ event->screenPos(), event->button(),
+ event->buttons(), event->modifiers());
getEntities()->mouseReleaseEvent(&mappedEvent);
- _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts
+ _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isMouseCaptured()) {
@@ -4620,7 +4646,7 @@ void Application::touchUpdateEvent(QTouchEvent* event) {
if (event->type() == QEvent::TouchUpdate) {
TouchEvent thisEvent(*event, _lastTouchEvent);
- _controllerScriptingInterface->emitTouchUpdateEvent(thisEvent); // send events to any registered scripts
+ _controllerScriptingInterface->emitTouchUpdateEvent(thisEvent); // send events to any registered scripts
_lastTouchEvent = thisEvent;
}
@@ -4642,10 +4668,10 @@ void Application::touchUpdateEvent(QTouchEvent* event) {
void Application::touchBeginEvent(QTouchEvent* event) {
_altPressed = false;
- TouchEvent thisEvent(*event); // on touch begin, we don't compare to last event
- _controllerScriptingInterface->emitTouchBeginEvent(thisEvent); // send events to any registered scripts
+ TouchEvent thisEvent(*event); // on touch begin, we don't compare to last event
+ _controllerScriptingInterface->emitTouchBeginEvent(thisEvent); // send events to any registered scripts
- _lastTouchEvent = thisEvent; // and we reset our last event to this event before we call our update
+ _lastTouchEvent = thisEvent; // and we reset our last event to this event before we call our update
touchUpdateEvent(event);
// if one of our scripts have asked to capture this event, then stop processing it
@@ -4662,12 +4688,13 @@ void Application::touchBeginEvent(QTouchEvent* event) {
if (_touchscreenVirtualPadDevice && _touchscreenVirtualPadDevice->isActive()) {
_touchscreenVirtualPadDevice->touchBeginEvent(event);
}
+
}
void Application::touchEndEvent(QTouchEvent* event) {
_altPressed = false;
TouchEvent thisEvent(*event, _lastTouchEvent);
- _controllerScriptingInterface->emitTouchEndEvent(thisEvent); // send events to any registered scripts
+ _controllerScriptingInterface->emitTouchEndEvent(thisEvent); // send events to any registered scripts
_lastTouchEvent = thisEvent;
// if one of our scripts have asked to capture this event, then stop processing it
@@ -4698,7 +4725,7 @@ void Application::touchGestureEvent(QGestureEvent* event) {
void Application::wheelEvent(QWheelEvent* event) const {
_altPressed = false;
- _controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts
+ _controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isWheelCaptured() || getLoginDialogPoppedUp()) {
@@ -4710,7 +4737,7 @@ void Application::wheelEvent(QWheelEvent* event) const {
}
}
-void Application::dropEvent(QDropEvent* event) {
+void Application::dropEvent(QDropEvent *event) {
const QMimeData* mimeData = event->mimeData();
for (auto& url : mimeData->urls()) {
QString urlString = url.toString();
@@ -4736,8 +4763,8 @@ bool Application::acceptSnapshot(const QString& urlString) {
DependencyManager::get()->handleLookupString(snapshotData->getURL().toString());
}
} else {
- OffscreenUi::asyncWarning("", "No location details were found in the file\n" + snapshotPath +
- "\nTry dragging in an authentic Hifi snapshot.");
+ OffscreenUi::asyncWarning("", "No location details were found in the file\n" +
+ snapshotPath + "\nTry dragging in an authentic Hifi snapshot.");
}
return true;
}
@@ -4750,39 +4777,41 @@ bool Application::acceptSnapshot(const QString& urlString) {
#pragma comment(lib, "ntdll.lib")
extern "C" {
-enum SYSTEM_INFORMATION_CLASS
-{
- SystemBasicInformation = 0,
- SystemProcessorPerformanceInformation = 8,
-};
+ enum SYSTEM_INFORMATION_CLASS {
+ SystemBasicInformation = 0,
+ SystemProcessorPerformanceInformation = 8,
+ };
-struct SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
- LARGE_INTEGER IdleTime;
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER DpcTime;
- LARGE_INTEGER InterruptTime;
- ULONG InterruptCount;
-};
+ struct SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
+ LARGE_INTEGER IdleTime;
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER DpcTime;
+ LARGE_INTEGER InterruptTime;
+ ULONG InterruptCount;
+ };
-struct SYSTEM_BASIC_INFORMATION {
- ULONG Reserved;
- ULONG TimerResolution;
- ULONG PageSize;
- ULONG NumberOfPhysicalPages;
- ULONG LowestPhysicalPageNumber;
- ULONG HighestPhysicalPageNumber;
- ULONG AllocationGranularity;
- ULONG_PTR MinimumUserModeAddress;
- ULONG_PTR MaximumUserModeAddress;
- ULONG_PTR ActiveProcessorsAffinityMask;
- CCHAR NumberOfProcessors;
-};
+ struct SYSTEM_BASIC_INFORMATION {
+ ULONG Reserved;
+ ULONG TimerResolution;
+ ULONG PageSize;
+ ULONG NumberOfPhysicalPages;
+ ULONG LowestPhysicalPageNumber;
+ ULONG HighestPhysicalPageNumber;
+ ULONG AllocationGranularity;
+ ULONG_PTR MinimumUserModeAddress;
+ ULONG_PTR MaximumUserModeAddress;
+ ULONG_PTR ActiveProcessorsAffinityMask;
+ CCHAR NumberOfProcessors;
+ };
+
+ NTSYSCALLAPI NTSTATUS NTAPI NtQuerySystemInformation(
+ _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ _Out_writes_bytes_opt_(SystemInformationLength) PVOID SystemInformation,
+ _In_ ULONG SystemInformationLength,
+ _Out_opt_ PULONG ReturnLength
+ );
-NTSYSCALLAPI NTSTATUS NTAPI NtQuerySystemInformation(_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
- _Out_writes_bytes_opt_(SystemInformationLength) PVOID SystemInformation,
- _In_ ULONG SystemInformationLength,
- _Out_opt_ PULONG ReturnLength);
}
template
NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, T& t) {
@@ -4794,6 +4823,7 @@ NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClas
return NtQuerySystemInformation(SystemInformationClass, t.data(), (ULONG)(sizeof(T) * t.size()), nullptr);
}
+
template
void updateValueAndDelta(std::pair& pair, T newValue) {
auto& value = pair.first;
@@ -4805,11 +4835,11 @@ void updateValueAndDelta(std::pair& pair, T newValue) {
struct MyCpuInfo {
using ValueAndDelta = std::pair;
std::string name;
- ValueAndDelta kernel{ 0, 0 };
- ValueAndDelta user{ 0, 0 };
- ValueAndDelta idle{ 0, 0 };
- float kernelUsage{ 0.0f };
- float userUsage{ 0.0f };
+ ValueAndDelta kernel { 0, 0 };
+ ValueAndDelta user { 0, 0 };
+ ValueAndDelta idle { 0, 0 };
+ float kernelUsage { 0.0f };
+ float userUsage { 0.0f };
void update(const SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION& cpuInfo) {
updateValueAndDelta(kernel, cpuInfo.KernelTime.QuadPart);
@@ -4827,13 +4857,13 @@ struct MyCpuInfo {
void updateCpuInformation() {
static std::once_flag once;
- static SYSTEM_BASIC_INFORMATION systemInfo{};
+ static SYSTEM_BASIC_INFORMATION systemInfo {};
static SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION cpuTotals;
static std::vector cpuInfos;
static std::vector myCpuInfos;
static MyCpuInfo myCpuTotals;
std::call_once(once, [&] {
- NtQuerySystemInformation(SystemBasicInformation, systemInfo);
+ NtQuerySystemInformation( SystemBasicInformation, systemInfo);
cpuInfos.resize(systemInfo.NumberOfProcessors);
myCpuInfos.resize(systemInfo.NumberOfProcessors);
for (size_t i = 0; i < systemInfo.NumberOfProcessors; ++i) {
@@ -4858,14 +4888,20 @@ void updateCpuInformation() {
// Update friendly structure
auto& myCpuInfo = myCpuInfos[i];
myCpuInfo.update(cpuInfo);
- PROFILE_COUNTER(app, myCpuInfo.name.c_str(), { { "kernel", myCpuInfo.kernelUsage }, { "user", myCpuInfo.userUsage } });
+ PROFILE_COUNTER(app, myCpuInfo.name.c_str(), {
+ { "kernel", myCpuInfo.kernelUsage },
+ { "user", myCpuInfo.userUsage }
+ });
}
myCpuTotals.update(cpuTotals);
- PROFILE_COUNTER(app, myCpuTotals.name.c_str(),
- { { "kernel", myCpuTotals.kernelUsage }, { "user", myCpuTotals.userUsage } });
+ PROFILE_COUNTER(app, myCpuTotals.name.c_str(), {
+ { "kernel", myCpuTotals.kernelUsage },
+ { "user", myCpuTotals.userUsage }
+ });
}
+
static ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU;
static int numProcessors;
static HANDLE self;
@@ -4989,10 +5025,8 @@ void Application::idle() {
PROFILE_COUNTER_IF_CHANGED(app, "renderLoopRate", float, getRenderLoopRate());
PROFILE_COUNTER_IF_CHANGED(app, "currentDownloads", uint32_t, ResourceCache::getLoadingRequests().length());
PROFILE_COUNTER_IF_CHANGED(app, "pendingDownloads", uint32_t, ResourceCache::getPendingRequestCount());
- PROFILE_COUNTER_IF_CHANGED(app, "currentProcessing", int,
- DependencyManager::get()->getStat("Processing").toInt());
- PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int,
- DependencyManager::get()->getStat("PendingProcessing").toInt());
+ PROFILE_COUNTER_IF_CHANGED(app, "currentProcessing", int, DependencyManager::get()->getStat("Processing").toInt());
+ PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get()->getStat("PendingProcessing").toInt());
auto renderConfig = _graphicsEngine.getRenderEngine()->getConfiguration();
PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_graphicsEngine.getGPUContext()->getFrameTimerGPUAverage());
@@ -5022,7 +5056,7 @@ void Application::idle() {
}
}
#endif
-
+
checkChangeCursor();
#if !defined(DISABLE_QML)
@@ -5057,9 +5091,9 @@ void Application::idle() {
update(glm::clamp(secondsSinceLastUpdate, 0.0f, BIGGEST_DELTA_TIME_SECS));
}
- { // Update keyboard focus highlight
+ { // Update keyboard focus highlight
if (!_keyboardFocusedEntity.get().isInvalidID()) {
- const quint64 LOSE_FOCUS_AFTER_ELAPSED_TIME = 30 * USECS_PER_SECOND; // if idle for 30 seconds, drop focus
+ const quint64 LOSE_FOCUS_AFTER_ELAPSED_TIME = 30 * USECS_PER_SECOND; // if idle for 30 seconds, drop focus
quint64 elapsedSinceAcceptedKeyPress = usecTimestampNow() - _lastAcceptedKeyPress;
if (elapsedSinceAcceptedKeyPress > LOSE_FOCUS_AFTER_ELAPSED_TIME) {
setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
@@ -5089,7 +5123,7 @@ void Application::idle() {
PerformanceWarning warn(showWarnings, "Application::idle()... pluginIdle()");
getActiveDisplayPlugin()->idle();
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
- foreach (auto inputPlugin, inputPlugins) {
+ foreach(auto inputPlugin, inputPlugins) {
if (inputPlugin->isActive()) {
inputPlugin->idle();
}
@@ -5177,7 +5211,9 @@ void Application::calibrateEyeTracker5Points() {
}
#endif
-bool Application::exportEntities(const QString& filename, const QVector& entityIDs, const glm::vec3* givenOffset) {
+bool Application::exportEntities(const QString& filename,
+ const QVector& entityIDs,
+ const glm::vec3* givenOffset) {
QHash entities;
auto nodeList = DependencyManager::get();
@@ -5190,7 +5226,7 @@ bool Application::exportEntities(const QString& filename, const QVector&
glm::vec3 root(TREE_SCALE, TREE_SCALE, TREE_SCALE);
bool success = true;
entityTree->withReadLock([entityIDs, entityTree, givenOffset, myAvatarID, &root, &entities, &success, &exportTree] {
- for (auto entityID : entityIDs) { // Gather entities and properties.
+ for (auto entityID : entityIDs) { // Gather entities and properties.
auto entityItem = entityTree->findEntityByEntityItemID(entityID);
if (!entityItem) {
qCWarning(interfaceapp) << "Skipping export of" << entityID << "that is not in scene.";
@@ -5200,7 +5236,8 @@ bool Application::exportEntities(const QString& filename, const QVector&
if (!givenOffset) {
EntityItemID parentID = entityItem->getParentID();
bool parentIsAvatar = (parentID == AVATAR_SELF_ID || parentID == myAvatarID);
- if (!parentIsAvatar && (parentID.isInvalidID() || !entityIDs.contains(parentID) ||
+ if (!parentIsAvatar && (parentID.isInvalidID() ||
+ !entityIDs.contains(parentID) ||
!entityTree->findEntityByEntityItemID(parentID))) {
// If parent wasn't selected, we want absolute position, which isn't in properties.
auto position = entityItem->getWorldPosition();
@@ -5231,7 +5268,7 @@ bool Application::exportEntities(const QString& filename, const QVector&
properties.setPosition(properties.getPosition() - root);
} else if (!entities.contains(parentID)) {
entityDatum->globalizeProperties(properties, "Parent %3 of %2 %1 is not selected for export.", -root);
- } // else valid parent -- don't offset
+ } // else valid parent -- don't offset
}
exportTree->addEntity(entityDatum->getEntityItemID(), properties);
}
@@ -5252,12 +5289,15 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa
AACube boundingCube(minCorner, cubeSize);
QVector entities;
auto entityTree = getEntities()->getTree();
- entityTree->withReadLock([&] { entityTree->evalEntitiesInCube(boundingCube, PickFilter(), entities); });
+ entityTree->withReadLock([&] {
+ entityTree->evalEntitiesInCube(boundingCube, PickFilter(), entities);
+ });
return exportEntities(filename, entities, ¢er);
}
void Application::loadSettings() {
- sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value.
+
+ sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value.
DependencyManager::get()->loadSettings();
DependencyManager::get()->loadSettings();
@@ -5327,9 +5367,10 @@ void Application::loadSettings() {
}
}
- auto audioScriptingInterface =
- reinterpret_cast(DependencyManager::get().data());
- audioScriptingInterface->loadData();
+ QSharedPointer audioScriptingInterface = qSharedPointerDynamicCast(DependencyManager::get());
+ if (audioScriptingInterface) {
+ audioScriptingInterface->loadData();
+ }
getMyAvatar()->loadData();
_settingsLoaded = true;
@@ -5340,9 +5381,10 @@ void Application::saveSettings() const {
DependencyManager::get()->saveSettings();
DependencyManager::get()->saveSettings();
- auto audioScriptingInterface =
- reinterpret_cast(DependencyManager::get().data());
- audioScriptingInterface->saveData();
+ QSharedPointer audioScriptingInterface = qSharedPointerDynamicCast(DependencyManager::get());
+ if (audioScriptingInterface) {
+ audioScriptingInterface->saveData();
+ }
Menu::getInstance()->saveSettings();
getMyAvatar()->saveData();
@@ -5386,6 +5428,7 @@ void Application::init() {
}
}
+
qCDebug(interfaceapp) << "Loaded settings";
// fire off an immediate domain-server check in now that settings are loaded
@@ -5420,27 +5463,23 @@ void Application::init() {
auto entityScriptingInterface = DependencyManager::get();
// connect the _entityCollisionSystem to our EntityTreeRenderer since that's what handles running entity scripts
- connect(_entitySimulation.get(), &PhysicalEntitySimulation::entityCollisionWithEntity, getEntities().data(),
- &EntityTreeRenderer::entityCollisionWithEntity);
+ connect(_entitySimulation.get(), &PhysicalEntitySimulation::entityCollisionWithEntity,
+ getEntities().data(), &EntityTreeRenderer::entityCollisionWithEntity);
// connect the _entities (EntityTreeRenderer) to our script engine's EntityScriptingInterface for firing
// of events related clicking, hovering over, and entering entities
getEntities()->connectSignalsToSlots(entityScriptingInterface.data());
// Make sure any new sounds are loaded as soon as know about them.
- connect(tree.get(), &EntityTree::newCollisionSoundURL, this,
- [this](QUrl newURL, EntityItemID id) {
- getEntities()->setCollisionSound(id, DependencyManager::get()->getSound(newURL));
- },
- Qt::QueuedConnection);
- connect(getMyAvatar().get(), &MyAvatar::newCollisionSoundURL, this,
- [this](QUrl newURL) {
- if (auto avatar = getMyAvatar()) {
- auto sound = DependencyManager::get()->getSound(newURL);
- avatar->setCollisionSound(sound);
- }
- },
- Qt::QueuedConnection);
+ connect(tree.get(), &EntityTree::newCollisionSoundURL, this, [this](QUrl newURL, EntityItemID id) {
+ getEntities()->setCollisionSound(id, DependencyManager::get()->getSound(newURL));
+ }, Qt::QueuedConnection);
+ connect(getMyAvatar().get(), &MyAvatar::newCollisionSoundURL, this, [this](QUrl newURL) {
+ if (auto avatar = getMyAvatar()) {
+ auto sound = DependencyManager::get()->getSound(newURL);
+ avatar->setCollisionSound(sound);
+ }
+ }, Qt::QueuedConnection);
_gameWorkload.startup(getEntities()->getWorkloadSpace(), _graphicsEngine.getRenderScene(), _entitySimulation);
_entitySimulation->setWorkloadSpace(getEntities()->getWorkloadSpace());
@@ -5511,8 +5550,7 @@ void Application::resumeAfterLoginDialogActionTaken() {
}
if (!isHMDMode() && getDesktopTabletBecomesToolbarSetting()) {
- auto toolbar =
- DependencyManager::get()->getToolbar("com.highfidelity.interface.toolbar.system");
+ auto toolbar = DependencyManager::get()->getToolbar("com.highfidelity.interface.toolbar.system");
toolbar->writeProperty("visible", true);
} else {
getApplicationCompositor().getReticleInterface()->setAllowMouseCapture(true);
@@ -5580,7 +5618,7 @@ void Application::resumeAfterLoginDialogActionTaken() {
_myCamera.setMode(_previousCameraMode);
cameraModeChanged();
_startUpFinished = true;
- getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::RUNNING);
+ getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::FOCUS_ACTIVE);
}
void Application::loadAvatarScripts(const QVector& urls) {
@@ -5658,8 +5696,8 @@ void Application::updateMyAvatarLookAtPosition() {
glm::quat hmdRotation = glm::quat_cast(headPose);
lookAtSpot = _myCamera.getPosition() + myAvatar->getWorldOrientation() * (hmdRotation * lookAtPosition);
} else {
- lookAtSpot = myAvatar->getHead()->getEyePosition() +
- (myAvatar->getHead()->getFinalOrientationInWorldFrame() * lookAtPosition);
+ lookAtSpot = myAvatar->getHead()->getEyePosition()
+ + (myAvatar->getHead()->getFinalOrientationInWorldFrame() * lookAtPosition);
}
} else {
AvatarSharedPointer lookingAt = myAvatar->getLookAtTargetAvatar().lock();
@@ -5673,14 +5711,14 @@ void Application::updateMyAvatarLookAtPosition() {
const float MAXIMUM_FACE_ANGLE = 65.0f * RADIANS_PER_DEGREE;
glm::vec3 lookingAtFaceOrientation = lookingAtHead->getFinalOrientationInWorldFrame() * IDENTITY_FORWARD;
- glm::vec3 fromLookingAtToMe =
- glm::normalize(myAvatar->getHead()->getEyePosition() - lookingAtHead->getEyePosition());
+ glm::vec3 fromLookingAtToMe = glm::normalize(myAvatar->getHead()->getEyePosition()
+ - lookingAtHead->getEyePosition());
float faceAngle = glm::angle(lookingAtFaceOrientation, fromLookingAtToMe);
if (faceAngle < MAXIMUM_FACE_ANGLE) {
// Randomly look back and forth between look targets
- eyeContactTarget target =
- Menu::getInstance()->isOptionChecked(MenuOption::FixGaze) ? LEFT_EYE : myAvatar->getEyeContactTarget();
+ eyeContactTarget target = Menu::getInstance()->isOptionChecked(MenuOption::FixGaze) ?
+ LEFT_EYE : myAvatar->getEyeContactTarget();
switch (target) {
case LEFT_EYE:
lookAtSpot = lookingAtHead->getLeftEyePosition();
@@ -5703,7 +5741,7 @@ void Application::updateMyAvatarLookAtPosition() {
lookAtSpot = transformPoint(headPose.getMatrix(), glm::vec3(0.0f, 0.0f, TREE_SCALE));
} else {
lookAtSpot = myAvatar->getHead()->getEyePosition() +
- (myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
+ (myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
}
}
@@ -5717,9 +5755,9 @@ void Application::updateMyAvatarLookAtPosition() {
if (isLookingAtSomeone) {
deflection *= GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT;
}
- lookAtSpot = origin + _myCamera.getOrientation() *
- glm::quat(glm::radians(glm::vec3(eyePitch * deflection, eyeYaw * deflection, 0.0f))) *
- glm::inverse(_myCamera.getOrientation()) * (lookAtSpot - origin);
+ lookAtSpot = origin + _myCamera.getOrientation() * glm::quat(glm::radians(glm::vec3(
+ eyePitch * deflection, eyeYaw * deflection, 0.0f))) *
+ glm::inverse(_myCamera.getOrientation()) * (lookAtSpot - origin);
}
}
@@ -5755,18 +5793,22 @@ void Application::centerUI() {
void Application::cycleCamera() {
auto menu = Menu::getInstance();
if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
+
menu->setIsOptionChecked(MenuOption::FullscreenMirror, false);
menu->setIsOptionChecked(MenuOption::FirstPerson, true);
} else if (menu->isOptionChecked(MenuOption::FirstPerson)) {
+
menu->setIsOptionChecked(MenuOption::FirstPerson, false);
menu->setIsOptionChecked(MenuOption::ThirdPerson, true);
} else if (menu->isOptionChecked(MenuOption::ThirdPerson)) {
+
menu->setIsOptionChecked(MenuOption::ThirdPerson, false);
menu->setIsOptionChecked(MenuOption::FullscreenMirror, true);
+
}
- cameraMenuChanged(); // handle the menu change
+ cameraMenuChanged(); // handle the menu change
}
void Application::cameraModeChanged() {
@@ -5808,7 +5850,7 @@ void Application::cameraMenuChanged() {
if (!isHMDMode() && _myCamera.getMode() != CAMERA_MODE_MIRROR) {
_mirrorYawOffset = 0.0f;
_myCamera.setMode(CAMERA_MODE_MIRROR);
- getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers
+ getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_DEFAULT);
}
} else if (menu->isOptionChecked(MenuOption::FirstPerson)) {
@@ -5837,6 +5879,7 @@ void Application::resetPhysicsReadyInformation() {
_octreeProcessor.startEntitySequence();
}
+
void Application::reloadResourceCaches() {
resetPhysicsReadyInformation();
@@ -5946,7 +5989,7 @@ void Application::setKeyboardFocusEntity(const QUuid& id) {
if (properties.getShowKeyboardFocusHighlight()) {
if (auto entity = entities->getEntity(entityId)) {
setKeyboardFocusHighlight(entity->getWorldPosition(), entity->getWorldOrientation(),
- entity->getScaledDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR);
+ entity->getScaledDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR);
return;
}
}
@@ -6010,8 +6053,8 @@ void Application::updateSecondaryCameraViewFrustum() {
glm::vec3 mainCameraPositionWorld = getCamera().getPosition();
glm::vec3 mainCameraPositionPortalEntrance = vec3(portalEntranceFromWorld * vec4(mainCameraPositionWorld, 1.0f));
- mainCameraPositionPortalEntrance =
- vec3(-mainCameraPositionPortalEntrance.x, mainCameraPositionPortalEntrance.y, -mainCameraPositionPortalEntrance.z);
+ mainCameraPositionPortalEntrance = vec3(-mainCameraPositionPortalEntrance.x, mainCameraPositionPortalEntrance.y,
+ -mainCameraPositionPortalEntrance.z);
glm::vec3 portalExitCameraPositionWorld = vec3(worldFromPortalExit * vec4(mainCameraPositionPortalEntrance, 1.0f));
secondaryViewFrustum.setPosition(portalExitCameraPositionWorld);
@@ -6022,8 +6065,7 @@ void Application::updateSecondaryCameraViewFrustum() {
// but the values are the same.
glm::vec3 upperRight = halfPortalExitPropertiesDimensions - mainCameraPositionPortalEntrance;
glm::vec3 bottomLeft = -halfPortalExitPropertiesDimensions - mainCameraPositionPortalEntrance;
- glm::mat4 frustum =
- glm::frustum(bottomLeft.x, upperRight.x, bottomLeft.y, upperRight.y, nearClip, camera->farClipPlaneDistance);
+ glm::mat4 frustum = glm::frustum(bottomLeft.x, upperRight.x, bottomLeft.y, upperRight.y, nearClip, camera->farClipPlaneDistance);
secondaryViewFrustum.setProjection(frustum);
} else if (camera->mirrorProjection && !camera->attachedEntityId.isNull()) {
auto entityScriptingInterface = DependencyManager::get();
@@ -6043,8 +6085,8 @@ void Application::updateSecondaryCameraViewFrustum() {
// get mirror camera position by reflecting main camera position's z coordinate in mirror space
glm::vec3 mainCameraPositionWorld = getCamera().getPosition();
glm::vec3 mainCameraPositionMirror = vec3(mirrorFromWorld * vec4(mainCameraPositionWorld, 1.0f));
- glm::vec3 mirrorCameraPositionMirror =
- vec3(mainCameraPositionMirror.x, mainCameraPositionMirror.y, -mainCameraPositionMirror.z);
+ glm::vec3 mirrorCameraPositionMirror = vec3(mainCameraPositionMirror.x, mainCameraPositionMirror.y,
+ -mainCameraPositionMirror.z);
glm::vec3 mirrorCameraPositionWorld = vec3(worldFromMirror * vec4(mirrorCameraPositionMirror, 1.0f));
// set frustum position to be mirrored camera and set orientation to mirror's adjusted rotation
@@ -6056,8 +6098,7 @@ void Application::updateSecondaryCameraViewFrustum() {
float nearClip = mirrorCameraPositionMirror.z + mirrorPropertiesDimensions.z * 2.0f;
glm::vec3 upperRight = halfMirrorPropertiesDimensions - mirrorCameraPositionMirror;
glm::vec3 bottomLeft = -halfMirrorPropertiesDimensions - mirrorCameraPositionMirror;
- glm::mat4 frustum =
- glm::frustum(bottomLeft.x, upperRight.x, bottomLeft.y, upperRight.y, nearClip, camera->farClipPlaneDistance);
+ glm::mat4 frustum = glm::frustum(bottomLeft.x, upperRight.x, bottomLeft.y, upperRight.y, nearClip, camera->farClipPlaneDistance);
secondaryViewFrustum.setProjection(frustum);
} else {
if (!camera->attachedEntityId.isNull()) {
@@ -6071,8 +6112,10 @@ void Application::updateSecondaryCameraViewFrustum() {
}
float aspectRatio = (float)camera->textureWidth / (float)camera->textureHeight;
- secondaryViewFrustum.setProjection(camera->vFoV, aspectRatio, camera->nearClipPlaneDistance,
- camera->farClipPlaneDistance);
+ secondaryViewFrustum.setProjection(camera->vFoV,
+ aspectRatio,
+ camera->nearClipPlaneDistance,
+ camera->farClipPlaneDistance);
}
// Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera,
// which is not what we want here.
@@ -6090,6 +6133,7 @@ void Application::update(float deltaTime) {
return;
}
+
if (!_physicsEnabled) {
if (!domainLoadingInProgress) {
PROFILE_ASYNC_BEGIN(app, "Scene Loading", "");
@@ -6144,8 +6188,8 @@ void Application::update(float deltaTime) {
Menu* menu = Menu::getInstance();
auto audioClient = DependencyManager::get();
if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !audioClient->isMuted()) {
- if (_lastFaceTrackerUpdate > 0 &&
- ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {
+ if (_lastFaceTrackerUpdate > 0
+ && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {
audioClient->setMuted(true);
_lastFaceTrackerUpdate = 0;
}
@@ -6166,21 +6210,22 @@ void Application::update(float deltaTime) {
hmdAvatarAlignmentType = controller::HmdAvatarAlignmentType::Head;
}
- controller::InputCalibrationData calibrationData =
- { myAvatar->getSensorToWorldMatrix(),
- createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition()),
- myAvatar->getHMDSensorMatrix(),
- myAvatar->getCenterEyeCalibrationMat(),
- myAvatar->getHeadCalibrationMat(),
- myAvatar->getSpine2CalibrationMat(),
- myAvatar->getHipsCalibrationMat(),
- myAvatar->getLeftFootCalibrationMat(),
- myAvatar->getRightFootCalibrationMat(),
- myAvatar->getRightArmCalibrationMat(),
- myAvatar->getLeftArmCalibrationMat(),
- myAvatar->getRightHandCalibrationMat(),
- myAvatar->getLeftHandCalibrationMat(),
- hmdAvatarAlignmentType };
+ controller::InputCalibrationData calibrationData = {
+ myAvatar->getSensorToWorldMatrix(),
+ createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition()),
+ myAvatar->getHMDSensorMatrix(),
+ myAvatar->getCenterEyeCalibrationMat(),
+ myAvatar->getHeadCalibrationMat(),
+ myAvatar->getSpine2CalibrationMat(),
+ myAvatar->getHipsCalibrationMat(),
+ myAvatar->getLeftFootCalibrationMat(),
+ myAvatar->getRightFootCalibrationMat(),
+ myAvatar->getRightArmCalibrationMat(),
+ myAvatar->getLeftArmCalibrationMat(),
+ myAvatar->getRightHandCalibrationMat(),
+ myAvatar->getLeftHandCalibrationMat(),
+ hmdAvatarAlignmentType
+ };
InputPluginPointer keyboardMousePlugin;
for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) {
@@ -6202,84 +6247,82 @@ void Application::update(float deltaTime) {
myAvatar->clearDriveKeys();
if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT && !isInterstitialMode()) {
if (!_controllerScriptingInterface->areActionsCaptured() && _myCamera.getMode() != CAMERA_MODE_MIRROR) {
- myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z,
- -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z));
+ myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z));
myAvatar->setDriveKey(MyAvatar::TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y));
myAvatar->setDriveKey(MyAvatar::TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X));
if (deltaTime > FLT_EPSILON) {
myAvatar->setDriveKey(MyAvatar::PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH));
myAvatar->setDriveKey(MyAvatar::YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW));
- myAvatar->setDriveKey(MyAvatar::DELTA_PITCH,
- -1.0f * userInputMapper->getActionState(controller::Action::DELTA_PITCH));
- myAvatar->setDriveKey(MyAvatar::DELTA_YAW,
- -1.0f * userInputMapper->getActionState(controller::Action::DELTA_YAW));
- myAvatar->setDriveKey(MyAvatar::STEP_YAW,
- -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW));
+ myAvatar->setDriveKey(MyAvatar::DELTA_PITCH, -1.0f * userInputMapper->getActionState(controller::Action::DELTA_PITCH));
+ myAvatar->setDriveKey(MyAvatar::DELTA_YAW, -1.0f * userInputMapper->getActionState(controller::Action::DELTA_YAW));
+ myAvatar->setDriveKey(MyAvatar::STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW));
}
}
myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z));
}
myAvatar->setSprintMode((bool)userInputMapper->getActionState(controller::Action::SPRINT));
- static const std::vector avatarControllerActions = { controller::Action::LEFT_HAND,
- controller::Action::RIGHT_HAND,
- controller::Action::LEFT_FOOT,
- controller::Action::RIGHT_FOOT,
- controller::Action::HIPS,
- controller::Action::SPINE2,
- controller::Action::HEAD,
- controller::Action::LEFT_HAND_THUMB1,
- controller::Action::LEFT_HAND_THUMB2,
- controller::Action::LEFT_HAND_THUMB3,
- controller::Action::LEFT_HAND_THUMB4,
- controller::Action::LEFT_HAND_INDEX1,
- controller::Action::LEFT_HAND_INDEX2,
- controller::Action::LEFT_HAND_INDEX3,
- controller::Action::LEFT_HAND_INDEX4,
- controller::Action::LEFT_HAND_MIDDLE1,
- controller::Action::LEFT_HAND_MIDDLE2,
- controller::Action::LEFT_HAND_MIDDLE3,
- controller::Action::LEFT_HAND_MIDDLE4,
- controller::Action::LEFT_HAND_RING1,
- controller::Action::LEFT_HAND_RING2,
- controller::Action::LEFT_HAND_RING3,
- controller::Action::LEFT_HAND_RING4,
- controller::Action::LEFT_HAND_PINKY1,
- controller::Action::LEFT_HAND_PINKY2,
- controller::Action::LEFT_HAND_PINKY3,
- controller::Action::LEFT_HAND_PINKY4,
- controller::Action::RIGHT_HAND_THUMB1,
- controller::Action::RIGHT_HAND_THUMB2,
- controller::Action::RIGHT_HAND_THUMB3,
- controller::Action::RIGHT_HAND_THUMB4,
- controller::Action::RIGHT_HAND_INDEX1,
- controller::Action::RIGHT_HAND_INDEX2,
- controller::Action::RIGHT_HAND_INDEX3,
- controller::Action::RIGHT_HAND_INDEX4,
- controller::Action::RIGHT_HAND_MIDDLE1,
- controller::Action::RIGHT_HAND_MIDDLE2,
- controller::Action::RIGHT_HAND_MIDDLE3,
- controller::Action::RIGHT_HAND_MIDDLE4,
- controller::Action::RIGHT_HAND_RING1,
- controller::Action::RIGHT_HAND_RING2,
- controller::Action::RIGHT_HAND_RING3,
- controller::Action::RIGHT_HAND_RING4,
- controller::Action::RIGHT_HAND_PINKY1,
- controller::Action::RIGHT_HAND_PINKY2,
- controller::Action::RIGHT_HAND_PINKY3,
- controller::Action::RIGHT_HAND_PINKY4,
- controller::Action::LEFT_ARM,
- controller::Action::RIGHT_ARM,
- controller::Action::LEFT_SHOULDER,
- controller::Action::RIGHT_SHOULDER,
- controller::Action::LEFT_FORE_ARM,
- controller::Action::RIGHT_FORE_ARM,
- controller::Action::LEFT_LEG,
- controller::Action::RIGHT_LEG,
- controller::Action::LEFT_UP_LEG,
- controller::Action::RIGHT_UP_LEG,
- controller::Action::LEFT_TOE_BASE,
- controller::Action::RIGHT_TOE_BASE };
+ static const std::vector avatarControllerActions = {
+ controller::Action::LEFT_HAND,
+ controller::Action::RIGHT_HAND,
+ controller::Action::LEFT_FOOT,
+ controller::Action::RIGHT_FOOT,
+ controller::Action::HIPS,
+ controller::Action::SPINE2,
+ controller::Action::HEAD,
+ controller::Action::LEFT_HAND_THUMB1,
+ controller::Action::LEFT_HAND_THUMB2,
+ controller::Action::LEFT_HAND_THUMB3,
+ controller::Action::LEFT_HAND_THUMB4,
+ controller::Action::LEFT_HAND_INDEX1,
+ controller::Action::LEFT_HAND_INDEX2,
+ controller::Action::LEFT_HAND_INDEX3,
+ controller::Action::LEFT_HAND_INDEX4,
+ controller::Action::LEFT_HAND_MIDDLE1,
+ controller::Action::LEFT_HAND_MIDDLE2,
+ controller::Action::LEFT_HAND_MIDDLE3,
+ controller::Action::LEFT_HAND_MIDDLE4,
+ controller::Action::LEFT_HAND_RING1,
+ controller::Action::LEFT_HAND_RING2,
+ controller::Action::LEFT_HAND_RING3,
+ controller::Action::LEFT_HAND_RING4,
+ controller::Action::LEFT_HAND_PINKY1,
+ controller::Action::LEFT_HAND_PINKY2,
+ controller::Action::LEFT_HAND_PINKY3,
+ controller::Action::LEFT_HAND_PINKY4,
+ controller::Action::RIGHT_HAND_THUMB1,
+ controller::Action::RIGHT_HAND_THUMB2,
+ controller::Action::RIGHT_HAND_THUMB3,
+ controller::Action::RIGHT_HAND_THUMB4,
+ controller::Action::RIGHT_HAND_INDEX1,
+ controller::Action::RIGHT_HAND_INDEX2,
+ controller::Action::RIGHT_HAND_INDEX3,
+ controller::Action::RIGHT_HAND_INDEX4,
+ controller::Action::RIGHT_HAND_MIDDLE1,
+ controller::Action::RIGHT_HAND_MIDDLE2,
+ controller::Action::RIGHT_HAND_MIDDLE3,
+ controller::Action::RIGHT_HAND_MIDDLE4,
+ controller::Action::RIGHT_HAND_RING1,
+ controller::Action::RIGHT_HAND_RING2,
+ controller::Action::RIGHT_HAND_RING3,
+ controller::Action::RIGHT_HAND_RING4,
+ controller::Action::RIGHT_HAND_PINKY1,
+ controller::Action::RIGHT_HAND_PINKY2,
+ controller::Action::RIGHT_HAND_PINKY3,
+ controller::Action::RIGHT_HAND_PINKY4,
+ controller::Action::LEFT_ARM,
+ controller::Action::RIGHT_ARM,
+ controller::Action::LEFT_SHOULDER,
+ controller::Action::RIGHT_SHOULDER,
+ controller::Action::LEFT_FORE_ARM,
+ controller::Action::RIGHT_FORE_ARM,
+ controller::Action::LEFT_LEG,
+ controller::Action::RIGHT_LEG,
+ controller::Action::LEFT_UP_LEG,
+ controller::Action::RIGHT_UP_LEG,
+ controller::Action::LEFT_TOE_BASE,
+ controller::Action::RIGHT_TOE_BASE
+ };
// copy controller poses from userInputMapper to myAvatar.
glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition());
@@ -6290,25 +6333,21 @@ void Application::update(float deltaTime) {
myAvatar->setControllerPoseInSensorFrame(action, pose.transform(avatarToSensorMatrix));
}
- static const std::vector trackedObjectStringLiterals =
- { QStringLiteral("_TrackedObject00"), QStringLiteral("_TrackedObject01"), QStringLiteral("_TrackedObject02"),
- QStringLiteral("_TrackedObject03"), QStringLiteral("_TrackedObject04"), QStringLiteral("_TrackedObject05"),
- QStringLiteral("_TrackedObject06"), QStringLiteral("_TrackedObject07"), QStringLiteral("_TrackedObject08"),
- QStringLiteral("_TrackedObject09"), QStringLiteral("_TrackedObject10"), QStringLiteral("_TrackedObject11"),
- QStringLiteral("_TrackedObject12"), QStringLiteral("_TrackedObject13"), QStringLiteral("_TrackedObject14"),
- QStringLiteral("_TrackedObject15") };
+ static const std::vector trackedObjectStringLiterals = {
+ QStringLiteral("_TrackedObject00"), QStringLiteral("_TrackedObject01"), QStringLiteral("_TrackedObject02"), QStringLiteral("_TrackedObject03"),
+ QStringLiteral("_TrackedObject04"), QStringLiteral("_TrackedObject05"), QStringLiteral("_TrackedObject06"), QStringLiteral("_TrackedObject07"),
+ QStringLiteral("_TrackedObject08"), QStringLiteral("_TrackedObject09"), QStringLiteral("_TrackedObject10"), QStringLiteral("_TrackedObject11"),
+ QStringLiteral("_TrackedObject12"), QStringLiteral("_TrackedObject13"), QStringLiteral("_TrackedObject14"), QStringLiteral("_TrackedObject15")
+ };
// Controlled by the Developer > Avatar > Show Tracked Objects menu.
if (_showTrackedObjects) {
- static const std::vector trackedObjectActions =
- { controller::Action::TRACKED_OBJECT_00, controller::Action::TRACKED_OBJECT_01,
- controller::Action::TRACKED_OBJECT_02, controller::Action::TRACKED_OBJECT_03,
- controller::Action::TRACKED_OBJECT_04, controller::Action::TRACKED_OBJECT_05,
- controller::Action::TRACKED_OBJECT_06, controller::Action::TRACKED_OBJECT_07,
- controller::Action::TRACKED_OBJECT_08, controller::Action::TRACKED_OBJECT_09,
- controller::Action::TRACKED_OBJECT_10, controller::Action::TRACKED_OBJECT_11,
- controller::Action::TRACKED_OBJECT_12, controller::Action::TRACKED_OBJECT_13,
- controller::Action::TRACKED_OBJECT_14, controller::Action::TRACKED_OBJECT_15 };
+ static const std::vector trackedObjectActions = {
+ controller::Action::TRACKED_OBJECT_00, controller::Action::TRACKED_OBJECT_01, controller::Action::TRACKED_OBJECT_02, controller::Action::TRACKED_OBJECT_03,
+ controller::Action::TRACKED_OBJECT_04, controller::Action::TRACKED_OBJECT_05, controller::Action::TRACKED_OBJECT_06, controller::Action::TRACKED_OBJECT_07,
+ controller::Action::TRACKED_OBJECT_08, controller::Action::TRACKED_OBJECT_09, controller::Action::TRACKED_OBJECT_10, controller::Action::TRACKED_OBJECT_11,
+ controller::Action::TRACKED_OBJECT_12, controller::Action::TRACKED_OBJECT_13, controller::Action::TRACKED_OBJECT_14, controller::Action::TRACKED_OBJECT_15
+ };
int i = 0;
glm::vec4 BLUE(0.0f, 0.0f, 1.0f, 1.0f);
@@ -6331,8 +6370,8 @@ void Application::update(float deltaTime) {
_prevShowTrackedObjects = _showTrackedObjects;
}
- updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
- updateDialogs(deltaTime); // update various stats dialogs if present
+ updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
+ updateDialogs(deltaTime); // update various stats dialogs if present
auto grabManager = DependencyManager::get();
grabManager->simulateGrabs();
@@ -6410,15 +6449,18 @@ void Application::update(float deltaTime) {
{
PROFILE_RANGE(simulation_physics, "PrepareActions");
- _physicsEngine->forEachDynamic(
- [&](EntityDynamicPointer dynamic) { dynamic->prepareForPhysicsSimulation(); });
+ _physicsEngine->forEachDynamic([&](EntityDynamicPointer dynamic) {
+ dynamic->prepareForPhysicsSimulation();
+ });
}
}
auto t2 = std::chrono::high_resolution_clock::now();
{
PROFILE_RANGE(simulation_physics, "StepPhysics");
PerformanceTimer perfTimer("stepPhysics");
- getEntities()->getTree()->withWriteLock([&] { _physicsEngine->stepSimulation(); });
+ getEntities()->getTree()->withWriteLock([&] {
+ _physicsEngine->stepSimulation();
+ });
}
auto t3 = std::chrono::high_resolution_clock::now();
{
@@ -6457,8 +6499,8 @@ void Application::update(float deltaTime) {
}
if (PerformanceTimer::isActive() &&
- Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
- Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsTiming)) {
+ Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
+ Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsTiming)) {
_physicsEngine->harvestPerformanceStats();
}
// NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework
@@ -6468,17 +6510,17 @@ void Application::update(float deltaTime) {
// NOTE: the getEntities()->update() call below will wait for lock
// and will provide non-physical entity motion
- getEntities()->update(true); // update the models...
+ getEntities()->update(true); // update the models...
auto t5 = std::chrono::high_resolution_clock::now();
workload::Timings timings(6);
- timings[0] = t1 - t0; // prePhysics entities
- timings[1] = t2 - t1; // prePhysics avatars
- timings[2] = t3 - t2; // stepPhysics
- timings[3] = t4 - t3; // postPhysics
- timings[4] = t5 - t4; // non-physical kinematics
- timings[5] = workload::Timing_ns((int32_t)(NSECS_PER_SECOND * deltaTime)); // game loop duration
+ timings[0] = t1 - t0; // prePhysics entities
+ timings[1] = t2 - t1; // prePhysics avatars
+ timings[2] = t3 - t2; // stepPhysics
+ timings[3] = t4 - t3; // postPhysics
+ timings[4] = t5 - t4; // non-physical kinematics
+ timings[5] = workload::Timing_ns((int32_t)(NSECS_PER_SECOND * deltaTime)); // game loop duration
_gameWorkload.updateSimulationTimings(timings);
}
}
@@ -6562,8 +6604,9 @@ void Application::update(float deltaTime) {
viewIsDifferentEnough = true;
}
+
// if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it
- static const std::chrono::seconds MIN_PERIOD_BETWEEN_QUERIES{ 3 };
+ static const std::chrono::seconds MIN_PERIOD_BETWEEN_QUERIES { 3 };
auto now = SteadyClock::now();
if (now > _queryExpiry || viewIsDifferentEnough) {
if (DependencyManager::get()->shouldRenderEntities()) {
@@ -6592,8 +6635,7 @@ void Application::update(float deltaTime) {
if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS && !isInterstitialMode()) {
_lastSendDownstreamAudioStats = now;
- QMetaObject::invokeMethod(DependencyManager::get().data(), "sendDownstreamAudioStatsPacket",
- Qt::QueuedConnection);
+ QMetaObject::invokeMethod(DependencyManager::get().data(), "sendDownstreamAudioStatsPacket", Qt::QueuedConnection);
}
}
@@ -6612,6 +6654,7 @@ void Application::update(float deltaTime) {
_postUpdateLambdas.clear();
}
+
updateRenderArgs(deltaTime);
{
@@ -6619,7 +6662,8 @@ void Application::update(float deltaTime) {
AnimDebugDraw::getInstance().update();
}
- { // Game loop is done, mark the end of the frame for the scene transactions and the render loop to take over
+
+ { // Game loop is done, mark the end of the frame for the scene transactions and the render loop to take over
PerformanceTimer perfTimer("enqueueFrame");
getMain3DScene()->enqueueFrame();
}
@@ -6653,16 +6697,16 @@ void Application::updateRenderArgs(float deltaTime) {
{
QMutexLocker viewLocker(&_viewMutex);
// adjust near clip plane to account for sensor scaling.
- auto adjustedProjection =
- glm::perspective(glm::radians(_fieldOfView.get()), getActiveDisplayPlugin()->getRecommendedAspectRatio(),
- DEFAULT_NEAR_CLIP * sensorToWorldScale, DEFAULT_FAR_CLIP);
+ auto adjustedProjection = glm::perspective(glm::radians(_fieldOfView.get()),
+ getActiveDisplayPlugin()->getRecommendedAspectRatio(),
+ DEFAULT_NEAR_CLIP * sensorToWorldScale,
+ DEFAULT_FAR_CLIP);
_viewFrustum.setProjection(adjustedProjection);
_viewFrustum.calculate();
}
- appRenderArgs._renderArgs =
- RenderArgs(_graphicsEngine.getGPUContext(), lodManager->getOctreeSizeScale(),
- lodManager->getBoundaryLevelAdjust(), lodManager->getLODAngleHalfTan(),
- RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
+ appRenderArgs._renderArgs = RenderArgs(_graphicsEngine.getGPUContext(), lodManager->getOctreeSizeScale(),
+ lodManager->getBoundaryLevelAdjust(), lodManager->getLODAngleHalfTan(), RenderArgs::DEFAULT_RENDER_MODE,
+ RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
appRenderArgs._renderArgs._scene = getMain3DScene();
{
@@ -6751,6 +6795,7 @@ void Application::updateRenderArgs(float deltaTime) {
appRenderArgs._renderArgs.setViewFrustum(_displayViewFrustum);
}
+
// HACK
// load the view frustum
// FIXME: This preDisplayRender call is temporary until we create a separate render::scene for the mirror rendering.
@@ -6779,14 +6824,18 @@ void Application::queryAvatars() {
}
}
+
int Application::sendNackPackets() {
+
// iterates through all nodes in NodeList
auto nodeList = DependencyManager::get();
int packetsSent = 0;
- nodeList->eachNode([&](const SharedNodePointer& node) {
+ nodeList->eachNode([&](const SharedNodePointer& node){
+
if (node->getActiveSocket() && node->getType() == NodeType::EntityServer) {
+
auto nackPacketList = NLPacketList::create(PacketType::OctreeDataNack);
QUuid nodeUUID = node->getUUID();
@@ -6804,8 +6853,7 @@ int Application::sendNackPackets() {
return;
}
// get sequence number stats of node, prune its missing set, and make a copy of the missing set
- SequenceNumberStats& sequenceNumberStats =
- _octreeServerSceneStats[nodeUUID].getIncomingOctreeSequenceNumberStats();
+ SequenceNumberStats& sequenceNumberStats = _octreeServerSceneStats[nodeUUID].getIncomingOctreeSequenceNumberStats();
sequenceNumberStats.pruneMissingSet();
missingSequenceNumbers = sequenceNumberStats.getMissingSet();
});
@@ -6813,7 +6861,7 @@ int Application::sendNackPackets() {
_isMissingSequenceNumbers = (missingSequenceNumbers.size() != 0);
// construct nack packet(s) for this node
- foreach (const OCTREE_PACKET_SEQUENCE& missingNumber, missingSequenceNumbers) {
+ foreach(const OCTREE_PACKET_SEQUENCE& missingNumber, missingSequenceNumbers) {
nackPacketList->writePrimitive(missingNumber);
}
@@ -6830,8 +6878,9 @@ int Application::sendNackPackets() {
}
void Application::queryOctree(NodeType_t serverType, PacketType packetType) {
+
if (!_settingsLoaded) {
- return; // bail early if settings are not loaded
+ return; // bail early if settings are not loaded
}
const bool isModifiedQuery = !_physicsEnabled;
@@ -6861,6 +6910,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) {
}
_octreeQuery.setReportInitialCompletion(isModifiedQuery);
+
auto nodeList = DependencyManager::get();
auto node = nodeList->soloNodeOfType(serverType);
@@ -6879,6 +6929,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) {
}
}
+
bool Application::isHMDMode() const {
return getActiveDisplayPlugin()->isHmd();
}
@@ -6887,9 +6938,7 @@ float Application::getNumCollisionObjects() const {
return _physicsEngine ? _physicsEngine->getNumCollisionObjects() : 0;
}
-float Application::getTargetRenderFrameRate() const {
- return getActiveDisplayPlugin()->getTargetFrameRate();
-}
+float Application::getTargetRenderFrameRate() const { return getActiveDisplayPlugin()->getTargetFrameRate(); }
QRect Application::getDesirableApplicationGeometry() const {
QRect applicationGeometry = getWindow()->geometry();
@@ -6915,7 +6964,7 @@ QRect Application::getDesirableApplicationGeometry() const {
}
PickRay Application::computePickRay(float x, float y) const {
- vec2 pickPoint{ x, y };
+ vec2 pickPoint { x, y };
PickRay result;
if (isHMDMode()) {
getApplicationCompositor().computeHmdPickRay(pickPoint, result.origin, result.direction);
@@ -6975,18 +7024,19 @@ void Application::hmdVisibleChanged(bool visible) {
}
void Application::updateWindowTitle() const {
+
auto nodeList = DependencyManager::get();
auto accountManager = DependencyManager::get();
auto isInErrorState = nodeList->getDomainHandler().isInErrorState();
- QString buildVersion = " - " +
- (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable ? QString("Version") : QString("Build")) +
- " " + applicationVersion();
+ QString buildVersion = " - "
+ + (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable ? QString("Version") : QString("Build"))
+ + " " + applicationVersion();
QString loginStatus = accountManager->isLoggedIn() ? "" : " (NOT LOGGED IN)";
- QString connectionStatus =
- isInErrorState ? " (ERROR CONNECTING)" : nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
+ QString connectionStatus = isInErrorState ? " (ERROR CONNECTING)" :
+ nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
QString username = accountManager->getAccountInfo().getUsername();
setCrashAnnotation("username", username.toStdString());
@@ -7005,8 +7055,8 @@ void Application::updateWindowTitle() const {
}
}
- QString title = QString() + (!username.isEmpty() ? username + " @ " : QString()) + currentPlaceName + connectionStatus +
- loginStatus + buildVersion;
+ QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
+ + currentPlaceName + connectionStatus + loginStatus + buildVersion;
#ifndef WIN32
// crashes with vs2013/win32
@@ -7016,7 +7066,7 @@ void Application::updateWindowTitle() const {
// updateTitleWindow gets called whenever there's a change regarding the domain, so rather
// than placing this within domainURLChanged, it's placed here to cover the other potential cases.
- DependencyManager::get()->sendLocalMessage("Toolbar-DomainChanged", "");
+ DependencyManager::get< MessagesClient >()->sendLocalMessage("Toolbar-DomainChanged", "");
}
void Application::clearDomainOctreeDetails(bool clearAll) {
@@ -7030,7 +7080,9 @@ void Application::clearDomainOctreeDetails(bool clearAll) {
resetPhysicsReadyInformation();
setIsInterstitialMode(true);
- _octreeServerSceneStats.withWriteLock([&] { _octreeServerSceneStats.clear(); });
+ _octreeServerSceneStats.withWriteLock([&] {
+ _octreeServerSceneStats.clear();
+ });
// reset the model renderer
clearAll ? getEntities()->clear() : getEntities()->clearDomainAndNonOwnedEntities();
@@ -7114,7 +7166,7 @@ void Application::nodeActivated(SharedNodePointer node) {
_queryExpiry = SteadyClock::now();
_octreeQuery.incrementConnectionID();
- if (!_failedToConnectToEntityServer) {
+ if (!_failedToConnectToEntityServer) {
_entityServerConnectionTimer.stop();
}
}
@@ -7240,6 +7292,7 @@ void Application::addingEntityWithCertificate(const QString& certificateID, cons
}
void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointer scriptEngine) {
+
scriptEngine->setEmitScriptUpdatesFunction([this]() {
SharedNodePointer entityServerNode = DependencyManager::get()->soloNodeOfType(NodeType::EntityServer);
return !entityServerNode || isPhysicsEnabled();
@@ -7283,13 +7336,13 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
#endif
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue, wrapperFromScriptValue);
- qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue,
- wrapperFromScriptValue);
+ qScriptRegisterMetaType(scriptEngine.data(),
+ wrapperToScriptValue, wrapperFromScriptValue);
scriptEngine->registerGlobalObject("Toolbars", DependencyManager::get().data());
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue, wrapperFromScriptValue);
- qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue,
- wrapperFromScriptValue);
+ qScriptRegisterMetaType(scriptEngine.data(),
+ wrapperToScriptValue, wrapperFromScriptValue);
scriptEngine->registerGlobalObject("Tablet", DependencyManager::get().data());
// FIXME remove these deprecated names for the tablet scripting interface
scriptEngine->registerGlobalObject("tabletInterface", DependencyManager::get().data());
@@ -7299,20 +7352,17 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGlobalObject("Window", DependencyManager::get().data());
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
- LocationScriptingInterface::locationSetter, "Window");
+ LocationScriptingInterface::locationSetter, "Window");
// register `location` on the global object.
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
LocationScriptingInterface::locationSetter);
bool clientScript = scriptEngine->isClientScript();
- scriptEngine->registerFunction("OverlayWindow",
- clientScript ? QmlWindowClass::constructor : QmlWindowClass::restricted_constructor);
+ scriptEngine->registerFunction("OverlayWindow", clientScript ? QmlWindowClass::constructor : QmlWindowClass::restricted_constructor);
#if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML)
- scriptEngine->registerFunction("OverlayWebWindow",
- clientScript ? QmlWebWindowClass::constructor : QmlWebWindowClass::restricted_constructor);
+ scriptEngine->registerFunction("OverlayWebWindow", clientScript ? QmlWebWindowClass::constructor : QmlWebWindowClass::restricted_constructor);
#endif
- scriptEngine->registerFunction("QmlFragment",
- clientScript ? QmlFragmentClass::constructor : QmlFragmentClass::restricted_constructor);
+ scriptEngine->registerFunction("QmlFragment", clientScript ? QmlFragmentClass::constructor : QmlFragmentClass::restricted_constructor);
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
scriptEngine->registerGlobalObject("DesktopPreviewProvider", DependencyManager::get().data());
@@ -7339,10 +7389,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface);
- scriptEngine->registerGlobalObject("Account",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
- scriptEngine->registerGlobalObject("GlobalServices",
- AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ scriptEngine->registerGlobalObject("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
+ scriptEngine->registerGlobalObject("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
scriptEngine->registerGlobalObject("AccountServices", AccountServicesScriptingInterface::getInstance());
qScriptRegisterMetaType(scriptEngine.data(), DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue);
@@ -7371,8 +7419,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get