diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ae139e69b..c8710eed05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,25 @@ if (ANDROID) set(GLES_OPTION ON) set(PLATFORM_QT_COMPONENTS AndroidExtras WebView) add_definitions(-DHIFI_ANDROID_APP=\"${HIFI_ANDROID_APP}\") + if ( + (${HIFI_ANDROID_APP} STREQUAL "questInterface") OR + (${HIFI_ANDROID_APP} STREQUAL "questFramePlayer") OR + (${HIFI_ANDROID_APP} STREQUAL "framePlayer") + ) + # We know the quest hardware has this extension, so we can force the use of instanced stereo + add_definitions(-DHAVE_EXT_clip_cull_distance) + # We can also use multiview stereo techniques + add_definitions(-DHAVE_OVR_multiview2) + add_definitions(-DHAVE_OVR_multiview) + # We can also use our own foveated textures + add_definitions(-DHAVE_QCOM_texture_foveated) + + # if set, the application itself or some library it depends on MUST implement + # `DisplayPluginList getDisplayPlugins()` and `InputPluginList getInputPlugins()` + add_definitions(-DCUSTOM_INPUT_PLUGINS) + add_definitions(-DCUSTOM_DISPLAY_PLUGINS) + set(PLATFORM_PLUGIN_LIBRARIES oculusMobile oculusMobilePlugin) + endif() else () set(PLATFORM_QT_COMPONENTS WebEngine Xml) endif () diff --git a/android/apps/framePlayer/build.gradle b/android/apps/framePlayer/build.gradle index a210c8300e..5bf8176863 100644 --- a/android/apps/framePlayer/build.gradle +++ b/android/apps/framePlayer/build.gradle @@ -1,15 +1,8 @@ +import com.android.builder.core.BuilderConstants + apply plugin: 'com.android.application' android { - signingConfigs { - release { - storeFile project.hasProperty("HIFI_ANDROID_KEYSTORE") ? file(HIFI_ANDROID_KEYSTORE) : null - storePassword project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") ? HIFI_ANDROID_KEYSTORE_PASSWORD : '' - keyAlias project.hasProperty("HIFI_ANDROID_KEY_ALIAS") ? HIFI_ANDROID_KEY_ALIAS : '' - keyPassword project.hasProperty("HIFI_ANDROID_KEY_PASSWORD") ? HIFI_ANDROID_KEY_PASSWORD : '' - } - } - compileSdkVersion 28 defaultConfig { applicationId "io.highfidelity.frameplayer" @@ -32,19 +25,17 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release + externalNativeBuild.cmake.path '../../../CMakeLists.txt' + + variantFilter { variant -> + def build = variant.buildType.name + if (build == BuilderConstants.RELEASE) { + variant.setIgnore(true) } } - - externalNativeBuild.cmake.path '../../../CMakeLists.txt' } dependencies { implementation fileTree(include: ['*.jar'], dir: '../../libraries/qt/libs') - //implementation project(':oculus') implementation project(':qt') } diff --git a/android/apps/questFramePlayer/build.gradle b/android/apps/questFramePlayer/build.gradle index 899f9cb955..0b153af0a9 100644 --- a/android/apps/questFramePlayer/build.gradle +++ b/android/apps/questFramePlayer/build.gradle @@ -1,15 +1,8 @@ +import com.android.builder.core.BuilderConstants + apply plugin: 'com.android.application' android { - signingConfigs { - release { - storeFile project.hasProperty("HIFI_ANDROID_KEYSTORE") ? file(HIFI_ANDROID_KEYSTORE) : null - storePassword project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") ? HIFI_ANDROID_KEYSTORE_PASSWORD : '' - keyAlias project.hasProperty("HIFI_ANDROID_KEY_ALIAS") ? HIFI_ANDROID_KEY_ALIAS : '' - keyPassword project.hasProperty("HIFI_ANDROID_KEY_PASSWORD") ? HIFI_ANDROID_KEY_PASSWORD : '' - } - } - compileSdkVersion 28 defaultConfig { applicationId "io.highfidelity.frameplayer" @@ -33,15 +26,14 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release + externalNativeBuild.cmake.path '../../../CMakeLists.txt' + + variantFilter { variant -> + def build = variant.buildType.name + if (build == BuilderConstants.RELEASE) { + variant.setIgnore(true) } } - - externalNativeBuild.cmake.path '../../../CMakeLists.txt' } dependencies { diff --git a/android/libraries/qt/src/main/java/org/qtproject/qt5/android/bindings/QtActivity.java b/android/libraries/qt/src/main/java/org/qtproject/qt5/android/bindings/QtActivity.java index 40e1863d69..6a6688ac41 100644 --- a/android/libraries/qt/src/main/java/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/android/libraries/qt/src/main/java/org/qtproject/qt5/android/bindings/QtActivity.java @@ -650,6 +650,8 @@ public class QtActivity extends Activity { if (!keepInterfaceRunning) { QtApplication.invokeDelegate(); } + QtNative.terminateQt(); + QtNative.setActivity(null,null); } //--------------------------------------------------------------------------- diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b87f6c8584..afb86d2073 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -211,7 +211,10 @@ link_hifi_libraries( render-utils entities-renderer avatars-renderer ui qml auto-updater midi controllers plugins image trackers ui-plugins display-plugins input-plugins + # Platform specific GL libraries ${PLATFORM_GL_BACKEND} + # Plaform specific input & display plugin libraries + ${PLATFORM_PLUGIN_LIBRARIES} shaders ) diff --git a/interface/resources/qml/hifi/avatarapp/Settings.qml b/interface/resources/qml/hifi/avatarapp/Settings.qml index 39c48646d3..c59fe42608 100644 --- a/interface/resources/qml/hifi/avatarapp/Settings.qml +++ b/interface/resources/qml/hifi/avatarapp/Settings.qml @@ -21,7 +21,7 @@ Rectangle { HifiControlsUit.Keyboard { id: keyboard z: 1000 - raised: parent.keyboardEnabled && parent.keyboardRaised + raised: parent.keyboardEnabled && parent.keyboardRaised && HMD.active numeric: parent.punctuationMode anchors { left: parent.left diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index bcc2a2821c..dc892e6640 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -607,7 +607,7 @@ Rectangle { } else if (msg.method === "showTrashLightbox") { lightboxPopup.titleText = "Send \"" + msg.itemName + "\" to Trash"; lightboxPopup.bodyText = "Sending this item to the Trash means you will no longer own this item " + - "and it will be inaccessible to you from Purchases.\n\nThis action cannot be undone."; + "and it will be inaccessible to you from Inventory.\n\nThis action cannot be undone."; lightboxPopup.button1text = "CANCEL"; lightboxPopup.button1method = function() { lightboxPopup.visible = false; diff --git a/interface/src/AboutUtil.h b/interface/src/AboutUtil.h index 767e69842d..1495045b85 100644 --- a/interface/src/AboutUtil.h +++ b/interface/src/AboutUtil.h @@ -20,7 +20,8 @@ * * @hifi-interface * @hifi-client-entity - * + * @hifi-avatar + * * @property {string} buildDate * @property {string} buildVersion * @property {string} qtVersion diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 471e66e01b..ff385c974d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -603,8 +603,9 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt __android_log_write(ANDROID_LOG_FATAL,"Interface",local); abort(); } -#endif +#else qApp->getLogger()->addMessage(qPrintable(logMessage)); +#endif } } @@ -989,7 +990,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo 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)), @@ -1123,7 +1126,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo } auto accountManager = DependencyManager::get(); +#ifndef Q_OS_ANDROID _logger->setSessionID(accountManager->getSessionID()); +#endif setCrashAnnotation("metaverse_session_id", accountManager->getSessionID().toString().toStdString()); setCrashAnnotation("main_thread_id", std::to_string((size_t)QThread::currentThreadId())); @@ -4963,7 +4968,11 @@ void Application::idle() { // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing // details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing // details normally. +#ifdef Q_OS_ANDROID + bool showWarnings = false; +#else bool showWarnings = getLogger()->extraDebugging(); +#endif PerformanceWarning warn(showWarnings, "idle()"); { @@ -8306,7 +8315,7 @@ void Application::toggleLogDialog() { bool keepOnTop =_keepLogWindowOnTop.get(); #ifdef Q_OS_WIN _logDialog = new LogDialog(keepOnTop ? qApp->getWindow() : nullptr, getLogger()); -#else +#elif !defined(Q_OS_ANDROID) _logDialog = new LogDialog(nullptr, getLogger()); if (keepOnTop) { diff --git a/interface/src/Application.h b/interface/src/Application.h index de79e91cb2..2b4902f72e 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -251,7 +251,9 @@ public: void setActiveDisplayPlugin(const QString& pluginName); +#ifndef Q_OS_ANDROID FileLogger* getLogger() const { return _logger; } +#endif float getRenderResolutionScale() const; @@ -599,7 +601,9 @@ private: bool _aboutToQuit { false }; +#ifndef Q_OS_ANDROID FileLogger* _logger { nullptr }; +#endif bool _previousSessionCrashed; diff --git a/interface/src/AvatarBookmarks.h b/interface/src/AvatarBookmarks.h index f1bc6820eb..4623e7d929 100644 --- a/interface/src/AvatarBookmarks.h +++ b/interface/src/AvatarBookmarks.h @@ -21,6 +21,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * */ diff --git a/interface/src/LODManager.h b/interface/src/LODManager.h index 6206fd3539..559bae1779 100644 --- a/interface/src/LODManager.h +++ b/interface/src/LODManager.h @@ -36,6 +36,7 @@ class AABox; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} presentTime Read-only. * @property {number} engineRunTime Read-only. diff --git a/interface/src/LocationBookmarks.h b/interface/src/LocationBookmarks.h index 70ea50e2e7..8cd8e40634 100644 --- a/interface/src/LocationBookmarks.h +++ b/interface/src/LocationBookmarks.h @@ -21,6 +21,7 @@ * * @hifi-client-entity * @hifi-interface + * @hifi-avatar */ class LocationBookmarks : public Bookmarks, public Dependency { diff --git a/interface/src/SpeechRecognizer.h b/interface/src/SpeechRecognizer.h index b22ab73837..7e2acdb8ac 100644 --- a/interface/src/SpeechRecognizer.h +++ b/interface/src/SpeechRecognizer.h @@ -27,6 +27,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class SpeechRecognizer : public QObject, public Dependency { Q_OBJECT diff --git a/interface/src/audio/AudioScope.h b/interface/src/audio/AudioScope.h index 41cee8d17d..912e337670 100644 --- a/interface/src/audio/AudioScope.h +++ b/interface/src/audio/AudioScope.h @@ -31,6 +31,7 @@ class AudioScope : public QObject, public Dependency { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} scopeInput Read-only. * @property {number} scopeOutputLeft Read-only. diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index 50d9e80e8b..51352ec861 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -46,6 +46,7 @@ using SortedAvatar = std::pair>; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @borrows AvatarList.getAvatarIdentifiers as getAvatarIdentifiers * @borrows AvatarList.getAvatarsInRange as getAvatarsInRange diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index c53eae65d4..1a6833b988 100755 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -66,6 +66,7 @@ class MyAvatar : public Avatar { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {Vec3} qmlPosition - A synonym for position for use by QML. * @property {boolean} shouldRenderLocally=true - If true then your avatar is rendered for you in Interface, diff --git a/interface/src/avatar/OtherAvatar.cpp b/interface/src/avatar/OtherAvatar.cpp index a3950c8e96..9496336ae1 100755 --- a/interface/src/avatar/OtherAvatar.cpp +++ b/interface/src/avatar/OtherAvatar.cpp @@ -447,6 +447,10 @@ void OtherAvatar::handleChangedAvatarEntityData() { EntityItemProperties properties; int32_t bytesLeftToRead = data.size(); unsigned char* dataAt = (unsigned char*)(data.data()); + // FIXME: This function will cause unintented changes in SpaillyNestable + // E.g overriding the ID index of an exisiting entity to temporary entity + // in the following map QHash _children; + // Andrew Meadows will address this issue if (!properties.constructFromBuffer(dataAt, bytesLeftToRead)) { // properties are corrupt continue; @@ -489,6 +493,17 @@ void OtherAvatar::handleChangedAvatarEntityData() { bool success = true; if (entity) { QUuid oldParentID = entity->getParentID(); + + // Since has overwrtiiten the back pointer + // from the parent children map (see comment for function call above), + // we need to for reset the back pointer in the map correctly by setting the parentID, but + // since the parentID of the entity has not changed we first need to set it some ither ID, + // then set the the original ID for the changes to take effect + // TODO: This is a horrible hack and once properties.constructFromBuffer no longer causes + // side effects...remove the following three lines + const QUuid NULL_ID = QUuid("{00000000-0000-0000-0000-000000000005}"); + entity->setParentID(NULL_ID); + entity->setParentID(oldParentID); if (entityTree->updateEntity(entityID, properties)) { entity->updateLastEditedFromRemote(); } else { diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 4fe36b582e..282a347dcc 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -32,6 +32,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class DdeFaceTracker : public FaceTracker, public Dependency { diff --git a/interface/src/octree/OctreePacketProcessor.cpp b/interface/src/octree/OctreePacketProcessor.cpp index 5c8868abdb..6b07e6717c 100644 --- a/interface/src/octree/OctreePacketProcessor.cpp +++ b/interface/src/octree/OctreePacketProcessor.cpp @@ -38,11 +38,13 @@ void OctreePacketProcessor::processPacket(QSharedPointer messag PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "OctreePacketProcessor::processPacket()"); +#ifndef Q_OS_ANDROID const int WAY_BEHIND = 300; if (packetsToProcessCount() > WAY_BEHIND && qApp->getLogger()->extraDebugging()) { qDebug("OctreePacketProcessor::processPacket() packets to process=%d", packetsToProcessCount()); } +#endif bool wasStatsPacket = false; diff --git a/interface/src/raypick/LaserPointerScriptingInterface.h b/interface/src/raypick/LaserPointerScriptingInterface.h index d85e329e9a..b02213340c 100644 --- a/interface/src/raypick/LaserPointerScriptingInterface.h +++ b/interface/src/raypick/LaserPointerScriptingInterface.h @@ -27,6 +27,7 @@ class LaserPointerScriptingInterface : public QObject, public Dependency { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ public: diff --git a/interface/src/raypick/PickScriptingInterface.h b/interface/src/raypick/PickScriptingInterface.h index e795068cd3..1c7c8cc6d6 100644 --- a/interface/src/raypick/PickScriptingInterface.h +++ b/interface/src/raypick/PickScriptingInterface.h @@ -23,6 +23,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} PICK_ENTITIES A filter flag. Include domain and avatar entities when intersecting. Read-only.. Deprecated. * @property {number} PICK_OVERLAYS A filter flag. Include local entities when intersecting. Read-only.. Deprecated. diff --git a/interface/src/raypick/PointerScriptingInterface.h b/interface/src/raypick/PointerScriptingInterface.h index a21c1f2470..49b13d6ce6 100644 --- a/interface/src/raypick/PointerScriptingInterface.h +++ b/interface/src/raypick/PointerScriptingInterface.h @@ -22,6 +22,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class PointerScriptingInterface : public QObject, public Dependency { diff --git a/interface/src/raypick/RayPickScriptingInterface.h b/interface/src/raypick/RayPickScriptingInterface.h index 3ad0efd439..2311cd21c8 100644 --- a/interface/src/raypick/RayPickScriptingInterface.h +++ b/interface/src/raypick/RayPickScriptingInterface.h @@ -25,6 +25,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} PICK_ENTITIES Read-only. * @property {number} PICK_OVERLAYS Read-only. diff --git a/interface/src/scripting/AccountServicesScriptingInterface.h b/interface/src/scripting/AccountServicesScriptingInterface.h index fb3c329def..55445a864d 100644 --- a/interface/src/scripting/AccountServicesScriptingInterface.h +++ b/interface/src/scripting/AccountServicesScriptingInterface.h @@ -42,6 +42,7 @@ class AccountServicesScriptingInterface : public QObject { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @namespace AccountServices * @property {string} username Read-only. diff --git a/interface/src/scripting/Audio.h b/interface/src/scripting/Audio.h index 63758d0633..e4dcba9130 100644 --- a/interface/src/scripting/Audio.h +++ b/interface/src/scripting/Audio.h @@ -32,6 +32,7 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/interface/src/scripting/ClipboardScriptingInterface.h b/interface/src/scripting/ClipboardScriptingInterface.h index f6a0b29779..42f2205861 100644 --- a/interface/src/scripting/ClipboardScriptingInterface.h +++ b/interface/src/scripting/ClipboardScriptingInterface.h @@ -24,6 +24,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class ClipboardScriptingInterface : public QObject { Q_OBJECT diff --git a/interface/src/scripting/ControllerScriptingInterface.h b/interface/src/scripting/ControllerScriptingInterface.h index b063e98992..f8adbd5c12 100644 --- a/interface/src/scripting/ControllerScriptingInterface.h +++ b/interface/src/scripting/ControllerScriptingInterface.h @@ -199,6 +199,7 @@ class ScriptEngine; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {Controller.Actions} Actions - Predefined actions on Interface and the user's avatar. These can be used as end * points in a {@link RouteObject} mapping. A synonym for Controller.Hardware.Actions. diff --git a/interface/src/scripting/DesktopScriptingInterface.h b/interface/src/scripting/DesktopScriptingInterface.h index db42b5ca54..c8e251eb3e 100644 --- a/interface/src/scripting/DesktopScriptingInterface.h +++ b/interface/src/scripting/DesktopScriptingInterface.h @@ -24,7 +24,8 @@ * * @hifi-interface * @hifi-client-entity - * + * @hifi-avatar + * * @property {number} width * @property {number} height * @property {number} ALWAYS_ON_TOP - InteractiveWindow flag for always showing a window on top diff --git a/interface/src/scripting/GooglePolyScriptingInterface.h b/interface/src/scripting/GooglePolyScriptingInterface.h index fb5aed9759..ad44ad6223 100644 --- a/interface/src/scripting/GooglePolyScriptingInterface.h +++ b/interface/src/scripting/GooglePolyScriptingInterface.h @@ -21,6 +21,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class GooglePolyScriptingInterface : public QObject, public Dependency { diff --git a/interface/src/scripting/HMDScriptingInterface.h b/interface/src/scripting/HMDScriptingInterface.h index 81f85409cc..f00e600858 100644 --- a/interface/src/scripting/HMDScriptingInterface.h +++ b/interface/src/scripting/HMDScriptingInterface.h @@ -31,6 +31,7 @@ class QScriptEngine; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {Vec3} position - The position of the HMD if currently in VR display mode, otherwise * {@link Vec3(0)|Vec3.ZERO}. Read-only. diff --git a/interface/src/scripting/KeyboardScriptingInterface.h b/interface/src/scripting/KeyboardScriptingInterface.h index acee10669e..68582d9bd9 100644 --- a/interface/src/scripting/KeyboardScriptingInterface.h +++ b/interface/src/scripting/KeyboardScriptingInterface.h @@ -24,6 +24,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {bool} raised - true If the keyboard is visible false otherwise * @property {bool} password - true Will show * instead of characters in the text display false otherwise diff --git a/interface/src/scripting/MenuScriptingInterface.h b/interface/src/scripting/MenuScriptingInterface.h index 81cf775de8..02d5c84138 100644 --- a/interface/src/scripting/MenuScriptingInterface.h +++ b/interface/src/scripting/MenuScriptingInterface.h @@ -35,6 +35,7 @@ class MenuItemProperties; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ /** diff --git a/interface/src/scripting/SelectionScriptingInterface.h b/interface/src/scripting/SelectionScriptingInterface.h index 83aec63ee2..3217efd10a 100644 --- a/interface/src/scripting/SelectionScriptingInterface.h +++ b/interface/src/scripting/SelectionScriptingInterface.h @@ -88,6 +88,7 @@ protected: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @example Outline an entity when it is grabbed by a controller. * // Create a box and copy the following text into the entity's "Script URL" field. diff --git a/interface/src/scripting/SettingsScriptingInterface.h b/interface/src/scripting/SettingsScriptingInterface.h index 32d868bb24..e907e550f3 100644 --- a/interface/src/scripting/SettingsScriptingInterface.h +++ b/interface/src/scripting/SettingsScriptingInterface.h @@ -21,6 +21,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class SettingsScriptingInterface : public QObject { diff --git a/interface/src/scripting/WalletScriptingInterface.h b/interface/src/scripting/WalletScriptingInterface.h index 36ee021b29..005af7f558 100644 --- a/interface/src/scripting/WalletScriptingInterface.h +++ b/interface/src/scripting/WalletScriptingInterface.h @@ -34,6 +34,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} walletStatus * @property {bool} limitedCommerce diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index c5e558eb3a..baff6444e1 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -31,6 +31,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other * chrome), in pixels. Read-only. diff --git a/interface/src/ui/AvatarInputs.h b/interface/src/ui/AvatarInputs.h index e67d35e59f..6569792807 100644 --- a/interface/src/ui/AvatarInputs.h +++ b/interface/src/ui/AvatarInputs.h @@ -29,6 +29,7 @@ class AvatarInputs : public QObject { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {boolean} cameraEnabled Read-only. * @property {boolean} cameraMuted Read-only. diff --git a/interface/src/ui/Snapshot.h b/interface/src/ui/Snapshot.h index 8fc05775bd..77bdfd4ac1 100644 --- a/interface/src/ui/Snapshot.h +++ b/interface/src/ui/Snapshot.h @@ -42,6 +42,7 @@ private: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class Snapshot : public QObject, public Dependency { diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h index ae608cfddb..5488da9115 100644 --- a/interface/src/ui/Stats.h +++ b/interface/src/ui/Stats.h @@ -27,6 +27,7 @@ private: \ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index 208fc8d78d..14e30b3b22 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -87,6 +87,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {Uuid} keyboardFocusOverlay - Get or set the {@link Overlays.OverlayType|web3d} overlay that has keyboard focus. * If no overlay has keyboard focus, get returns null; set to null or {@link Uuid|Uuid.NULL} to diff --git a/libraries/animation/CMakeLists.txt b/libraries/animation/CMakeLists.txt index 30addadcaa..1ab54ed342 100644 --- a/libraries/animation/CMakeLists.txt +++ b/libraries/animation/CMakeLists.txt @@ -4,5 +4,6 @@ link_hifi_libraries(shared graphics fbx) include_hifi_library_headers(networking) include_hifi_library_headers(gpu) include_hifi_library_headers(hfm) +include_hifi_library_headers(image) target_nsight() diff --git a/libraries/animation/src/AnimationCache.h b/libraries/animation/src/AnimationCache.h index eea64475df..41742c7485 100644 --- a/libraries/animation/src/AnimationCache.h +++ b/libraries/animation/src/AnimationCache.h @@ -50,6 +50,7 @@ Q_DECLARE_METATYPE(AnimationPointer) * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/animation/src/AnimationCacheScriptingInterface.h b/libraries/animation/src/AnimationCacheScriptingInterface.h index 1f5735dd0f..06db5ef352 100644 --- a/libraries/animation/src/AnimationCacheScriptingInterface.h +++ b/libraries/animation/src/AnimationCacheScriptingInterface.h @@ -30,6 +30,7 @@ class AnimationCacheScriptingInterface : public ScriptableResourceCache, public * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-assignment-client * * @property {number} numTotal - Total number of total resources. Read-only. diff --git a/libraries/audio-client/src/AudioIOStats.h b/libraries/audio-client/src/AudioIOStats.h index 45fcf365da..ffd7163586 100644 --- a/libraries/audio-client/src/AudioIOStats.h +++ b/libraries/audio-client/src/AudioIOStats.h @@ -44,6 +44,7 @@ class AudioStreamStatsInterface : public QObject { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} lossRate Read-only. * @property {number} lossCount Read-only. @@ -192,6 +193,7 @@ class AudioStatsInterface : public QObject { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} pingMs Read-only. * @property {number} inputReadMsMax Read-only. diff --git a/libraries/audio/src/AudioEffectOptions.h b/libraries/audio/src/AudioEffectOptions.h index 4bc7957142..e090832510 100644 --- a/libraries/audio/src/AudioEffectOptions.h +++ b/libraries/audio/src/AudioEffectOptions.h @@ -25,6 +25,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index 836e28d582..da165c778a 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -132,6 +132,7 @@ typedef QSharedPointer SharedSoundPointer; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/audio/src/SoundCacheScriptingInterface.h b/libraries/audio/src/SoundCacheScriptingInterface.h index c985e8c211..9caa7a8066 100644 --- a/libraries/audio/src/SoundCacheScriptingInterface.h +++ b/libraries/audio/src/SoundCacheScriptingInterface.h @@ -30,6 +30,7 @@ class SoundCacheScriptingInterface : public ScriptableResourceCache, public Depe * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/avatars/src/ClientTraitsHandler.cpp b/libraries/avatars/src/ClientTraitsHandler.cpp index 3e188afbdf..bcbe5308c7 100644 --- a/libraries/avatars/src/ClientTraitsHandler.cpp +++ b/libraries/avatars/src/ClientTraitsHandler.cpp @@ -107,10 +107,11 @@ int ClientTraitsHandler::sendChangedTraitsToMixer() { if (initialSend || *simpleIt == Updated) { if (traitType == AvatarTraits::SkeletonModelURL) { + bytesWritten += _owningAvatar->packTrait(traitType, *traitsPacketList); + // keep track of our skeleton version in case we get an override back _currentSkeletonVersion = _currentTraitVersion; } - bytesWritten += _owningAvatar->packTrait(traitType, *traitsPacketList); } ++simpleIt; diff --git a/libraries/baking/src/TextureBaker.cpp b/libraries/baking/src/TextureBaker.cpp index 2516323c37..6407ce1846 100644 --- a/libraries/baking/src/TextureBaker.cpp +++ b/libraries/baking/src/TextureBaker.cpp @@ -154,7 +154,7 @@ void TextureBaker::processTexture() { gpu::BackendTarget::GLES32 }}; for (auto target : BACKEND_TARGETS) { - auto processedTexture = image::processImage(buffer, _textureURL.toString().toStdString(), + auto processedTexture = image::processImage(buffer, _textureURL.toString().toStdString(), image::ColorChannel::NONE, ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, true, target, _abortProcessing); if (!processedTexture) { @@ -197,7 +197,7 @@ void TextureBaker::processTexture() { // Uncompressed KTX if (_textureType == image::TextureUsage::Type::CUBE_TEXTURE) { buffer->reset(); - auto processedTexture = image::processImage(std::move(buffer), _textureURL.toString().toStdString(), + auto processedTexture = image::processImage(std::move(buffer), _textureURL.toString().toStdString(), image::ColorChannel::NONE, ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, false, gpu::BackendTarget::GL45, _abortProcessing); if (!processedTexture) { handleError("Could not process texture " + _textureURL.toString()); diff --git a/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h b/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h index 5bc7357dd7..845e19f6c3 100644 --- a/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h +++ b/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h @@ -57,6 +57,7 @@ class UserInputMapper; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ /**jsdoc diff --git a/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h b/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h index 804709ebfa..eb610af78a 100644 --- a/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h +++ b/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h @@ -39,6 +39,7 @@ class ScriptingInterface; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ // TODO migrate functionality to a RouteBuilder class and make the proxy defer to that diff --git a/libraries/display-plugins/src/display-plugins/CompositorHelper.h b/libraries/display-plugins/src/display-plugins/CompositorHelper.h index e25d30109f..9c7d01082c 100644 --- a/libraries/display-plugins/src/display-plugins/CompositorHelper.h +++ b/libraries/display-plugins/src/display-plugins/CompositorHelper.h @@ -178,6 +178,7 @@ private: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {boolean} allowMouseCapture * @property {number} depth diff --git a/libraries/display-plugins/src/display-plugins/DisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/DisplayPlugin.cpp index da226d146b..69590aae82 100644 --- a/libraries/display-plugins/src/display-plugins/DisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/DisplayPlugin.cpp @@ -20,6 +20,7 @@ const QString& DisplayPlugin::MENU_PATH() { return value; } +#if !defined(CUSTOM_DISPLAY_PLUGINS) // TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class DisplayPluginList getDisplayPlugins() { DisplayPlugin* PLUGIN_POOL[] = { @@ -49,3 +50,4 @@ DisplayPluginList getDisplayPlugins() { } return result; } +#endif \ No newline at end of file diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 6c59dbd861..e4deaf8f4b 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -720,6 +720,8 @@ void OpenGLDisplayPlugin::present() { } gpu::Backend::freeGPUMemSize.set(gpu::gl::getFreeDedicatedMemory()); + } else { + internalPresent(); } _movingAveragePresent.addSample((float)(usecTimestampNow() - startPresent)); } diff --git a/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp index 9eafe381ab..b4527ff90c 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp @@ -51,15 +51,15 @@ bool DebugHmdDisplayPlugin::internalActivate() { }, true, _isAutoRotateEnabled); _ipd = 0.0327499993f * 2.0f; - // Would be nice to know why the left and right projection matrices are slightly dissymetrical - _eyeProjections[0][0] = vec4{ 0.759056330, 0.000000000, 0.000000000, 0.000000000 }; - _eyeProjections[0][1] = vec4{ 0.000000000, 0.682773232, 0.000000000, 0.000000000 }; - _eyeProjections[0][2] = vec4{ -0.0580431037, -0.00619550655, -1.00000489, -1.00000000 }; - _eyeProjections[0][3] = vec4{ 0.000000000, 0.000000000, -0.0800003856, 0.000000000 }; - _eyeProjections[1][0] = vec4{ 0.752847493, 0.000000000, 0.000000000, 0.000000000 }; - _eyeProjections[1][1] = vec4{ 0.000000000, 0.678060353, 0.000000000, 0.000000000 }; - _eyeProjections[1][2] = vec4{ 0.0578232110, -0.00669418881, -1.00000489, -1.000000000 }; - _eyeProjections[1][3] = vec4{ 0.000000000, 0.000000000, -0.0800003856, 0.000000000 }; + // Quest + _eyeProjections[0][0] = vec4{ 0.91729, 0.0, -0.17407, 0.0 }; + _eyeProjections[0][1] = vec4{ 0.0, 0.083354, -0.106141, 0.0 }; + _eyeProjections[0][2] = vec4{ 0.0, 0.0, -1.0, -0.2 }; + _eyeProjections[0][3] = vec4{ 0.0, 0.0, -1.0, 0.0 }; + _eyeProjections[1][0] = vec4{ 0.91729, 0.0, 0.17407, 0.0 }; + _eyeProjections[1][1] = vec4{ 0.0, 0.083354, -0.106141, 0.0 }; + _eyeProjections[1][2] = vec4{ 0.0, 0.0, -1.0, -0.2 }; + _eyeProjections[1][3] = vec4{ 0.0, 0.0, -1.0, 0.0 }; // No need to do so here as this will done in Parent::internalActivate //_eyeInverseProjections[0] = glm::inverse(_eyeProjections[0]); //_eyeInverseProjections[1] = glm::inverse(_eyeProjections[1]); diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h index 4aeacbe05c..d8c0ce8e1d 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h @@ -81,7 +81,6 @@ protected: mat4 presentPose; double sensorSampleTime { 0 }; double predictedDisplayTime { 0 }; - mat3 presentReprojection; }; QMap _frameInfos; diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 0e96cb2d25..7950025ff1 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -109,6 +109,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp index d6de3d4b25..82a4361723 100755 --- a/libraries/fbx/src/GLTFSerializer.cpp +++ b/libraries/fbx/src/GLTFSerializer.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "FBXSerializer.h" @@ -1146,8 +1147,10 @@ void GLTFSerializer::setHFMMaterial(HFMMaterial& fbxmat, const GLTFMaterial& mat } if (material.pbrMetallicRoughness.defined["metallicRoughnessTexture"]) { fbxmat.roughnessTexture = getHFMTexture(_file.textures[material.pbrMetallicRoughness.metallicRoughnessTexture]); + fbxmat.roughnessTexture.sourceChannel = image::ColorChannel::GREEN; fbxmat.useRoughnessMap = true; fbxmat.metallicTexture = getHFMTexture(_file.textures[material.pbrMetallicRoughness.metallicRoughnessTexture]); + fbxmat.metallicTexture.sourceChannel = image::ColorChannel::BLUE; fbxmat.useMetallicMap = true; } if (material.pbrMetallicRoughness.defined["roughnessFactor"]) { diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp index 1cf331cd1a..fef458f536 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp @@ -418,6 +418,10 @@ public: #endif }; +#if defined(GPU_STEREO_DRAWCALL_INSTANCED) && !defined(GL_CLIP_DISTANCE0) +#define GL_CLIP_DISTANCE0 GL_CLIP_DISTANCE0_EXT +#endif + #define GL_PROFILE_RANGE(category, name) \ PROFILE_RANGE(category, name); \ GlDuration glProfileRangeThis(name); diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h index 671d4e11d7..ffd0466b79 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h @@ -32,7 +32,7 @@ // Different versions for the stereo drawcall // Current preferred is "instanced" which draw the shape twice but instanced and rely on clipping plane to draw left/right side only -#if defined(USE_GLES) +#if defined(USE_GLES) && !defined(HAVE_EXT_clip_cull_distance) #define GPU_STEREO_TECHNIQUE_DOUBLED_SIMPLE #else //#define GPU_STEREO_TECHNIQUE_DOUBLED_SMARTER diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLTexture.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLTexture.cpp index e9494a1271..082edd47bc 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLTexture.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLTexture.cpp @@ -60,9 +60,17 @@ GLenum GLTexture::getGLTextureType(const Texture& texture) { switch (texture.getType()) { case Texture::TEX_2D: if (!texture.isArray()) { - return GL_TEXTURE_2D; + if (!texture.isMultisample()) { + return GL_TEXTURE_2D; + } else { + return GL_TEXTURE_2D_MULTISAMPLE; + } } else { - return GL_TEXTURE_2D_ARRAY; + if (!texture.isMultisample()) { + return GL_TEXTURE_2D_ARRAY; + } else { + return GL_TEXTURE_2D_MULTISAMPLE_ARRAY; + } } break; @@ -81,7 +89,9 @@ GLenum GLTexture::getGLTextureType(const Texture& texture) { uint8_t GLTexture::getFaceCount(GLenum target) { switch (target) { case GL_TEXTURE_2D: + case GL_TEXTURE_2D_MULTISAMPLE: case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: return TEXTURE_2D_NUM_FACES; case GL_TEXTURE_CUBE_MAP: return TEXTURE_CUBE_NUM_FACES; @@ -96,15 +106,20 @@ const std::vector& GLTexture::getFaceTargets(GLenum target) { GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z }; - static const std::vector faceTargets { + static const std::vector face2DTargets { GL_TEXTURE_2D }; - static const std::vector arrayFaceTargets{ + static const std::vector face2DMSTargets{ + GL_TEXTURE_2D_MULTISAMPLE + }; + static const std::vector arrayFaceTargets{ GL_TEXTURE_2D_ARRAY }; switch (target) { case GL_TEXTURE_2D: - return faceTargets; + return face2DTargets; + case GL_TEXTURE_2D_MULTISAMPLE: + return face2DMSTargets; case GL_TEXTURE_2D_ARRAY: return arrayFaceTargets; case GL_TEXTURE_CUBE_MAP: @@ -114,7 +129,7 @@ const std::vector& GLTexture::getFaceTargets(GLenum target) { break; } Q_UNREACHABLE(); - return faceTargets; + return face2DTargets; } GLTexture::GLTexture(const std::weak_ptr& backend, const Texture& texture, GLuint id) : diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp index 1d512103bd..0f50b0724e 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp @@ -66,6 +66,8 @@ public: if (gltexture) { if (gltexture->_target == GL_TEXTURE_2D) { glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0); + } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D_MULTISAMPLE, gltexture->_texture, 0); } else { glFramebufferTextureLayer(GL_FRAMEBUFFER, colorAttachments[unit], gltexture->_texture, 0, b._subresource); @@ -98,6 +100,8 @@ public: if (gltexture) { if (gltexture->_target == GL_TEXTURE_2D) { glFramebufferTexture2D(GL_FRAMEBUFFER, attachement, GL_TEXTURE_2D, gltexture->_texture, 0); + } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glFramebufferTexture2D(GL_FRAMEBUFFER, attachement, GL_TEXTURE_2D_MULTISAMPLE, gltexture->_texture, 0); } else { glFramebufferTextureLayer(GL_FRAMEBUFFER, attachement, gltexture->_texture, 0, _gpuObject.getDepthStencilBufferSubresource()); diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index 4068865274..f47211555a 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -216,19 +216,29 @@ void GL41FixedAllocationTexture::allocateStorage() const { const GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat()); const auto numMips = _gpuObject.getNumMips(); const auto numSlices = _gpuObject.getNumSlices(); + const auto numSamples = _gpuObject.getNumSamples(); // glTextureStorage2D(_id, mips, texelFormat.internalFormat, dimensions.x, dimensions.y); - for (GLint level = 0; level < numMips; level++) { - Vec3u dimensions = _gpuObject.evalMipDimensions(level); - for (GLenum target : getFaceTargets(_target)) { - if (!_gpuObject.isArray()) { - glTexImage2D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, texelFormat.format, - texelFormat.type, nullptr); - } else { - glTexImage3D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, 0, - texelFormat.format, texelFormat.type, nullptr); + if (!_gpuObject.isMultisample()) { + for (GLint level = 0; level < numMips; level++) { + Vec3u dimensions = _gpuObject.evalMipDimensions(level); + for (GLenum target : getFaceTargets(_target)) { + if (!_gpuObject.isArray()) { + glTexImage2D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, texelFormat.format, + texelFormat.type, nullptr); + } else { + glTexImage3D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, 0, + texelFormat.format, texelFormat.type, nullptr); + } } } + } else { + const auto dimensions = _gpuObject.getDimensions(); + if (!_gpuObject.isArray()) { + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, numSamples, texelFormat.internalFormat, dimensions.x, dimensions.y, GL_FALSE); + } else { + glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, numSamples, texelFormat.internalFormat, dimensions.x, dimensions.y, dimensions.z, GL_FALSE); + } } glTexParameteri(_target, GL_TEXTURE_BASE_LEVEL, 0); diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp index 86332558e3..7a299e792b 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp @@ -62,6 +62,8 @@ public: if (gltexture) { if (gltexture->_target == GL_TEXTURE_2D) { glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); + } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); } else { glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0, b._subresource); } @@ -93,6 +95,9 @@ public: if (gltexture) { if (gltexture->_target == GL_TEXTURE_2D) { glNamedFramebufferTexture(_id, attachement, gltexture->_texture, 0); + } + else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glNamedFramebufferTexture(_id, attachement, gltexture->_texture, 0); } else { glNamedFramebufferTextureLayer(_id, attachement, gltexture->_texture, 0, _gpuObject.getDepthStencilBufferSubresource()); diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index a8b5ec85e8..4aff76df21 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -380,11 +380,22 @@ void GL45FixedAllocationTexture::allocateStorage() const { const auto dimensions = _gpuObject.getDimensions(); const auto mips = _gpuObject.getNumMips(); const auto numSlices = _gpuObject.getNumSlices(); + const auto numSamples = _gpuObject.getNumSamples(); - if (!_gpuObject.isArray()) { - glTextureStorage2D(_id, mips, texelFormat.internalFormat, dimensions.x, dimensions.y); + + if (!_gpuObject.isMultisample()) { + if (!_gpuObject.isArray()) { + glTextureStorage2D(_id, mips, texelFormat.internalFormat, dimensions.x, dimensions.y); + } else { + glTextureStorage3D(_id, mips, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices); + } } else { - glTextureStorage3D(_id, mips, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices); + if (!_gpuObject.isArray()) { + glTextureStorage2DMultisample(_id, numSamples, texelFormat.internalFormat, dimensions.x, dimensions.y, GL_FALSE); + } + else { + glTextureStorage3DMultisample(_id, numSamples, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, GL_FALSE); + } } glTextureParameteri(_id, GL_TEXTURE_BASE_LEVEL, 0); diff --git a/libraries/gpu-gles/src/gpu/gles/GLESBackendOutput.cpp b/libraries/gpu-gles/src/gpu/gles/GLESBackendOutput.cpp index 90ce8c853a..36b37083cb 100644 --- a/libraries/gpu-gles/src/gpu/gles/GLESBackendOutput.cpp +++ b/libraries/gpu-gles/src/gpu/gles/GLESBackendOutput.cpp @@ -130,6 +130,8 @@ public: } #endif + } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D_MULTISAMPLE, gltexture->_texture, 0); } else { glFramebufferTextureLayer(GL_FRAMEBUFFER, colorAttachments[unit], gltexture->_texture, 0, b._subresource); @@ -162,6 +164,8 @@ public: if (gltexture) { if (gltexture->_target == GL_TEXTURE_2D) { glFramebufferTexture2D(GL_FRAMEBUFFER, attachement, GL_TEXTURE_2D, gltexture->_texture, 0); + } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glFramebufferTexture2D(GL_FRAMEBUFFER, attachement, GL_TEXTURE_2D_MULTISAMPLE, gltexture->_texture, 0); } else { glFramebufferTextureLayer(GL_FRAMEBUFFER, attachement, gltexture->_texture, 0, _gpuObject.getDepthStencilBufferSubresource()); diff --git a/libraries/gpu-gles/src/gpu/gles/GLESBackendTexture.cpp b/libraries/gpu-gles/src/gpu/gles/GLESBackendTexture.cpp index 23dc271af9..4b2d4d09e6 100644 --- a/libraries/gpu-gles/src/gpu/gles/GLESBackendTexture.cpp +++ b/libraries/gpu-gles/src/gpu/gles/GLESBackendTexture.cpp @@ -272,28 +272,40 @@ void GLESFixedAllocationTexture::allocateStorage() const { const GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat()); const auto numMips = _gpuObject.getNumMips(); const auto numSlices = _gpuObject.getNumSlices(); + const auto numSamples = _gpuObject.getNumSamples(); // glTextureStorage2D(_id, mips, texelFormat.internalFormat, dimensions.x, dimensions.y); - for (GLint level = 0; level < numMips; level++) { - Vec3u dimensions = _gpuObject.evalMipDimensions(level); - for (GLenum target : getFaceTargets(_target)) { - if (texelFormat.isCompressed()) { - auto size = getCompressedImageSize(dimensions.x, dimensions.y, texelFormat.internalFormat); - if (!_gpuObject.isArray()) { - glCompressedTexImage2D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, size, nullptr); + if (!_gpuObject.isMultisample()) { + for (GLint level = 0; level < numMips; level++) { + Vec3u dimensions = _gpuObject.evalMipDimensions(level); + for (GLenum target : getFaceTargets(_target)) { + if (texelFormat.isCompressed()) { + auto size = getCompressedImageSize(dimensions.x, dimensions.y, texelFormat.internalFormat); + if (!_gpuObject.isArray()) { + glCompressedTexImage2D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, size, nullptr); + } else { + glCompressedTexImage3D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, 0, size * numSlices, nullptr); + } } else { - glCompressedTexImage3D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, 0, size * numSlices, nullptr); - } - } else { - if (!_gpuObject.isArray()) { - glTexImage2D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, texelFormat.format, - texelFormat.type, nullptr); - } else { - glTexImage3D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, 0, - texelFormat.format, texelFormat.type, nullptr); + if (!_gpuObject.isArray()) { + glTexImage2D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, 0, texelFormat.format, + texelFormat.type, nullptr); + } else { + glTexImage3D(target, level, texelFormat.internalFormat, dimensions.x, dimensions.y, numSlices, 0, + texelFormat.format, texelFormat.type, nullptr); + } } } } + } else { + const auto dimensions = _gpuObject.getDimensions(); + if (!_gpuObject.isArray()) { + glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, numSamples, + texelFormat.internalFormat, dimensions.x, dimensions.y, + GL_FALSE); + } else { + // NOT SUPPORTED (yet) + } } glTexParameteri(_target, GL_TEXTURE_BASE_LEVEL, 0); diff --git a/libraries/gpu/src/gpu/Texture.cpp b/libraries/gpu/src/gpu/Texture.cpp index c6f3cd9b9a..5c2e181810 100755 --- a/libraries/gpu/src/gpu/Texture.cpp +++ b/libraries/gpu/src/gpu/Texture.cpp @@ -176,10 +176,18 @@ TexturePointer Texture::createRenderBuffer(const Element& texelFormat, uint16 wi return create(TextureUsageType::RENDERBUFFER, TEX_2D, texelFormat, width, height, 1, 1, 0, numMips, sampler); } +TexturePointer Texture::createRenderBufferMultisample(const Element& texelFormat, uint16 width, uint16 height, uint16 numSamples, const Sampler& sampler) { + return create(TextureUsageType::RENDERBUFFER, TEX_2D, texelFormat, width, height, 1, numSamples, 0, gpu::Texture::SINGLE_MIP, sampler); +} + TexturePointer Texture::createRenderBufferArray(const Element& texelFormat, uint16 width, uint16 height, uint16 numSlices, uint16 numMips, const Sampler& sampler) { return create(TextureUsageType::RENDERBUFFER, TEX_2D, texelFormat, width, height, 1, 1, numSlices, numMips, sampler); } +TexturePointer Texture::createRenderBufferMultisampleArray(const Element& texelFormat, uint16 width, uint16 height, uint16 numSlices, uint16 numSamples, const Sampler& sampler) { + return create(TextureUsageType::RENDERBUFFER, TEX_2D, texelFormat, width, height, 1, numSamples, numSlices, gpu::Texture::SINGLE_MIP, sampler); +} + TexturePointer Texture::create1D(const Element& texelFormat, uint16 width, uint16 numMips, const Sampler& sampler) { return create(TextureUsageType::RESOURCE, TEX_1D, texelFormat, width, 1, 1, 1, 0, numMips, sampler); } diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 23bfff6873..d410671481 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -387,7 +387,9 @@ public: static TexturePointer create3D(const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numMips = SINGLE_MIP, const Sampler& sampler = Sampler()); static TexturePointer createCube(const Element& texelFormat, uint16 width, uint16 numMips = 1, const Sampler& sampler = Sampler()); static TexturePointer createRenderBuffer(const Element& texelFormat, uint16 width, uint16 height, uint16 numMips = SINGLE_MIP, const Sampler& sampler = Sampler()); + static TexturePointer createRenderBufferMultisample(const Element& texelFormat, uint16 width, uint16 height, uint16 numSamples, const Sampler& sampler = Sampler()); static TexturePointer createRenderBufferArray(const Element& texelFormat, uint16 width, uint16 height, uint16 numSlices, uint16 numMips = SINGLE_MIP, const Sampler& sampler = Sampler()); + static TexturePointer createRenderBufferMultisampleArray(const Element& texelFormat, uint16 width, uint16 height, uint16 numSlices, uint16 numSamples, const Sampler& sampler = Sampler()); static TexturePointer createStrict(const Element& texelFormat, uint16 width, uint16 height, uint16 numMips = SINGLE_MIP, const Sampler& sampler = Sampler()); static TexturePointer createExternal(const ExternalRecycler& recycler, const Sampler& sampler = Sampler()); @@ -435,6 +437,7 @@ public: uint16 getNumSamples() const { return _numSamples; } // NumSamples can only have certain values based on the hw static uint16 evalNumSamplesUsed(uint16 numSamplesTried); + bool isMultisample() const { return _numSamples > 1; } // max mip is in the range [ 0 if no sub mips, log2(max(width, height, depth))] // It is defined at creation time (immutable) diff --git a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.h b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.h index 1ec60c4244..163e317ffa 100644 --- a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.h +++ b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.h @@ -27,6 +27,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class GraphicsScriptingInterface : public QObject, public QScriptable, public Dependency { diff --git a/libraries/hfm/CMakeLists.txt b/libraries/hfm/CMakeLists.txt index 553fd935d9..be3d866b70 100644 --- a/libraries/hfm/CMakeLists.txt +++ b/libraries/hfm/CMakeLists.txt @@ -5,3 +5,4 @@ link_hifi_libraries(shared) include_hifi_library_headers(gpu) include_hifi_library_headers(graphics) +include_hifi_library_headers(image) diff --git a/libraries/hfm/src/hfm/HFM.h b/libraries/hfm/src/hfm/HFM.h index cccfaa3f7d..577ca6f413 100644 --- a/libraries/hfm/src/hfm/HFM.h +++ b/libraries/hfm/src/hfm/HFM.h @@ -25,6 +25,8 @@ #include #include +#include + #if defined(Q_OS_ANDROID) #define HFM_PACK_NORMALS 0 #else @@ -123,6 +125,7 @@ public: QString name; QByteArray filename; QByteArray content; + image::ColorChannel sourceChannel { image::ColorChannel::NONE }; Transform transform; int maxNumPixels { MAX_NUM_PIXELS_FOR_FBX_TEXTURE }; diff --git a/libraries/image/src/image/ColorChannel.h b/libraries/image/src/image/ColorChannel.h new file mode 100644 index 0000000000..e1d107018b --- /dev/null +++ b/libraries/image/src/image/ColorChannel.h @@ -0,0 +1,26 @@ +// +// ColorChannel.h +// libraries/image/src/image +// +// Created by Sabrina Shanman on 2019/02/12. +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_image_ColorChannel_h +#define hifi_image_ColorChannel_h + +namespace image { + enum class ColorChannel { + NONE, + RED, + GREEN, + BLUE, + ALPHA, + COUNT + }; +}; + +#endif // hifi_image_ColorChannel_h diff --git a/libraries/image/src/image/Image.cpp b/libraries/image/src/image/Image.cpp index ac2813667f..a2161caec9 100644 --- a/libraries/image/src/image/Image.cpp +++ b/libraries/image/src/image/Image.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -221,7 +222,45 @@ QImage processRawImageData(QIODevice& content, const std::string& filename) { return QImage(); } -gpu::TexturePointer processImage(std::shared_ptr content, const std::string& filename, +void mapToRedChannel(QImage& image, ColorChannel sourceChannel) { + // Change format of image so we know exactly how to process it + if (image.format() != QImage::Format_ARGB32) { + image = image.convertToFormat(QImage::Format_ARGB32); + } + + for (int i = 0; i < image.height(); i++) { + QRgb* pixel = reinterpret_cast(image.scanLine(i)); + // Past end pointer + QRgb* lineEnd = pixel + image.width(); + + // Transfer channel data from source to target + for (; pixel < lineEnd; pixel++) { + int colorValue; + switch (sourceChannel) { + case ColorChannel::RED: + colorValue = qRed(*pixel); + break; + case ColorChannel::GREEN: + colorValue = qGreen(*pixel); + break; + case ColorChannel::BLUE: + colorValue = qBlue(*pixel); + break; + case ColorChannel::ALPHA: + colorValue = qAlpha(*pixel); + break; + default: + colorValue = qRed(*pixel); + break; + } + + // Dump the color in the red channel, ignore the rest + *pixel = qRgba(colorValue, 0, 0, 255); + } + } +} + +gpu::TexturePointer processImage(std::shared_ptr content, const std::string& filename, ColorChannel sourceChannel, int maxNumPixels, TextureUsage::Type textureType, bool compress, BackendTarget target, const std::atomic& abortProcessing) { @@ -252,6 +291,11 @@ gpu::TexturePointer processImage(std::shared_ptr content, const std:: QSize(originalWidth, originalHeight) << " to " << QSize(imageWidth, imageHeight) << ")"; } + + // Re-map to image with single red channel texture if requested + if (sourceChannel != ColorChannel::NONE) { + mapToRedChannel(image, sourceChannel); + } auto loader = TextureUsage::getTextureLoaderForType(textureType); auto texture = loader(std::move(image), filename, compress, target, abortProcessing); diff --git a/libraries/image/src/image/Image.h b/libraries/image/src/image/Image.h index ae72a183b3..40c31eeeff 100644 --- a/libraries/image/src/image/Image.h +++ b/libraries/image/src/image/Image.h @@ -16,6 +16,8 @@ #include +#include "ColorChannel.h" + class QByteArray; class QImage; @@ -81,7 +83,7 @@ gpu::TexturePointer processCubeTextureColorFromImage(QImage&& srcImage, const st const QStringList getSupportedFormats(); -gpu::TexturePointer processImage(std::shared_ptr content, const std::string& url, +gpu::TexturePointer processImage(std::shared_ptr content, const std::string& url, ColorChannel sourceChannel, int maxNumPixels, TextureUsage::Type textureType, bool compress, gpu::BackendTarget target, const std::atomic& abortProcessing = false); diff --git a/libraries/input-plugins/src/input-plugins/InputPlugin.cpp b/libraries/input-plugins/src/input-plugins/InputPlugin.cpp index 6f94e7592c..c18c4cde65 100644 --- a/libraries/input-plugins/src/input-plugins/InputPlugin.cpp +++ b/libraries/input-plugins/src/input-plugins/InputPlugin.cpp @@ -16,6 +16,7 @@ #include "TouchscreenDevice.h" #include "TouchscreenVirtualPadDevice.h" +#if !defined(CUSTOM_INPUT_PLUGINS) // TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class InputPluginList getInputPlugins() { InputPlugin* PLUGIN_POOL[] = { @@ -37,6 +38,7 @@ InputPluginList getInputPlugins() { } return result; } +#endif void saveInputPluginSettings(const InputPluginList& plugins) { foreach (auto inputPlugin, plugins) { diff --git a/libraries/material-networking/src/material-networking/MaterialCache.cpp b/libraries/material-networking/src/material-networking/MaterialCache.cpp index 1b5ba6f0f6..6561fc697e 100644 --- a/libraries/material-networking/src/material-networking/MaterialCache.cpp +++ b/libraries/material-networking/src/material-networking/MaterialCache.cpp @@ -471,7 +471,7 @@ graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl } const auto url = getTextureUrl(baseUrl, hfmTexture); - const auto texture = DependencyManager::get()->getTexture(url, type, hfmTexture.content, hfmTexture.maxNumPixels); + const auto texture = DependencyManager::get()->getTexture(url, type, hfmTexture.content, hfmTexture.maxNumPixels, hfmTexture.sourceChannel); _textures[channel] = Texture { hfmTexture.name, texture }; auto map = std::make_shared(); diff --git a/libraries/material-networking/src/material-networking/TextureCache.cpp b/libraries/material-networking/src/material-networking/TextureCache.cpp index 95cf7dfd90..72dcc7c863 100644 --- a/libraries/material-networking/src/material-networking/TextureCache.cpp +++ b/libraries/material-networking/src/material-networking/TextureCache.cpp @@ -192,6 +192,7 @@ public: image::TextureUsage::Type type; const QByteArray& content; int maxNumPixels; + image::ColorChannel sourceChannel; }; namespace std { @@ -206,19 +207,19 @@ namespace std { struct hash { size_t operator()(const TextureExtra& textureExtra) const { size_t result = 0; - hash_combine(result, (int)textureExtra.type, textureExtra.content, textureExtra.maxNumPixels); + hash_combine(result, (int)textureExtra.type, textureExtra.content, textureExtra.maxNumPixels, (int)textureExtra.sourceChannel); return result; } }; } -ScriptableResource* TextureCache::prefetch(const QUrl& url, int type, int maxNumPixels) { +ScriptableResource* TextureCache::prefetch(const QUrl& url, int type, int maxNumPixels, image::ColorChannel sourceChannel) { auto byteArray = QByteArray(); - TextureExtra extra = { (image::TextureUsage::Type)type, byteArray, maxNumPixels }; + TextureExtra extra = { (image::TextureUsage::Type)type, byteArray, maxNumPixels, sourceChannel }; return ResourceCache::prefetch(url, &extra, std::hash()(extra)); } -NetworkTexturePointer TextureCache::getTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels) { +NetworkTexturePointer TextureCache::getTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels, image::ColorChannel sourceChannel) { if (url.scheme() == RESOURCE_SCHEME) { return getResourceTexture(url); } @@ -228,7 +229,7 @@ NetworkTexturePointer TextureCache::getTexture(const QUrl& url, image::TextureUs query.addQueryItem("skybox", ""); modifiedUrl.setQuery(query.toString()); } - TextureExtra extra = { type, content, maxNumPixels }; + TextureExtra extra = { type, content, maxNumPixels, sourceChannel }; return ResourceCache::getResource(modifiedUrl, QUrl(), &extra, std::hash()(extra)).staticCast(); } @@ -345,6 +346,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, bool resourceTexture) : NetworkTexture::NetworkTexture(const NetworkTexture& other) : Resource(other), _type(other._type), + _sourceChannel(other._sourceChannel), _currentlyLoadingResourceType(other._currentlyLoadingResourceType), _originalWidth(other._originalWidth), _originalHeight(other._originalHeight), @@ -352,6 +354,11 @@ NetworkTexture::NetworkTexture(const NetworkTexture& other) : _height(other._height), _maxNumPixels(other._maxNumPixels) { + if (_width == 0 || _height == 0 || + other._currentlyLoadingResourceType == ResourceType::META || + (other._currentlyLoadingResourceType == ResourceType::KTX && other._ktxResourceState != KTXResourceState::WAITING_FOR_MIP_REQUEST)) { + _startedLoading = false; + } } static bool isLocalUrl(const QUrl& url) { @@ -363,6 +370,7 @@ void NetworkTexture::setExtra(void* extra) { const TextureExtra* textureExtra = static_cast(extra); _type = textureExtra ? textureExtra->type : image::TextureUsage::DEFAULT_TEXTURE; _maxNumPixels = textureExtra ? textureExtra->maxNumPixels : ABSOLUTE_MAX_TEXTURE_NUM_PIXELS; + _sourceChannel = textureExtra ? textureExtra->sourceChannel : image::ColorChannel::NONE; _textureSource = std::make_shared(_url, (int)_type); _lowestRequestedMipLevel = 0; @@ -424,7 +432,8 @@ gpu::TexturePointer NetworkTexture::getFallbackTexture() const { class ImageReader : public QRunnable { public: ImageReader(const QWeakPointer& resource, const QUrl& url, - const QByteArray& data, size_t extraHash, int maxNumPixels); + const QByteArray& data, size_t extraHash, int maxNumPixels, + image::ColorChannel sourceChannel); void run() override final; void read(); @@ -436,6 +445,7 @@ private: QByteArray _content; size_t _extraHash; int _maxNumPixels; + image::ColorChannel _sourceChannel; }; NetworkTexture::~NetworkTexture() { @@ -1068,7 +1078,7 @@ void NetworkTexture::loadTextureContent(const QByteArray& content) { return; } - QThreadPool::globalInstance()->start(new ImageReader(_self, _url, content, _extraHash, _maxNumPixels)); + QThreadPool::globalInstance()->start(new ImageReader(_self, _url, content, _extraHash, _maxNumPixels, _sourceChannel)); } void NetworkTexture::refresh() { @@ -1093,12 +1103,13 @@ void NetworkTexture::refresh() { Resource::refresh(); } -ImageReader::ImageReader(const QWeakPointer& resource, const QUrl& url, const QByteArray& data, size_t extraHash, int maxNumPixels) : +ImageReader::ImageReader(const QWeakPointer& resource, const QUrl& url, const QByteArray& data, size_t extraHash, int maxNumPixels, image::ColorChannel sourceChannel) : _resource(resource), _url(url), _content(data), _extraHash(extraHash), - _maxNumPixels(maxNumPixels) + _maxNumPixels(maxNumPixels), + _sourceChannel(sourceChannel) { DependencyManager::get()->incrementStat("PendingProcessing"); listSupportedImageFormats(); @@ -1206,7 +1217,7 @@ void ImageReader::read() { constexpr bool shouldCompress = false; #endif auto target = getBackendTarget(); - texture = image::processImage(std::move(buffer), _url.toString().toStdString(), _maxNumPixels, networkTexture->getTextureType(), shouldCompress, target); + texture = image::processImage(std::move(buffer), _url.toString().toStdString(), _sourceChannel, _maxNumPixels, networkTexture->getTextureType(), shouldCompress, target); if (!texture) { QMetaObject::invokeMethod(resource.data(), "setImage", diff --git a/libraries/material-networking/src/material-networking/TextureCache.h b/libraries/material-networking/src/material-networking/TextureCache.h index cdedc64ea5..acca916acc 100644 --- a/libraries/material-networking/src/material-networking/TextureCache.h +++ b/libraries/material-networking/src/material-networking/TextureCache.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,7 @@ private: friend class ImageReader; image::TextureUsage::Type _type; + image::ColorChannel _sourceChannel; enum class ResourceType { META, @@ -178,7 +180,8 @@ public: /// Loads a texture from the specified URL. NetworkTexturePointer getTexture(const QUrl& url, image::TextureUsage::Type type = image::TextureUsage::DEFAULT_TEXTURE, - const QByteArray& content = QByteArray(), int maxNumPixels = ABSOLUTE_MAX_TEXTURE_NUM_PIXELS); + const QByteArray& content = QByteArray(), int maxNumPixels = ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, + image::ColorChannel sourceChannel = image::ColorChannel::NONE); gpu::TexturePointer getTextureByHash(const std::string& hash); gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture); @@ -201,7 +204,7 @@ signals: protected: // Overload ResourceCache::prefetch to allow specifying texture type for loads - Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url, int type, int maxNumPixels = ABSOLUTE_MAX_TEXTURE_NUM_PIXELS); + Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url, int type, int maxNumPixels = ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, image::ColorChannel sourceChannel = image::ColorChannel::NONE); virtual QSharedPointer createResource(const QUrl& url) override; QSharedPointer createResourceCopy(const QSharedPointer& resource) override; diff --git a/libraries/material-networking/src/material-networking/TextureCacheScriptingInterface.h b/libraries/material-networking/src/material-networking/TextureCacheScriptingInterface.h index 4120840759..1cc4f4f948 100644 --- a/libraries/material-networking/src/material-networking/TextureCacheScriptingInterface.h +++ b/libraries/material-networking/src/material-networking/TextureCacheScriptingInterface.h @@ -30,6 +30,7 @@ class TextureCacheScriptingInterface : public ScriptableResourceCache, public De * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} numTotal - Total number of total resources. Read-only. * @property {number} numCached - Total number of cached resource. Read-only. diff --git a/libraries/midi/src/Midi.h b/libraries/midi/src/Midi.h index e5c44c6b7e..081a44f7b6 100644 --- a/libraries/midi/src/Midi.h +++ b/libraries/midi/src/Midi.h @@ -25,6 +25,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class Midi : public QObject, public Dependency { diff --git a/libraries/model-networking/src/model-networking/ModelCacheScriptingInterface.h b/libraries/model-networking/src/model-networking/ModelCacheScriptingInterface.h index 5ac7ac1e50..16532fafc3 100644 --- a/libraries/model-networking/src/model-networking/ModelCacheScriptingInterface.h +++ b/libraries/model-networking/src/model-networking/ModelCacheScriptingInterface.h @@ -30,6 +30,7 @@ class ModelCacheScriptingInterface : public ScriptableResourceCache, public Depe * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} numTotal - Total number of total resources. Read-only. * @property {number} numCached - Total number of cached resource. Read-only. diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 450b71023c..3b95923634 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -43,6 +43,7 @@ const QString GET_PLACE = "/api/v1/places/%1"; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-assignment-client * * @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid|Uuid.NULL} if you're not diff --git a/libraries/networking/src/MessagesClient.h b/libraries/networking/src/MessagesClient.h index f2ccfe33f4..255487f0bb 100644 --- a/libraries/networking/src/MessagesClient.h +++ b/libraries/networking/src/MessagesClient.h @@ -40,6 +40,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client */ diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index 9ff8070768..3257ab034c 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -95,6 +95,7 @@ class ScriptableResource : public QObject { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/networking/src/ResourceScriptingInterface.h b/libraries/networking/src/ResourceScriptingInterface.h index cc3f12f990..5f81537e99 100644 --- a/libraries/networking/src/ResourceScriptingInterface.h +++ b/libraries/networking/src/ResourceScriptingInterface.h @@ -22,6 +22,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client */ diff --git a/libraries/oculusMobilePlugin/src/OculusMobileControllerManager.cpp b/libraries/oculusMobilePlugin/src/OculusMobileControllerManager.cpp index 8de563ee4c..705045b517 100644 --- a/libraries/oculusMobilePlugin/src/OculusMobileControllerManager.cpp +++ b/libraries/oculusMobilePlugin/src/OculusMobileControllerManager.cpp @@ -171,6 +171,8 @@ private: void handleHeadPose(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, const ovrRigidBodyPosef& headPose); + void reconnectTouchControllers(ovrMobile* session); + // perform an action when the TouchDevice mutex is acquired. using Locker = std::unique_lock; @@ -637,7 +639,6 @@ controller::Input::NamedVector OculusMobileInputDevice::getAvailableInputs() con makePair(RIGHT_THUMB_UP, "RightThumbUp"), makePair(LEFT_INDEX_POINT, "LeftIndexPoint"), makePair(RIGHT_INDEX_POINT, "RightIndexPoint"), - makePair(BACK, "LeftApplicationMenu"), makePair(START, "RightApplicationMenu"), }; @@ -665,8 +666,40 @@ OculusMobileInputDevice::OculusMobileInputDevice(ovrMobile* session, const std:: void OculusMobileInputDevice::updateHands(ovrMobile* session) { _headTracking = vrapi_GetPredictedTracking2(session, 0.0); + + bool touchControllerNotConnected = false; for (auto& hand : _hands) { hand.update(session); + + if (hand.stateResult < 0 || hand.trackingResult < 0) { + touchControllerNotConnected = true; + } + } + + if (touchControllerNotConnected) { + reconnectTouchControllers(session); + } +} + +void OculusMobileInputDevice::reconnectTouchControllers(ovrMobile* session) { + uint32_t deviceIndex { 0 }; + ovrInputCapabilityHeader capsHeader; + while (vrapi_EnumerateInputDevices(session, deviceIndex, &capsHeader) >= 0) { + if (capsHeader.Type == ovrControllerType_TrackedRemote) { + ovrInputTrackedRemoteCapabilities caps; + caps.Header = capsHeader; + vrapi_GetInputDeviceCapabilities(session, &caps.Header); + + if (caps.ControllerCapabilities & ovrControllerCaps_LeftHand || caps.ControllerCapabilities & ovrControllerCaps_RightHand) { + size_t handIndex = caps.ControllerCapabilities & ovrControllerCaps_LeftHand ? 0 : 1; + HandData& handData = _hands[handIndex]; + handData.state.Header.ControllerType = ovrControllerType_TrackedRemote; + handData.valid = true; + handData.caps = caps; + handData.update(session); + } + } + ++deviceIndex; } } @@ -691,4 +724,4 @@ InputPluginList getInputPlugins() { } } return result; -} \ No newline at end of file +} diff --git a/libraries/oculusMobilePlugin/src/OculusMobileDisplayPlugin.cpp b/libraries/oculusMobilePlugin/src/OculusMobileDisplayPlugin.cpp index 34ba130c71..78d80443d8 100644 --- a/libraries/oculusMobilePlugin/src/OculusMobileDisplayPlugin.cpp +++ b/libraries/oculusMobilePlugin/src/OculusMobileDisplayPlugin.cpp @@ -63,7 +63,7 @@ bool OculusMobileDisplayPlugin::internalActivate() { withOvrJava([&](const ovrJava* java){ _renderTargetSize = glm::uvec2{ - vrapi_GetSystemPropertyInt(java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_WIDTH), + 2 * vrapi_GetSystemPropertyInt(java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_WIDTH), vrapi_GetSystemPropertyInt(java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_HEIGHT), }; }); diff --git a/libraries/plugins/src/plugins/SteamClientPlugin.h b/libraries/plugins/src/plugins/SteamClientPlugin.h index fc1b85c572..2124d16b5e 100644 --- a/libraries/plugins/src/plugins/SteamClientPlugin.h +++ b/libraries/plugins/src/plugins/SteamClientPlugin.h @@ -45,6 +45,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {boolean} running - Read-only. */ diff --git a/libraries/pointers/src/Pick.h b/libraries/pointers/src/Pick.h index 857a72caa8..1a9d3fd32c 100644 --- a/libraries/pointers/src/Pick.h +++ b/libraries/pointers/src/Pick.h @@ -68,6 +68,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} Ray Ray picks intersect a ray with the nearest object in front of them, along a given direction. * @property {number} Stylus Stylus picks provide "tapping" functionality on/into flat surfaces. diff --git a/libraries/procedural/CMakeLists.txt b/libraries/procedural/CMakeLists.txt index 06d2a3d1ed..d08a7aef02 100644 --- a/libraries/procedural/CMakeLists.txt +++ b/libraries/procedural/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME procedural) setup_hifi_library() -link_hifi_libraries(shared gpu shaders networking graphics material-networking ktx image) +link_hifi_libraries(shared gpu shaders networking graphics material-networking ktx image) diff --git a/libraries/qml/src/qml/OffscreenSurface.cpp b/libraries/qml/src/qml/OffscreenSurface.cpp index abab5391e2..69e6c833ee 100644 --- a/libraries/qml/src/qml/OffscreenSurface.cpp +++ b/libraries/qml/src/qml/OffscreenSurface.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,21 @@ static QSize clampSize(const QSize& qsize, uint32_t maxDimension) { const QmlContextObjectCallback OffscreenSurface::DEFAULT_CONTEXT_OBJECT_CALLBACK = [](QQmlContext*, QQuickItem*) {}; const QmlContextCallback OffscreenSurface::DEFAULT_CONTEXT_CALLBACK = [](QQmlContext*) {}; +QQmlFileSelector* OffscreenSurface::getFileSelector() { + auto context = getSurfaceContext(); + if (!context) { + return nullptr; + } + auto engine = context->engine(); + if (!engine) { + return nullptr; + } + + return QQmlFileSelector::get(engine); +} + void OffscreenSurface::initializeEngine(QQmlEngine* engine) { + new QQmlFileSelector(engine); } using namespace hifi::qml::impl; diff --git a/libraries/qml/src/qml/OffscreenSurface.h b/libraries/qml/src/qml/OffscreenSurface.h index b3539e7709..18d24c93f7 100644 --- a/libraries/qml/src/qml/OffscreenSurface.h +++ b/libraries/qml/src/qml/OffscreenSurface.h @@ -30,6 +30,7 @@ class QQmlComponent; class QQuickWindow; class QQuickItem; class OffscreenQmlSharedObject; +class QQmlFileSelector; namespace hifi { namespace qml { @@ -72,6 +73,7 @@ public: QQuickWindow* getWindow(); QObject* getEventHandler(); QQmlContext* getSurfaceContext(); + QQmlFileSelector* getFileSelector(); // Checks to see if a new texture is available. If one is, the function returns true and // textureAndFence will be populated with the texture ID and a fence which will be signalled diff --git a/libraries/render-utils/src/ToneMappingEffect.cpp b/libraries/render-utils/src/ToneMappingEffect.cpp index d192266d7e..64a2adb5d4 100644 --- a/libraries/render-utils/src/ToneMappingEffect.cpp +++ b/libraries/render-utils/src/ToneMappingEffect.cpp @@ -79,8 +79,8 @@ void ToneMappingEffect::render(RenderArgs* args, const gpu::TexturePointer& ligh void ToneMappingDeferred::configure(const Config& config) { - _toneMappingEffect.setExposure(config.exposure); - _toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve); + _toneMappingEffect.setExposure(config.exposure); + _toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve); } void ToneMappingDeferred::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { diff --git a/libraries/render-utils/src/toneMapping.slf b/libraries/render-utils/src/toneMapping.slf index 29f618c2f0..3fe53d9be1 100644 --- a/libraries/render-utils/src/toneMapping.slf +++ b/libraries/render-utils/src/toneMapping.slf @@ -37,7 +37,7 @@ int getToneCurve() { } LAYOUT(binding=RENDER_UTILS_TEXTURE_TM_COLOR) uniform sampler2D colorMap; - + layout(location=0) in vec2 varTexCoord0; layout(location=0) out vec4 outFragColor; diff --git a/libraries/script-engine/src/AssetScriptingInterface.h b/libraries/script-engine/src/AssetScriptingInterface.h index 0e05a563b2..07d681ca88 100644 --- a/libraries/script-engine/src/AssetScriptingInterface.h +++ b/libraries/script-engine/src/AssetScriptingInterface.h @@ -30,6 +30,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client */ diff --git a/libraries/script-engine/src/FileScriptingInterface.h b/libraries/script-engine/src/FileScriptingInterface.h index 7b833399e0..859f343ec5 100644 --- a/libraries/script-engine/src/FileScriptingInterface.h +++ b/libraries/script-engine/src/FileScriptingInterface.h @@ -21,6 +21,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client */ diff --git a/libraries/script-engine/src/Mat4.h b/libraries/script-engine/src/Mat4.h index 288a101234..7ad77b9b24 100644 --- a/libraries/script-engine/src/Mat4.h +++ b/libraries/script-engine/src/Mat4.h @@ -26,6 +26,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client */ diff --git a/libraries/script-engine/src/Quat.h b/libraries/script-engine/src/Quat.h index 76b7ac45e3..d24db786d0 100644 --- a/libraries/script-engine/src/Quat.h +++ b/libraries/script-engine/src/Quat.h @@ -40,6 +40,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/script-engine/src/RecordingScriptingInterface.h b/libraries/script-engine/src/RecordingScriptingInterface.h index c4d576351f..6a058feea5 100644 --- a/libraries/script-engine/src/RecordingScriptingInterface.h +++ b/libraries/script-engine/src/RecordingScriptingInterface.h @@ -28,6 +28,7 @@ class QScriptValue; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-assignment-client */ class RecordingScriptingInterface : public QObject, public Dependency { diff --git a/libraries/script-engine/src/SceneScriptingInterface.h b/libraries/script-engine/src/SceneScriptingInterface.h index da42cf2df3..a78fa44641 100644 --- a/libraries/script-engine/src/SceneScriptingInterface.h +++ b/libraries/script-engine/src/SceneScriptingInterface.h @@ -115,6 +115,7 @@ namespace SceneScripting { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {string} backgroundMode * @property {Scene.Stage.KeyLight} keyLight @@ -178,6 +179,7 @@ namespace SceneScripting { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {boolean} shouldRenderAvatars * @property {boolean} shouldRenderEntities diff --git a/libraries/script-engine/src/ScriptAudioInjector.h b/libraries/script-engine/src/ScriptAudioInjector.h index 2c88d618e1..c7fb2f8a9a 100644 --- a/libraries/script-engine/src/ScriptAudioInjector.h +++ b/libraries/script-engine/src/ScriptAudioInjector.h @@ -23,6 +23,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index fa7a8e1114..5d33a6a061 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -588,6 +588,7 @@ static void scriptableResourceFromScriptValue(const QScriptValue& value, Scripta * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index 8753010089..48fb4f0b83 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -104,6 +104,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/script-engine/src/ScriptEngines.h b/libraries/script-engine/src/ScriptEngines.h index 4d5964e462..4db150fce5 100644 --- a/libraries/script-engine/src/ScriptEngines.h +++ b/libraries/script-engine/src/ScriptEngines.h @@ -32,6 +32,7 @@ class ScriptEngine; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {string} debugScriptUrl * @property {string} defaultScriptsPath diff --git a/libraries/script-engine/src/ScriptUUID.h b/libraries/script-engine/src/ScriptUUID.h index 45e6ec0ad1..7387cefeff 100644 --- a/libraries/script-engine/src/ScriptUUID.h +++ b/libraries/script-engine/src/ScriptUUID.h @@ -27,6 +27,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/script-engine/src/ScriptsModel.h b/libraries/script-engine/src/ScriptsModel.h index 2466347baa..adfb15affc 100644 --- a/libraries/script-engine/src/ScriptsModel.h +++ b/libraries/script-engine/src/ScriptsModel.h @@ -71,6 +71,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class ScriptsModel : public QAbstractItemModel { Q_OBJECT diff --git a/libraries/script-engine/src/ScriptsModelFilter.h b/libraries/script-engine/src/ScriptsModelFilter.h index 05a76334bb..81ae4c1226 100644 --- a/libraries/script-engine/src/ScriptsModelFilter.h +++ b/libraries/script-engine/src/ScriptsModelFilter.h @@ -23,6 +23,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class ScriptsModelFilter : public QSortFilterProxyModel { Q_OBJECT diff --git a/libraries/script-engine/src/UsersScriptingInterface.h b/libraries/script-engine/src/UsersScriptingInterface.h index e80d38239f..57de205066 100644 --- a/libraries/script-engine/src/UsersScriptingInterface.h +++ b/libraries/script-engine/src/UsersScriptingInterface.h @@ -21,6 +21,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-assignment-client * * @property {boolean} canKick - true if the domain server allows the node or avatar to kick (ban) avatars, diff --git a/libraries/script-engine/src/Vec3.h b/libraries/script-engine/src/Vec3.h index fe903c07e2..7887938004 100644 --- a/libraries/script-engine/src/Vec3.h +++ b/libraries/script-engine/src/Vec3.h @@ -31,6 +31,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/shared/src/DebugDraw.h b/libraries/shared/src/DebugDraw.h index 81acbf554c..785e549c03 100644 --- a/libraries/shared/src/DebugDraw.h +++ b/libraries/shared/src/DebugDraw.h @@ -28,6 +28,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client */ diff --git a/libraries/shared/src/PathUtils.h b/libraries/shared/src/PathUtils.h index 2247f4cc6a..0096cb6c90 100644 --- a/libraries/shared/src/PathUtils.h +++ b/libraries/shared/src/PathUtils.h @@ -25,6 +25,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @deprecated The Paths API is deprecated. Use {@link Script.resolvePath} and {@link Script.resourcesPath} instead. * @readonly diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index 9d5bca6b9f..729816cf82 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -645,6 +645,7 @@ using MeshPointer = std::shared_ptr; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @hifi-server-entity * @hifi-assignment-client * diff --git a/libraries/shared/src/shared/Camera.h b/libraries/shared/src/shared/Camera.h index d14489b92c..31e6228bb9 100644 --- a/libraries/shared/src/shared/Camera.h +++ b/libraries/shared/src/shared/Camera.h @@ -43,6 +43,7 @@ class Camera : public QObject { * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {Vec3} position - The position of the camera. You can set this value only when the camera is in independent * mode. diff --git a/libraries/task/src/task/Config.h b/libraries/task/src/task/Config.h index da9b95a274..486b28b6b9 100644 --- a/libraries/task/src/task/Config.h +++ b/libraries/task/src/task/Config.h @@ -196,6 +196,7 @@ public: * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {number} cpuRunTime - Read-only. * @property {boolean} enabled diff --git a/libraries/ui/src/InteractiveWindow.h b/libraries/ui/src/InteractiveWindow.h index a25d559557..22a3df7530 100644 --- a/libraries/ui/src/InteractiveWindow.h +++ b/libraries/ui/src/InteractiveWindow.h @@ -44,7 +44,8 @@ using namespace InteractiveWindowEnums; * @class InteractiveWindow * * @hifi-interface - * @hifi-client-en + * @hifi-client-entity + * @hifi-avatar * * @property {string} title * @property {Vec2} position diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index a719593df2..137cffde94 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -36,6 +36,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * @property {boolean} navigationFocused * @property {boolean} navigationFocusDisabled */ diff --git a/libraries/ui/src/QmlWebWindowClass.h b/libraries/ui/src/QmlWebWindowClass.h index e3aea22e3d..770f8ec965 100644 --- a/libraries/ui/src/QmlWebWindowClass.h +++ b/libraries/ui/src/QmlWebWindowClass.h @@ -17,6 +17,7 @@ * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {string} url - Read-only. * @property {Vec2} position diff --git a/libraries/ui/src/QmlWindowClass.h b/libraries/ui/src/QmlWindowClass.h index 18ee1fedd5..8aad9a8b36 100644 --- a/libraries/ui/src/QmlWindowClass.h +++ b/libraries/ui/src/QmlWindowClass.h @@ -24,7 +24,8 @@ class QScriptContext; * @param {OverlayWindow.Properties} [properties=null] * * @hifi-interface - * @hifi-client-en + * @hifi-client-entity + * @hifi-avatar * * @property {Vec2} position * @property {Vec2} size diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 71bb65509f..8e938ce25b 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -238,7 +238,10 @@ void OffscreenQmlSurface::clearFocusItem() { void OffscreenQmlSurface::initializeEngine(QQmlEngine* engine) { Parent::initializeEngine(engine); - QQmlFileSelector* fileSelector = new QQmlFileSelector(engine); + auto fileSelector = QQmlFileSelector::get(engine); + if (!fileSelector) { + fileSelector = new QQmlFileSelector(engine); + } fileSelector->setExtraSelectors(FileUtils::getFileSelectors()); static std::once_flag once; diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index 9821ad1263..1a6df83d93 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -43,12 +43,14 @@ class OffscreenQmlSurface; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ /**jsdoc * @namespace tabletInterface * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @deprecated This API is deprecated and will be removed. Use {@link Tablet} instead. */ @@ -208,6 +210,7 @@ Q_DECLARE_METATYPE(TabletButtonsProxyModel*); * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {string} name - Name of this tablet. Read-only. * @property {boolean} toolbarMode - Used to transition this tablet into and out of toolbar mode. @@ -456,6 +459,7 @@ Q_DECLARE_METATYPE(TabletProxy*); * * @hifi-interface * @hifi-client-entity + * @hifi-avatar * * @property {Uuid} uuid - Uniquely identifies this button. Read-only. * @property {TabletButtonProxy.ButtonProperties} properties diff --git a/libraries/ui/src/ui/ToolbarScriptingInterface.h b/libraries/ui/src/ui/ToolbarScriptingInterface.h index 777eeba9dd..409ea28fdc 100644 --- a/libraries/ui/src/ui/ToolbarScriptingInterface.h +++ b/libraries/ui/src/ui/ToolbarScriptingInterface.h @@ -24,6 +24,7 @@ class QQuickItem; * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class ToolbarButtonProxy : public QmlWrapper { Q_OBJECT @@ -83,6 +84,7 @@ Q_DECLARE_METATYPE(ToolbarButtonProxy*); * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class ToolbarProxy : public QmlWrapper { Q_OBJECT @@ -136,6 +138,7 @@ Q_DECLARE_METATYPE(ToolbarProxy*); * * @hifi-interface * @hifi-client-entity + * @hifi-avatar */ class ToolbarScriptingInterface : public QObject, public Dependency { Q_OBJECT diff --git a/plugins/oculus/src/OculusDisplayPlugin.cpp b/plugins/oculus/src/OculusDisplayPlugin.cpp index a34e647a5e..df01591639 100644 --- a/plugins/oculus/src/OculusDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusDisplayPlugin.cpp @@ -138,6 +138,10 @@ void OculusDisplayPlugin::hmdPresent() { return; } + if (!_currentFrame) { + return; + } + PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)_currentFrame->frameIndex) { diff --git a/scripts/developer/utilities/render/deferredLighting.qml b/scripts/developer/utilities/render/deferredLighting.qml index aef533b7a3..6d98e96780 100644 --- a/scripts/developer/utilities/render/deferredLighting.qml +++ b/scripts/developer/utilities/render/deferredLighting.qml @@ -123,7 +123,6 @@ Rectangle { anchors.right: parent.right } } - Item { height: childrenRect.height anchors.left: parent.left @@ -134,18 +133,17 @@ Rectangle { anchors.left: parent.left } - HifiControls.ComboBox { + ComboBox { anchors.right: parent.right currentIndex: 1 - model: ListModel { - id: cbItems - ListElement { text: "RGB"; color: "Yellow" } - ListElement { text: "SRGB"; color: "Green" } - ListElement { text: "Reinhard"; color: "Yellow" } - ListElement { text: "Filmic"; color: "White" } - } + model: [ + "RGB", + "SRGB", + "Reinhard", + "Filmic", + ] width: 200 - onCurrentIndexChanged: { render.mainViewTask.getConfig("ToneMapping")["curve"] = currentIndex } + onCurrentIndexChanged: { render.mainViewTask.getConfig("ToneMapping")["curve"] = currentIndex; } } } } @@ -170,7 +168,7 @@ Rectangle { framebuffer.config.mode = mode; } - HifiControls.ComboBox { + ComboBox { anchors.right: parent.right currentIndex: 0 model: ListModel { diff --git a/tools/gpu-frame-player/CMakeLists.txt b/tools/gpu-frame-player/CMakeLists.txt index bd50839f9c..996fc859d8 100644 --- a/tools/gpu-frame-player/CMakeLists.txt +++ b/tools/gpu-frame-player/CMakeLists.txt @@ -7,7 +7,7 @@ setup_hifi_project(Gui Widgets) # link in the shared libraries link_hifi_libraries( - shared ktx shaders gpu + shared ktx shaders gpu # vk gpu-vk gl ${PLATFORM_GL_BACKEND} ) diff --git a/tools/jsdoc/plugins/hifi.js b/tools/jsdoc/plugins/hifi.js index 76f33e2c73..a525093965 100644 --- a/tools/jsdoc/plugins/hifi.js +++ b/tools/jsdoc/plugins/hifi.js @@ -107,6 +107,9 @@ exports.handlers = { if (e.doclet.hifiClientEntity) { rows.push("Client Entity Scripts"); } + if (e.doclet.hifiAvatar) { + rows.push("Avatar Scripts"); + } if (e.doclet.hifiServerEntity) { rows.push("Server Entity Scripts"); } @@ -140,6 +143,14 @@ exports.defineTags = function (dictionary) { } }); + // @hifi-avatar-script + dictionary.defineTag("hifi-avatar", { + onTagged: function (doclet, tag) { + doclet.hifiAvatar = true; + } + }); + + // @hifi-client-entity dictionary.defineTag("hifi-client-entity", { onTagged: function (doclet, tag) { diff --git a/tools/nitpick/README.md b/tools/nitpick/README.md index c5e3a5e21d..25f9001409 100644 --- a/tools/nitpick/README.md +++ b/tools/nitpick/README.md @@ -18,7 +18,7 @@ Nitpick has 5 functions, separated into separate tabs: ### Windows 1. (First time) download and install Python 3 from https://hifi-qa.s3.amazonaws.com/nitpick/Windows/python-3.7.0-amd64.exe (also located at https://www.python.org/downloads/) 1. Click the "add python to path" checkbox on the python installer - 1. After installation - create an environment variable called PYTHON_PATH and set it to the folder containing the Python executable. + 1. After installation - add the path to python.exe to the Windows PATH environment variable. 1. (First time) download and install AWS CLI from https://hifi-qa.s3.amazonaws.com/nitpick/Windows/AWSCLI64PY3.msi (also available at https://aws.amazon.com/cli/ 1. Open a new command prompt and run `aws configure` @@ -31,7 +31,7 @@ Nitpick has 5 functions, separated into separate tabs: 1. (First time) Download adb (Android Debug Bridge) from *https://dl.google.com/android/repository/platform-tools-latest-windows.zip* 1. Copy the downloaded file to (for example) **C:\adb** and extract in place. Verify you see *adb.exe* in **C:\adb\platform-tools\\**. - 1. Create an environment variable named ADB_PATH and set its value to the installation location (e.g. **C:\adb**) + 1. After installation - add the path to adb.exe to the Windows PATH environment variable (note that it is in *adb\platform-tools*). ### Mac 1. (first time) Install brew In a terminal: diff --git a/tools/nitpick/src/AdbInterface.cpp b/tools/nitpick/src/AdbInterface.cpp new file mode 100644 index 0000000000..82ef1446e3 --- /dev/null +++ b/tools/nitpick/src/AdbInterface.cpp @@ -0,0 +1,38 @@ +// +// AdbInterface.cpp +// +// Created by Nissim Hadar on Feb 11, 2019. +// Copyright 2013 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "AdbInterface.h" +#include + +#include +#include + +QString AdbInterface::getAdbCommand() { +#ifdef Q_OS_WIN + if (_adbCommand.isNull()) { + QString adbPath = PathUtils::getPathToExecutable("adb.exe"); + if (!adbPath.isNull()) { + _adbCommand = adbPath + _adbExe; + } else { + QMessageBox::critical(0, "python.exe not found", + "Please verify that pyton.exe is in the PATH"); + exit(-1); + } + } +#elif defined Q_OS_MAC + _adbCommand = "/usr/local/bin/adb"; + if (!QFile::exists(_adbCommand)) { + QMessageBox::critical(0, "adb not found", + "adb not found at " + _adbCommand); + exit(-1); + } +#endif + + return _adbCommand; +} diff --git a/tools/nitpick/src/AdbInterface.h b/tools/nitpick/src/AdbInterface.h new file mode 100644 index 0000000000..c1ce84c019 --- /dev/null +++ b/tools/nitpick/src/AdbInterface.h @@ -0,0 +1,30 @@ +// +// AdbInterface.h +// +// Created by Nissim Hadar on Feb 11, 2019. +// Copyright 2013 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#ifndef hifi_AdbInterface_h +#define hifi_AdbInterface_h + +#include + +class AdbInterface { +public: + QString getAdbCommand(); + +private: +#ifdef Q_OS_WIN + const QString _adbExe{ "adb.exe" }; +#else + // Both Mac and Linux use "python" + const QString _adbExe{ "adb" }; +#endif + + QString _adbCommand; +}; + +#endif // hifi_AdbInterface_h diff --git a/tools/nitpick/src/Nitpick.cpp b/tools/nitpick/src/Nitpick.cpp index fa53730ce0..3a799ce3c2 100644 --- a/tools/nitpick/src/Nitpick.cpp +++ b/tools/nitpick/src/Nitpick.cpp @@ -40,7 +40,7 @@ Nitpick::Nitpick(QWidget* parent) : QMainWindow(parent) { _ui.plainTextEdit->setReadOnly(true); - setWindowTitle("Nitpick - v2.1.0"); + setWindowTitle("Nitpick - v2.1.1"); } Nitpick::~Nitpick() { diff --git a/tools/nitpick/src/Nitpick.h b/tools/nitpick/src/Nitpick.h index 29726be3bd..36ec7e534b 100644 --- a/tools/nitpick/src/Nitpick.h +++ b/tools/nitpick/src/Nitpick.h @@ -21,8 +21,6 @@ #include "TestRunnerDesktop.h" #include "TestRunnerMobile.h" -#include "AWSInterface.h" - class Nitpick : public QMainWindow { Q_OBJECT @@ -112,8 +110,6 @@ private: TestRunnerDesktop* _testRunnerDesktop{ nullptr }; TestRunnerMobile* _testRunnerMobile{ nullptr }; - AWSInterface _awsInterface; - std::vector _downloaders; // local storage for parameters - folder to store downloaded files in, and a list of their names diff --git a/tools/nitpick/src/PathUtils.cpp b/tools/nitpick/src/PathUtils.cpp new file mode 100644 index 0000000000..711570d568 --- /dev/null +++ b/tools/nitpick/src/PathUtils.cpp @@ -0,0 +1,31 @@ +// +// PathUtils.h +// +// Created by Nissim Hadar on 11 Feb 2019. +// Copyright 2013 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "PathUtils.h" + +#include +#include +#include + +QString PathUtils::getPathToExecutable(const QString& executableName) { + QString path = QProcessEnvironment::systemEnvironment().value("PATH"); + + QStringList pathLocations = path.replace('\\', '/').split(';'); + + foreach (QString pathLocation, pathLocations) { + if (pathLocation[pathLocation.length() - 1] != '/') { + pathLocation += '/'; + } + if (QFile::exists(pathLocation + executableName)) { + return pathLocation; + } + } + + return QString(); +} diff --git a/tools/nitpick/src/PathUtils.h b/tools/nitpick/src/PathUtils.h new file mode 100644 index 0000000000..72f6839e3d --- /dev/null +++ b/tools/nitpick/src/PathUtils.h @@ -0,0 +1,20 @@ +// +// PathUtils.h +// +// Created by Nissim Hadar on 11 Feb 2019. +// Copyright 2013 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#ifndef hifi_PathUtils_h +#define hifi_PathUtils_h + +#include + +class PathUtils { +public: + static QString getPathToExecutable(const QString& executableName); +}; + +#endif \ No newline at end of file diff --git a/tools/nitpick/src/PythonInterface.cpp b/tools/nitpick/src/PythonInterface.cpp index 9e2fec005f..dcf4ecc682 100644 --- a/tools/nitpick/src/PythonInterface.cpp +++ b/tools/nitpick/src/PythonInterface.cpp @@ -8,36 +8,31 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "PythonInterface.h" +#include #include #include -#include -PythonInterface::PythonInterface() { +QString PythonInterface::getPythonCommand() { #ifdef Q_OS_WIN - if (QProcessEnvironment::systemEnvironment().contains("PYTHON_PATH")) { - QString pythonPath = QProcessEnvironment::systemEnvironment().value("PYTHON_PATH"); - if (!QFile::exists(pythonPath + "/" + _pythonExe)) { - QMessageBox::critical(0, _pythonExe, QString("Python executable not found in ") + pythonPath); + if (_pythonCommand.isNull()) { + QString pythonPath = PathUtils::getPathToExecutable("python.exe"); + if (!pythonPath.isNull()) { + _pythonCommand = pythonPath + _pythonExe; + } else { + QMessageBox::critical(0, "python.exe not found", + "Please verify that pyton.exe is in the PATH"); exit(-1); } - - _pythonCommand = pythonPath + "/" + _pythonExe; - } else { - QMessageBox::critical(0, "PYTHON_PATH not defined", - "Please set PYTHON_PATH to directory containing the Python executable"); - exit(-1); } #elif defined Q_OS_MAC _pythonCommand = "/usr/local/bin/python3"; if (!QFile::exists(_pythonCommand)) { QMessageBox::critical(0, "python not found", - "python3 not found at " + _pythonCommand); + "python3 not found at " + _pythonCommand); exit(-1); } #endif -} -QString PythonInterface::getPythonCommand() { return _pythonCommand; } diff --git a/tools/nitpick/src/PythonInterface.h b/tools/nitpick/src/PythonInterface.h index 947b359037..7972d55cce 100644 --- a/tools/nitpick/src/PythonInterface.h +++ b/tools/nitpick/src/PythonInterface.h @@ -14,8 +14,6 @@ class PythonInterface { public: - PythonInterface(); - QString getPythonCommand(); private: diff --git a/tools/nitpick/src/Test.cpp b/tools/nitpick/src/Test.cpp index 20d5ad89a6..f618118289 100644 --- a/tools/nitpick/src/Test.cpp +++ b/tools/nitpick/src/Test.cpp @@ -24,7 +24,7 @@ extern Nitpick* nitpick; #include -Test::Test(QProgressBar* progressBar, QCheckBox* checkBoxInteractiveMode) { +Test::Test(QProgressBar* progressBar, QCheckBox* checkBoxInteractiveMode) : _awsInterface(NULL) { _progressBar = progressBar; _checkBoxInteractiveMode = checkBoxInteractiveMode; @@ -966,11 +966,15 @@ void Test::createTestRailTestCases() { return; } + if (!_testRailInterface) { + _testRailInterface = new TestRailInterface; + } + if (_testRailCreateMode == PYTHON) { - _testRailInterface.createTestSuitePython(_testDirectory, outputDirectory, nitpick->getSelectedUser(), + _testRailInterface->createTestSuitePython(_testDirectory, outputDirectory, nitpick->getSelectedUser(), nitpick->getSelectedBranch()); } else { - _testRailInterface.createTestSuiteXML(_testDirectory, outputDirectory, nitpick->getSelectedUser(), + _testRailInterface->createTestSuiteXML(_testDirectory, outputDirectory, nitpick->getSelectedUser(), nitpick->getSelectedBranch()); } } @@ -983,7 +987,12 @@ void Test::createTestRailRun() { return; } - _testRailInterface.createTestRailRun(outputDirectory); + + if (!_testRailInterface) { + _testRailInterface = new TestRailInterface; + } + + _testRailInterface->createTestRailRun(outputDirectory); } void Test::updateTestRailRunResult() { @@ -999,7 +1008,12 @@ void Test::updateTestRailRunResult() { return; } - _testRailInterface.updateTestRailRunResults(testResults, tempDirectory); + + if (!_testRailInterface) { + _testRailInterface = new TestRailInterface; + } + + _testRailInterface->updateTestRailRunResults(testResults, tempDirectory); } QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) { @@ -1088,5 +1102,9 @@ void Test::createWebPage(QCheckBox* updateAWSCheckBox, QLineEdit* urlLineEdit) { return; } - _awsInterface.createWebPageFromResults(testResults, workingDirectory, updateAWSCheckBox, urlLineEdit); + if (!_awsInterface) { + _awsInterface = new AWSInterface; + } + + _awsInterface->createWebPageFromResults(testResults, workingDirectory, updateAWSCheckBox, urlLineEdit); } \ No newline at end of file diff --git a/tools/nitpick/src/Test.h b/tools/nitpick/src/Test.h index 842e4bdb48..166c71688d 100644 --- a/tools/nitpick/src/Test.h +++ b/tools/nitpick/src/Test.h @@ -159,10 +159,10 @@ private: bool _exitWhenComplete{ false }; - TestRailInterface _testRailInterface; + TestRailInterface* _testRailInterface; TestRailCreateMode _testRailCreateMode { PYTHON }; - AWSInterface _awsInterface; + AWSInterface* _awsInterface; }; #endif // hifi_test_h \ No newline at end of file diff --git a/tools/nitpick/src/TestRailInterface.cpp b/tools/nitpick/src/TestRailInterface.cpp index 1d7aa0a32f..6ed13a72b6 100644 --- a/tools/nitpick/src/TestRailInterface.cpp +++ b/tools/nitpick/src/TestRailInterface.cpp @@ -20,7 +20,7 @@ #include #include -TestRailInterface::TestRailInterface() { +TestRailInterface::TestRailInterface() : _pythonInterface(NULL) { _testRailTestCasesSelectorWindow.setURL("https://highfidelity.testrail.net"); _testRailTestCasesSelectorWindow.setUser("@highfidelity.io"); diff --git a/tools/nitpick/src/TestRunnerMobile.cpp b/tools/nitpick/src/TestRunnerMobile.cpp index e1c82854f4..ab276f3337 100644 --- a/tools/nitpick/src/TestRunnerMobile.cpp +++ b/tools/nitpick/src/TestRunnerMobile.cpp @@ -30,7 +30,7 @@ TestRunnerMobile::TestRunnerMobile( QLabel* statusLabel, QObject* parent -) : QObject(parent) +) : QObject(parent), _adbInterface(NULL) { _workingFolderLabel = workingFolderLabel; _connectDeviceButton = connectDeviceButton; @@ -47,30 +47,6 @@ TestRunnerMobile::TestRunnerMobile( folderLineEdit->setText("/sdcard/DCIM/TEST"); modelNames["SM_G955U1"] = "Samsung S8+ unlocked"; - - // Find ADB (Android Debugging Bridge) -#ifdef Q_OS_WIN - if (QProcessEnvironment::systemEnvironment().contains("ADB_PATH")) { - QString adbExePath = QProcessEnvironment::systemEnvironment().value("ADB_PATH") + "/platform-tools"; - if (!QFile::exists(adbExePath + "/" + _adbExe)) { - QMessageBox::critical(0, _adbExe, QString("ADB executable not found in ") + adbExePath); - exit(-1); - } - - _adbCommand = adbExePath + "/" + _adbExe; - } else { - QMessageBox::critical(0, "ADB_PATH not defined", - "Please set ADB_PATH to directory containing the `adb` executable"); - exit(-1); - } -#elif defined Q_OS_MAC - _adbCommand = "/usr/local/bin/adb"; - if (!QFile::exists(_adbCommand)) { - QMessageBox::critical(0, "adb not found", - "python3 not found at " + _adbCommand); - exit(-1); - } -#endif } TestRunnerMobile::~TestRunnerMobile() { @@ -84,8 +60,12 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() { void TestRunnerMobile::connectDevice() { #if defined Q_OS_WIN || defined Q_OS_MAC + if (!_adbInterface) { + _adbInterface = new AdbInterface(); + } + QString devicesFullFilename{ _workingFolder + "/devices.txt" }; - QString command = _adbCommand + " devices -l > " + devicesFullFilename; + QString command = _adbInterface->getAdbCommand() + " devices -l > " + devicesFullFilename; system(command.toStdString().c_str()); if (!QFile::exists(devicesFullFilename)) { @@ -100,12 +80,13 @@ void TestRunnerMobile::connectDevice() { QString line2 = devicesFile.readLine(); const QString DEVICE{ "device" }; - if (line2.contains(DEVICE)) { - // Make sure only 1 device + if (line2.contains("unauthorized")) { + QMessageBox::critical(0, "Unauthorized device detected", "Please allow USB debugging on device"); + } else if (line2.contains(DEVICE)) { + // Make sure only 1 device QString line3 = devicesFile.readLine(); if (line3.contains(DEVICE)) { QMessageBox::critical(0, "Too many devices detected", "Tests will run only if a single device is attached"); - } else { // Line looks like this: 988a1b47335239434b device product:dream2qlteue model:SM_G955U1 device:dream2qlteue transport_id:2 QStringList tokens = line2.split(QRegExp("[\r\n\t ]+")); @@ -169,8 +150,12 @@ void TestRunnerMobile::downloadComplete() { void TestRunnerMobile::installAPK() { #if defined Q_OS_WIN || defined Q_OS_MAC + if (!_adbInterface) { + _adbInterface = new AdbInterface(); + } + _statusLabel->setText("Installing"); - QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt"; + QString command = _adbInterface->getAdbCommand() + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt"; system(command.toStdString().c_str()); _statusLabel->setText("Installation complete"); _runInterfacePushbutton->setEnabled(true); @@ -179,8 +164,12 @@ void TestRunnerMobile::installAPK() { void TestRunnerMobile::runInterface() { #if defined Q_OS_WIN || defined Q_OS_MAC + if (!_adbInterface) { + _adbInterface = new AdbInterface(); + } + _statusLabel->setText("Starting Interface"); - QString command = _adbCommand + " shell monkey -p io.highfidelity.hifiinterface -v 1"; + QString command = _adbInterface->getAdbCommand() + " shell monkey -p io.highfidelity.hifiinterface -v 1"; system(command.toStdString().c_str()); _statusLabel->setText("Interface started"); #endif @@ -188,8 +177,12 @@ void TestRunnerMobile::runInterface() { void TestRunnerMobile::pullFolder() { #if defined Q_OS_WIN || defined Q_OS_MAC + if (!_adbInterface) { + _adbInterface = new AdbInterface(); + } + _statusLabel->setText("Pulling folder"); - QString command = _adbCommand + " pull " + _folderLineEdit->text() + " " + _workingFolder + _installerFilename; + QString command = _adbInterface->getAdbCommand() + " pull " + _folderLineEdit->text() + " " + _workingFolder + _installerFilename; system(command.toStdString().c_str()); _statusLabel->setText("Pull complete"); #endif diff --git a/tools/nitpick/src/TestRunnerMobile.h b/tools/nitpick/src/TestRunnerMobile.h index 247f864976..52c2ba096d 100644 --- a/tools/nitpick/src/TestRunnerMobile.h +++ b/tools/nitpick/src/TestRunnerMobile.h @@ -17,6 +17,7 @@ #include #include "TestRunner.h" +#include "AdbInterface.h" class TestRunnerMobile : public QObject, public TestRunner { Q_OBJECT @@ -70,5 +71,7 @@ private: QString _adbCommand; std::map modelNames; + + AdbInterface* _adbInterface; }; #endif diff --git a/tools/nitpick/ui/Nitpick.ui b/tools/nitpick/ui/Nitpick.ui index 16aaa9594d..79bdfd158b 100644 --- a/tools/nitpick/ui/Nitpick.ui +++ b/tools/nitpick/ui/Nitpick.ui @@ -686,8 +686,8 @@ - 290 - 20 + 300 + 60 41 31 @@ -699,8 +699,8 @@ - 340 - 20 + 350 + 60 271 31 diff --git a/tools/skeleton-dump/CMakeLists.txt b/tools/skeleton-dump/CMakeLists.txt index baec1d163b..7d4248d171 100644 --- a/tools/skeleton-dump/CMakeLists.txt +++ b/tools/skeleton-dump/CMakeLists.txt @@ -2,3 +2,5 @@ set(TARGET_NAME skeleton-dump) setup_hifi_project(Core) setup_memory_debugger() link_hifi_libraries(shared fbx hfm graphics gpu gl animation) + +include_hifi_library_headers(image) diff --git a/tools/vhacd-util/CMakeLists.txt b/tools/vhacd-util/CMakeLists.txt index aa6642c610..90cfdf878a 100644 --- a/tools/vhacd-util/CMakeLists.txt +++ b/tools/vhacd-util/CMakeLists.txt @@ -2,6 +2,8 @@ set(TARGET_NAME vhacd-util) setup_hifi_project(Core) link_hifi_libraries(shared fbx hfm graphics gpu gl) +include_hifi_library_headers(image) + add_dependency_external_projects(vhacd) find_package(VHACD REQUIRED)