diff --git a/.gradle/4.6/fileChanges/last-build.bin b/.gradle/4.6/fileChanges/last-build.bin new file mode 100644 index 0000000000..f76dd238ad Binary files /dev/null and b/.gradle/4.6/fileChanges/last-build.bin differ diff --git a/.gradle/4.6/fileHashes/fileHashes.lock b/.gradle/4.6/fileHashes/fileHashes.lock new file mode 100644 index 0000000000..df8552e6be Binary files /dev/null and b/.gradle/4.6/fileHashes/fileHashes.lock differ diff --git a/BUILD_ANDROID.md b/BUILD_ANDROID.md index 3d6d056d79..8c9263b6e7 100644 --- a/BUILD_ANDROID.md +++ b/BUILD_ANDROID.md @@ -53,7 +53,7 @@ Enter the repository `android` directory Execute a gradle pre-build setup. This step should only need to be done once -`gradle setupDepedencies` +`gradle setupDependencies` # Building & Running diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 3ed5445493..49877cacc3 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -23,12 +23,22 @@ set(RESOURCES_QRC ${CMAKE_CURRENT_BINARY_DIR}/resources.qrc) set(RESOURCES_RCC ${CMAKE_CURRENT_SOURCE_DIR}/compiledResources/resources.rcc) generate_qrc(OUTPUT ${RESOURCES_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources CUSTOM_PATHS ${CUSTOM_INTERFACE_QRC_PATHS} GLOBS *) -add_custom_command( - OUTPUT ${RESOURCES_RCC} - DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS} - COMMAND "${QT_DIR}/bin/rcc" - ARGS ${RESOURCES_QRC} -binary -o ${RESOURCES_RCC} -) +if (ANDROID) + # on Android, don't compress the rcc binary + add_custom_command( + OUTPUT ${RESOURCES_RCC} + DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS} + COMMAND "${QT_DIR}/bin/rcc" + ARGS ${RESOURCES_QRC} -no-compress -binary -o ${RESOURCES_RCC} + ) +else () + add_custom_command( + OUTPUT ${RESOURCES_RCC} + DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS} + COMMAND "${QT_DIR}/bin/rcc" + ARGS ${RESOURCES_QRC} -binary -o ${RESOURCES_RCC} + ) +endif() list(APPEND GENERATE_QRC_DEPENDS ${RESOURCES_RCC}) add_custom_target(resources ALL DEPENDS ${GENERATE_QRC_DEPENDS}) diff --git a/interface/resources/qml/+android/AddressBarDialog.qml b/interface/resources/qml/+android/AddressBarDialog.qml index 50552f0d3b..b8d6b5e270 100644 --- a/interface/resources/qml/+android/AddressBarDialog.qml +++ b/interface/resources/qml/+android/AddressBarDialog.qml @@ -76,33 +76,33 @@ Item { HifiStyles.RalewayRegular { id: notice text: "YOUR LOCATION" - font.pixelSize: (hifi.fonts.pixelSize * 2.15)*(android.dimen.atLeast1440p?1:.75); + font.pixelSize: (hifi.fonts.pixelSize * 2.15) * (android.dimen.atLeast1440p ? 1 : .75); color: "#2CD7FF" anchors { bottom: addressBackground.top - bottomMargin: android.dimen.atLeast1440p?45:34 + bottomMargin: android.dimen.atLeast1440p ? 45 : 34 left: addressBackground.left - leftMargin: android.dimen.atLeast1440p?60:45 + leftMargin: android.dimen.atLeast1440p ? 60 : 45 } } - property int inputAreaHeight: android.dimen.atLeast1440p?210:156 + property int inputAreaHeight: android.dimen.atLeast1440p ? 210 : 156 property int inputAreaStep: (height - inputAreaHeight) / 2 ToolbarButton { id: homeButton - y: android.dimen.atLeast1440p?280:210 + y: android.dimen.atLeast1440p ? 280 : 210 imageURL: "../../icons/home.svg" onClicked: { addressBarDialog.loadHome(); bar.shown = false; } anchors { - leftMargin: android.dimen.atLeast1440p?75:56 + leftMargin: android.dimen.atLeast1440p ? 75 : 56 left: parent.left } - size: android.dimen.atLeast1440p?150:150//112 + size: android.dimen.atLeast1440p ? 150 : 150//112 } ToolbarButton { @@ -111,10 +111,10 @@ Item { onClicked: addressBarDialog.loadBack(); anchors { left: homeButton.right - leftMargin: android.dimen.atLeast1440p?70:52 + leftMargin: android.dimen.atLeast1440p ? 70 : 52 verticalCenter: homeButton.verticalCenter } - size: android.dimen.atLeast1440p?150:150 + size: android.dimen.atLeast1440p ? 150 : 150 } ToolbarButton { id: forwardArrow; @@ -122,10 +122,10 @@ Item { onClicked: addressBarDialog.loadForward(); anchors { left: backArrow.right - leftMargin: android.dimen.atLeast1440p?60:45 + leftMargin: android.dimen.atLeast1440p ? 60 : 45 verticalCenter: homeButton.verticalCenter } - size: android.dimen.atLeast1440p?150:150 + size: android.dimen.atLeast1440p ? 150 : 150 } HifiStyles.FiraSansRegular { @@ -140,25 +140,22 @@ Item { Rectangle { id: addressBackground - x: android.dimen.atLeast1440p?780:585 - y: android.dimen.atLeast1440p?280:235 // tweaking by hand - width: android.dimen.atLeast1440p?1270:952 - height: android.dimen.atLeast1440p?150:112 + x: android.dimen.atLeast1440p ? 780 : 585 + y: android.dimen.atLeast1440p ? 280 : 235 // tweaking by hand + width: android.dimen.atLeast1440p ? 1270 : 952 + height: android.dimen.atLeast1440p ? 150 : 112 color: "#FFFFFF" } TextInput { id: addressLine focus: true - x: android.dimen.atLeast1440p?870:652 - y: android.dimen.atLeast1440p?300:245 // tweaking by hand - width: android.dimen.atLeast1440p?1200:900 - height: android.dimen.atLeast1440p?120:90 + x: android.dimen.atLeast1440p ? 870 : 652 + y: android.dimen.atLeast1440p ? 300 : 245 // tweaking by hand + width: android.dimen.atLeast1440p ? 1200 : 900 + height: android.dimen.atLeast1440p ? 120 : 90 inputMethodHints: Qt.ImhNoPredictiveText //helperText: "Hint is here" - anchors { - //verticalCenter: addressBackground.verticalCenter - } font.pixelSize: hifi.fonts.pixelSize * 3.75 onTextChanged: { //filterChoicesByText(); @@ -228,4 +225,4 @@ Item { } } -} \ No newline at end of file +} diff --git a/interface/resources/qml/hifi/+android/AvatarOption.qml b/interface/resources/qml/hifi/+android/AvatarOption.qml index e7056baa36..85d7e52eb2 100644 --- a/interface/resources/qml/hifi/+android/AvatarOption.qml +++ b/interface/resources/qml/hifi/+android/AvatarOption.qml @@ -26,13 +26,13 @@ ColumnLayout { property string methodName: ""; property string actionText: ""; - spacing: 4*3 + spacing: 4 * 3 signal sendToParentQml(var message); Image { id: itemImage - Layout.preferredWidth: 250*3 - Layout.preferredHeight: 140*3 + Layout.preferredWidth: 250 * 3 + Layout.preferredHeight: 140 * 3 source: thumbnailUrl asynchronous: true fillMode: Image.PreserveAspectFit @@ -81,7 +81,7 @@ ColumnLayout { HifiControlsUit.ImageButton { width: 140*3 height: 35*3 - text: type=="extra"? actionText: "CHOOSE" + text: type=="extra" ? actionText: "CHOOSE" source: "../../../../icons/button.svg" hoverSource: "../../../../icons/button-a.svg" fontSize: 18*3 @@ -102,8 +102,8 @@ ColumnLayout { Image { id: tickImage - width: 35*3 - height: 35*3 + width: 35 * 3 + height: 35 * 3 source: "../../../icons/tick.svg" anchors { horizontalCenter: itemName.horizontalCenter @@ -114,4 +114,4 @@ ColumnLayout { Component.onCompleted:{ sendToParentQml.connect(sendToScript); } -} \ No newline at end of file +} diff --git a/interface/resources/qml/hifi/+android/HifiConstants.qml b/interface/resources/qml/hifi/+android/HifiConstants.qml index fbdf60dcb0..4c161da259 100644 --- a/interface/resources/qml/hifi/+android/HifiConstants.qml +++ b/interface/resources/qml/hifi/+android/HifiConstants.qml @@ -22,26 +22,26 @@ Item { Item { id: dimen readonly property bool atLeast1440p: Screen.width >= 2560 && Screen.height >= 1440 - readonly property real windowLessWidth: atLeast1440p?378:284 - readonly property real windowLessHeight: atLeast1440p?192:144 + readonly property real windowLessWidth: atLeast1440p ? 378 : 284 + readonly property real windowLessHeight: atLeast1440p ? 192 : 144 readonly property real windowZ: 100 - readonly property real headerHeight: atLeast1440p?276:207 + readonly property real headerHeight: atLeast1440p ? 276 : 207 - readonly property real headerIconPosX: atLeast1440p?90:67 - readonly property real headerIconPosY: atLeast1440p?108:81 - readonly property real headerIconWidth: atLeast1440p?111:83 - readonly property real headerIconHeight: atLeast1440p?111:83 - readonly property real headerIconTitleDistance: atLeast1440p?151:113 + readonly property real headerIconPosX: atLeast1440p ? 90 : 67 + readonly property real headerIconPosY: atLeast1440p ? 108 : 81 + readonly property real headerIconWidth: atLeast1440p ? 111 : 83 + readonly property real headerIconHeight: atLeast1440p ? 111 : 83 + readonly property real headerIconTitleDistance: atLeast1440p ? 151 : 113 - readonly property real headerHideWidth: atLeast1440p?150:112 - readonly property real headerHideHeight: atLeast1440p?150:112 - readonly property real headerHideRightMargin: atLeast1440p?110:82 - readonly property real headerHideTopMargin: atLeast1440p?90:67 - readonly property real headerHideIconWidth: atLeast1440p?70:52 - readonly property real headerHideIconHeight: atLeast1440p?45:33 - readonly property real headerHideTextTopMargin: atLeast1440p?36:27 + readonly property real headerHideWidth: atLeast1440p ? 150 : 112 + readonly property real headerHideHeight: atLeast1440p ? 150 : 112 + readonly property real headerHideRightMargin: atLeast1440p ? 110 : 82 + readonly property real headerHideTopMargin: atLeast1440p ? 90 : 67 + readonly property real headerHideIconWidth: atLeast1440p ? 70 : 52 + readonly property real headerHideIconHeight: atLeast1440p ? 45 : 33 + readonly property real headerHideTextTopMargin: atLeast1440p ? 36 : 27 readonly property real botomHudWidth: 366 readonly property real botomHudHeight: 180 diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 719fbf4ae8..08500b0ebf 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1998,20 +1998,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool))); qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); - { - PROFILE_RANGE(render, "Process Default Skybox"); - auto textureCache = DependencyManager::get(); - - QFileSelector fileSelector; - fileSelector.setExtraSelectors(FileUtils::getFileSelectors()); - auto skyboxUrl = fileSelector.select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx"); - - _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl.toStdString()); - _defaultSkyboxAmbientTexture = _defaultSkyboxTexture; - - _defaultSkybox->setCubemap(_defaultSkyboxTexture); - } - EntityTreeRenderer::setEntitiesShouldFadeFunction([this]() { SharedNodePointer entityServerNode = DependencyManager::get()->soloNodeOfType(NodeType::EntityServer); return entityServerNode && !isPhysicsEnabled(); @@ -2461,7 +2447,6 @@ void Application::initializeGL() { DeadlockWatchdogThread::withPause([&] { // Set up the render engine render::CullFunctor cullFunctor = LODManager::shouldRender; - static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; _renderEngine->addJob("UpdateScene"); #ifndef Q_OS_ANDROID _renderEngine->addJob("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED); diff --git a/interface/src/Application.h b/interface/src/Application.h index 53ca90e229..f118424e5c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -272,10 +272,6 @@ public: void shareSnapshot(const QString& filename, const QUrl& href = QUrl("")); - graphics::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; } - gpu::TexturePointer getDefaultSkyboxTexture() const { return _defaultSkyboxTexture; } - gpu::TexturePointer getDefaultSkyboxAmbientTexture() const { return _defaultSkyboxAmbientTexture; } - OverlayID getTabletScreenID() const; OverlayID getTabletHomeButtonID() const; QUuid getTabletFrameID() const; // may be an entity or an overlay @@ -678,10 +674,6 @@ private: ConnectionMonitor _connectionMonitor; - graphics::SkyboxPointer _defaultSkybox { new ProceduralSkybox() } ; - gpu::TexturePointer _defaultSkyboxTexture; - gpu::TexturePointer _defaultSkyboxAmbientTexture; - QTimer _addAssetToWorldResizeTimer; QHash _addAssetToWorldResizeList; diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp index 56cbcdadf8..97f74fa24e 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp @@ -28,7 +28,7 @@ void Basic2DWindowOpenGLDisplayPlugin::customizeContext() { auto iconPath = PathUtils::resourcesPath() + "images/analog_stick.png"; auto image = QImage(iconPath); qreal dpi = getFullscreenTarget()->physicalDotsPerInch(); - _virtualPadPixelSize = dpi * 512 / 534; // 534 dpi for Pixel XL and Mate 9 Pro + _virtualPadPixelSize = dpi * VirtualPad::Manager::PIXEL_SIZE / VirtualPad::Manager::DPI; if (image.format() != QImage::Format_ARGB32) { image = image.convertToFormat(QImage::Format_ARGB32); diff --git a/libraries/display-plugins/src/display-plugins/CompositorHelper.h b/libraries/display-plugins/src/display-plugins/CompositorHelper.h index 234818c740..de115b0554 100644 --- a/libraries/display-plugins/src/display-plugins/CompositorHelper.h +++ b/libraries/display-plugins/src/display-plugins/CompositorHelper.h @@ -90,7 +90,7 @@ public: glm::vec2 getReticleMaximumPosition() const; glm::mat4 getReticleTransform(const glm::mat4& eyePose = glm::mat4(), const glm::vec3& headPosition = glm::vec3()) const; - glm::mat4 getPoint2DTransform(const glm::vec2& point = glm::vec2(), float sizeX = 512.0f, float sizeY = 512.0f) const; + glm::mat4 getPoint2DTransform(const glm::vec2& point, float sizeX , float sizeY) const; ReticleInterface* getReticleInterface() { return _reticleInterface; } diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index e323ed8fbc..c6ce179482 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -50,8 +50,8 @@ void TouchscreenVirtualPadDevice::init() { _screenDPIProvided = eventScreen->physicalDotsPerInch(); _screenDPI = eventScreen->physicalDotsPerInch(); - _fixedRadius = _screenDPI * 256 / 534; - _fixedRadiusForCalc = _fixedRadius - _screenDPI * 105 / 534; // 105 is the radius of the stick circle + _fixedRadius = _screenDPI * 0.5f * VirtualPad::Manager::PIXEL_SIZE / VirtualPad::Manager::DPI; + _fixedRadiusForCalc = _fixedRadius - _screenDPI * VirtualPad::Manager::STICK_RADIUS / VirtualPad::Manager::DPI; } auto& virtualPadManager = VirtualPad::Manager::instance(); @@ -69,7 +69,7 @@ void TouchscreenVirtualPadDevice::setupFixedCenter(VirtualPad::Manager& virtualP if (_extraBottomMargin == virtualPadManager.extraBottomMargin() && !force) return; // Our only criteria to decide a center change is the bottom margin _extraBottomMargin = virtualPadManager.extraBottomMargin(); - float margin = _screenDPI * 59 / 534; // 59px is for our 'base' of 534dpi (Pixel XL or Huawei Mate 9 Pro) + float margin = _screenDPI * VirtualPad::Manager::BASE_MARGIN / VirtualPad::Manager::DPI; QScreen* eventScreen = qApp->primaryScreen(); // do not call every time _fixedCenterPosition = glm::vec2( _fixedRadius + margin, eventScreen->size().height() - margin - _fixedRadius - _extraBottomMargin); @@ -82,10 +82,10 @@ float clip(float n, float lower, float upper) { } glm::vec2 TouchscreenVirtualPadDevice::clippedPointInCircle(float radius, glm::vec2 origin, glm::vec2 touchPoint) { - float deltaX = touchPoint.x-origin.x; - float deltaY = touchPoint.y-origin.y; + float deltaX = touchPoint.x - origin.x; + float deltaY = touchPoint.y - origin.y; - float distance = sqrt(pow(deltaX,2)+pow(deltaY,2)); + float distance = sqrt(pow(deltaX, 2) + pow(deltaY, 2)); // First case, inside the boundaires, just use the distance if (distance <= radius) { @@ -99,18 +99,18 @@ glm::vec2 TouchscreenVirtualPadDevice::clippedPointInCircle(float radius, glm::v // Third case, calculate point in circumference // line formula - float m = deltaY/deltaX; + float m = deltaY / deltaX; float b = touchPoint.y - m * touchPoint.x; // quadtratic coefs of circumference and line intersection - float qa = pow(m,2)+1; - float qb = 2 * ( m * b - origin.x - origin.y * m ); - float qc = powf(origin.x, 2) - powf(radius,2) + b * b - 2 * b * origin.y + powf(origin.y, 2); + float qa = powf(m, 2.0f) + 1.0f; + float qb = 2.0f * ( m * b - origin.x - origin.y * m); + float qc = powf(origin.x, 2.0f) - powf(radius, 2.0f) + b * b - 2.0f * b * origin.y + powf(origin.y, 2.0f); - float discr = qb * qb - 4 * qa * qc; - float discrSign = deltaX>0?1.0:-1.0; + float discr = qb * qb - 4.0f * qa * qc; + float discrSign = deltaX > 0.0f ? 1.0f : - 1.0f; - float finalX = (- qb + discrSign * sqrtf(discr)) / (2 * qa); + float finalX = (-qb + discrSign * sqrtf(discr)) / (2.0f * qa); float finalY = m * finalX + b; return vec2(finalX, finalY); diff --git a/libraries/shared/src/shared/Storage.cpp b/libraries/shared/src/shared/Storage.cpp index 683903a4e8..8fe1454242 100644 --- a/libraries/shared/src/shared/Storage.cpp +++ b/libraries/shared/src/shared/Storage.cpp @@ -85,7 +85,7 @@ FileStorage::FileStorage(const QString& filename) : _file(filename) { qCDebug(storagelogging) << "Failed to map file, falling back to memory storage " << filename; _fallback = _file.readAll(); _mapped = (uint8_t*)_fallback.data(); - } + } _valid = true; } else { qCWarning(storagelogging) << "Failed to open file " << filename; diff --git a/libraries/ui/src/VirtualPadManager.cpp b/libraries/ui/src/VirtualPadManager.cpp index 486a6c2c71..cb3ef20e67 100644 --- a/libraries/ui/src/VirtualPadManager.cpp +++ b/libraries/ui/src/VirtualPadManager.cpp @@ -34,6 +34,11 @@ namespace VirtualPad { return _currentTouch; } + const float Manager::DPI = 534.0f; + const float Manager::PIXEL_SIZE = 512.0f; + const float Manager::STICK_RADIUS = 105.0f; + const float Manager::BASE_MARGIN = 59.0f; + Manager::Manager() { } diff --git a/libraries/ui/src/VirtualPadManager.h b/libraries/ui/src/VirtualPadManager.h index 3563d333f8..6b68af3acd 100644 --- a/libraries/ui/src/VirtualPadManager.h +++ b/libraries/ui/src/VirtualPadManager.h @@ -44,6 +44,12 @@ namespace VirtualPad { void hide(bool hide); int extraBottomMargin(); void setExtraBottomMargin(int margin); + + static const float DPI; + static const float PIXEL_SIZE; + static const float STICK_RADIUS; + static const float BASE_MARGIN; + private: Instance _leftVPadInstance; bool _enabled;