diff --git a/.eslintrc.js b/.eslintrc.js
index 54ff0a1268..5667a04984 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -68,7 +68,7 @@ module.exports = {
"eqeqeq": ["error", "always"],
"indent": ["error", 4, { "SwitchCase": 1 }],
"keyword-spacing": ["error", { "before": true, "after": true }],
- "max-len": ["error", 192, 4],
+ "max-len": ["error", 128, 4],
"new-cap": ["error"],
"no-floating-decimal": ["error"],
//"no-magic-numbers": ["error", { "ignore": [0, 1], "ignoreArrayIndexes": true }],
diff --git a/.gitignore b/.gitignore
index 072e6001da..665238e7da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,9 @@ Makefile
# Android Studio
*.iml
local.properties
-android/libraries
+android/gradle*
+android/.gradle
+android/app/src/main/jniLibs
# VSCode
# List taken from Github Global Ignores master@435c4d92
@@ -64,6 +66,10 @@ gvr-interface/libs/*
# ignore files for various dev environments
TAGS
*.sw[po]
+*.qmlc
+
+# ignore QML compilation output
+*.qmlc
# ignore node files for the console
node_modules
diff --git a/BUILD_ANDROID.md b/BUILD_ANDROID.md
index cc51e58b1d..5d2e6b9293 100644
--- a/BUILD_ANDROID.md
+++ b/BUILD_ANDROID.md
@@ -1,25 +1,23 @@
-Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Android specific instructions are found in this file.
+Please read the [general build guide](BUILD.md) for information on building other platform. Only Android specific instructions are found in this file.
-# Android Dependencies
+# Dependencies
+
+*Currently Android building is only supported on 64 bit Linux host environments*
You will need the following tools to build our Android targets.
-* [Qt](http://www.qt.io/download-open-source/#) ~> 5.9.1
+* [Gradle](https://gradle.org/install/)
* [Android Studio](https://developer.android.com/studio/index.html)
-* [Google VR SDK](https://github.com/googlevr/gvr-android-sdk/releases)
-* [Gradle](https://gradle.org/releases/)
-### Qt
+### Gradle
-Download the Qt online installer. Run the installer and select the android_armv7 binaries. Installing to the default path is recommended
+Install gradle version 4.1 or higher. Following the instructions to install via [SDKMAN!](http://sdkman.io/install.html) is recommended.
### Android Studio
Download the Android Studio installer and run it. Once installed, at the welcome screen, click configure in the lower right corner and select SDK manager
-From the SDK Platforms tab, select API level 26.
-
-* Install the ARM EABI v7a System Image if you want to run an emulator.
+From the SDK Platforms tab, select API levels 24 and 26.
From the SDK Tools tab select the following
@@ -29,123 +27,41 @@ From the SDK Tools tab select the following
* LLDB
* Android SDK Platform-Tools
* Android SDK Tools
-* Android SDK Tools
* NDK (even if you have the NDK installed separately)
-### Google VR SDK
+# Environment
-Download the 1.8 Google VR SDK [release](https://github.com/googlevr/gvr-android-sdk/archive/v1.80.0.zip). Unzip the archive to a location on your drive.
-
-### Gradle
-
-Download [Gradle 4.1](https://services.gradle.org/distributions/gradle-4.1-all.zip) and unzip it on your local drive. You may wish to add the location of the bin directory within the archive to your path
+Setting up the environment for android builds requires some additional steps
#### Set up machine specific Gradle properties
-Create a `gradle.properties` file in ~/.gradle. Edit the file to contain the following
+Create a `gradle.properties` file in $HOME/.gradle. Edit the file to contain the following
- QT5_ROOT=C\:\\Qt\\5.9.1\\android_armv7
- GVR_ROOT=C\:\\Android\\gvr-android-sdk
+ HIFI_ANDROID_PRECOMPILED=/Android/hifi_externals
-Replace the paths with your local installations of Qt5 and the Google VR SDK
+Note, do not use `$HOME` for the path. It must be a fully qualified path name.
+
+### Setup the repository
+
+Clone the repository
+
+`git clone https://github.com/highfidelity/hifi.git`
+
+Enter the repository `android` directory
+
+`cd hifi/android`
+
+Execute a gradle pre-build setup. This step should only need to be done once
+
+`gradle setupDepedencies`
-# TODO fix the rest
+# Building & Running
-You will also need to cross-compile the dependencies required for all platforms for Android, and help CMake find these compiled libraries on your machine.
+* Open Android Studio
+* Choose _Open Existing Android Studio Project_
+* Navigate to the `hifi` repository and choose the `android` folder and select _OK_
+* If Android Studio asks you if you want to use the Gradle wrapper, select cancel and tell it where your local gradle installation is. If you used SDKMAN to install gradle it will be located in `$HOME/.sdkman/candidates/gradle/current/`
+* From the _Build_ menu select _Make Project_
+* Once the build completes, from the _Run_ menu select _Run App_
-#### Scribe
-
-High Fidelity has a shader pre-processing tool called `scribe` that various libraries will call on during the build process. You must compile scribe using your native toolchain (following the build instructions for your platform) and then pass a CMake variable or set an ENV variable `SCRIBE_PATH` that is a path to the scribe executable.
-
-CMake will fatally error if it does not find the scribe executable while using the android toolchain.
-
-#### Optional Components
-
-* [Oculus Mobile SDK](https://developer.oculus.com/downloads/#sdk=mobile) ~> 0.4.2
-
-#### ANDROID_LIB_DIR
-
-Since you won't be installing Android dependencies to system paths on your development machine, CMake will need a little help tracking down your Android dependencies.
-
-This is most easily accomplished by installing all Android dependencies in the same folder. You can place this folder wherever you like on your machine. In this build guide and across our CMakeLists files this folder is referred to as `ANDROID_LIB_DIR`. You can set `ANDROID_LIB_DIR` in your environment or by passing when you run CMake.
-
-#### Qt
-
-Install Qt 5.5.1 for Android for your host environment from the [Qt downloads page](http://www.qt.io/download/). Install Qt to ``$ANDROID_LIB_DIR/Qt``. This is required so that our root CMakeLists file can help CMake find your Android Qt installation.
-
-The component required for the Android build is the `Android armv7` component.
-
-If you would like to install Qt to a different location, or attempt to build with a different Qt version, you can pass `ANDROID_QT_CMAKE_PREFIX_PATH` to CMake. Point to the `cmake` folder inside `$VERSION_NUMBER/android_armv7/lib`. Otherwise, our root CMakeLists will set it to `$ANDROID_LIB_DIR/Qt/5.5/android_armv7/lib/cmake`.
-
-#### OpenSSL
-
-Cross-compilation of OpenSSL has been tested from an OS X machine running 10.10 compiling OpenSSL 1.0.2. It is likely that the steps below will work for other OpenSSL versions than 1.0.2.
-
-The original instructions to compile OpenSSL for Android from your host environment can be found [here](http://wiki.openssl.org/index.php/Android). We required some tweaks to get OpenSSL to successfully compile, those tweaks are explained below.
-
-Download the [OpenSSL source](https://www.openssl.org/source/) and extract the tarball inside your `ANDROID_LIB_DIR`. Rename the extracted folder to `openssl`.
-
-You will need the [setenv-android.sh script](http://wiki.openssl.org/index.php/File:Setenv-android.sh) from the OpenSSL wiki.
-
-You must change three values at the top of the `setenv-android.sh` script - `_ANDROID_NDK`, `_ANDROID_EABI` and `_ANDROID_API`.
-`_ANDROID_NDK` should be `android-ndk-r10`, `_ANDROID_EABI` should be `arm-linux-androidebi-4.9` and `_ANDROID_API` should be `19`.
-
-First, make sure `ANDROID_NDK_ROOT` is set in your env. This should be the path to the root of your Android NDK install. `setenv-android.sh` needs `ANDROID_NDK_ROOT` to set the environment variables required for building OpenSSL.
-
-Source the `setenv-android.sh` script so it can set environment variables that OpenSSL will use while compiling. If you use zsh as your shell you may need to modify the `setenv-android.sh` for it to set the correct variables in your env.
-
-```
-export ANDROID_NDK_ROOT=YOUR_NDK_ROOT
-source setenv-android.sh
-```
-
-Then, from the OpenSSL directory, run the following commands.
-
-```
-perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
-./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/usr/local/ssl/$ANDROID_API
-make depend
-make all
-```
-
-This should generate libcrypto and libssl in the root of the OpenSSL directory. YOU MUST remove the `libssl.so` and `libcrypto.so` files that are generated. They are symlinks to `libssl.so.VER` and `libcrypto.so.VER` which Android does not know how to handle. By removing `libssl.so` and `libcrypto.so` the FindOpenSSL module will find the static libs and use those instead.
-
-If you have been building other components it is possible that the OpenSSL compile will fail based on the values other cross-compilations (tbb, bullet) have set. Ensure that you are in a new terminal window to avoid compilation errors from previously set environment variables.
-
-#### Oculus Mobile SDK
-
-The Oculus Mobile SDK is optional, for Gear VR support. It is not required to compile gvr-interface.
-
-Download the [Oculus Mobile SDK](https://developer.oculus.com/downloads/#sdk=mobile) and extract the archive inside your `ANDROID_LIB_DIR` folder. Rename the extracted folder to `libovr`.
-
-From the VRLib directory, use ndk-build to build VrLib.
-
-```
-cd VRLib
-ndk-build
-```
-
-This will create the liboculus.a archive that our FindLibOVR module will look for when cmake is run.
-
-##### Hybrid testing
-
-Currently the 'vr_dual' mode that would allow us to run a hybrid app has limited support in the Oculus Mobile SDK. The best way to have an application we can launch without having to connect to the GearVR is to put the Gear VR Service into developer mode. This stops Oculus Home from taking over the device when it is plugged into the Gear VR headset, and allows the application to be launched from the Applications page.
-
-To put the Gear VR Service into developer mode you need an application with an Oculus Signature File on your device. Generate an Oculus Signature File for your device on the [Oculus osig tool page](https://developer.oculus.com/tools/osig/). Place this file in the gvr-interface/assets directory. Cmake will automatically copy it into your apk in the right place when you execute `make gvr-interface-apk`.
-
-Once the application is on your device, go to `Settings->Application Manager->Gear VR Service->Manage Storage`. Tap on `VR Service Version` six times. It will scan your device to verify that you have an osig file in an application on your device, and then it will let you enable Developer mode.
-
-### CMake
-
-We use CMake to generate the makefiles that compile and deploy the Android APKs to your device. In order to create Makefiles for the Android targets, CMake requires that some environment variables are set, and that other variables are passed to it when it is run.
-
-The following must be set in your environment:
-
-* ANDROID_NDK - the root of your Android NDK install
-* ANDROID_HOME - the root of your Android SDK install
-* ANDROID_LIB_DIR - the directory containing cross-compiled versions of dependencies
-
-The following must be passed to CMake when it is run:
-
-* USE_ANDROID_TOOLCHAIN - set to true to build for Android
diff --git a/README.md b/README.md
index 6294981e9a..e0bbed3105 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,10 @@ Documentation is available at [docs.highfidelity.com](https://docs.highfidelity.
There is also detailed [documentation on our coding standards](https://wiki.highfidelity.com/wiki/Coding_Standards).
+Contributor License Agreement (CLA)
+=========
+Technology companies frequently receive and use code from contributors outside the company's development team. Outside code can be a tremendous resource, but it also carries responsibility. Best practice for accepting outside contributions consists of an Apache-type Contributor License Agreement (CLA). We have modeled the High Fidelity CLA after the CLA that Google presents to developers for contributions to their projects. This CLA does not transfer ownership of code, instead simply granting a non-exclusive right for High Fidelity to use the code you’ve contributed. In that regard, you should be sure you have permission if the work relates to or uses the resources of a company that you work for. You will be asked to sign our CLA when you create your first PR or when the CLA is updated. You can also [review it here](https://gist.githubusercontent.com/hifi-gustavo/fef8f06a8233d42a0040d45c3efb97a9/raw/9981827eb94f0b18666083670b6f6a02929fb402/High%2520Fidelity%2520CLA). We sincerely appreciate your contribution and efforts toward the success of the platform.
+
Build Instructions
=========
All information required to build is found in the [build guide](BUILD.md).
diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt
index 2d6df925e9..3d4516d0bf 100644
--- a/android/app/CMakeLists.txt
+++ b/android/app/CMakeLists.txt
@@ -1,8 +1,10 @@
set(TARGET_NAME native-lib)
setup_hifi_library()
-link_hifi_libraries(shared networking gl gpu gpu-gles render-utils)
-autoscribe_shader_lib(gpu model render render-utils)
-target_opengl()
+link_hifi_libraries(shared networking gl gpu gpu-gles image fbx render-utils physics)
+
target_link_libraries(native-lib android log m)
-target_include_directories(native-lib PRIVATE "${GVR_ROOT}/libraries/headers")
-target_link_libraries(native-lib "C:/Users/bdavis/Git/hifi/android/libraries/jni/armeabi-v7a/libgvr.so")
+
+target_opengl()
+target_googlevr()
+
+
diff --git a/android/app/build.gradle b/android/app/build.gradle
index bd1c596bf3..29b7e4a6cc 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -1,27 +1,32 @@
apply plugin: 'com.android.application'
+ext.RELEASE_NUMBER = project.hasProperty('RELEASE_NUMBER') ? project.getProperty('RELEASE_NUMBER') : '0'
+ext.RELEASE_TYPE = project.hasProperty('RELEASE_TYPE') ? project.getProperty('RELEASE_TYPE') : 'DEV'
+ext.BUILD_BRANCH = project.hasProperty('BUILD_BRANCH') ? project.getProperty('BUILD_BRANCH') : ''
+
android {
compileSdkVersion 26
- buildToolsVersion "26.0.1"
defaultConfig {
applicationId "org.saintandreas.testapp"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
- ndk { abiFilters 'armeabi-v7a' }
+ ndk { abiFilters 'arm64-v8a' }
externalNativeBuild {
cmake {
arguments '-DHIFI_ANDROID=1',
'-DANDROID_PLATFORM=android-24',
'-DANDROID_TOOLCHAIN=clang',
- '-DANDROID_STL=gnustl_shared',
- '-DGVR_ROOT=' + GVR_ROOT,
- '-DNATIVE_SCRIBE=c:/bin/scribe.exe',
- "-DHIFI_ANDROID_PRECOMPILED=${project.rootDir}/libraries/jni/armeabi-v7a"
+ '-DANDROID_STL=c++_shared',
+ '-DQT_CMAKE_PREFIX_PATH=' + HIFI_ANDROID_PRECOMPILED + '/qt/lib/cmake',
+ '-DNATIVE_SCRIBE=' + HIFI_ANDROID_PRECOMPILED + '/scribe',
+ '-DHIFI_ANDROID_PRECOMPILED=' + HIFI_ANDROID_PRECOMPILED,
+ '-DRELEASE_NUMBER=' + RELEASE_NUMBER,
+ '-DRELEASE_TYPE=' + RELEASE_TYPE,
+ '-DBUILD_BRANCH=' + BUILD_BRANCH
}
}
- jackOptions { enabled true }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
@@ -29,17 +34,20 @@ android {
}
buildTypes {
+ applicationVariants.all { variant ->
+ variant.outputs.all {
+ if (RELEASE_NUMBER != '0') {
+ outputFileName = "app_" + RELEASE_NUMBER + "_" + RELEASE_TYPE + ".apk"
+ }
+ }
+ }
+
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
- sourceSets {
- main {
- jniLibs.srcDirs += '../libraries/jni';
- }
- }
externalNativeBuild {
cmake {
path '../../CMakeLists.txt'
@@ -53,5 +61,3 @@ dependencies {
compile 'com.google.vr:sdk-audio:1.80.0'
compile 'com.google.vr:sdk-base:1.80.0'
}
-
-build.dependsOn(':extractQt5')
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 05547bd5ae..c96ac0ef90 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -7,12 +7,10 @@
-
-
-
-
-
-
-
-
diff --git a/android/app/src/main/cpp/native-lib.cpp b/android/app/src/main/cpp/native-lib.cpp
index 156d43d849..fe21a250de 100644
--- a/android/app/src/main/cpp/native-lib.cpp
+++ b/android/app/src/main/cpp/native-lib.cpp
@@ -37,12 +37,7 @@ extern "C" {
JNI_METHOD(jlong, nativeCreateRenderer)
(JNIEnv *env, jclass clazz, jobject class_loader, jobject android_context, jlong native_gvr_api) {
qInstallMessageHandler(messageHandler);
-#if defined(GVR)
- auto gvrContext = reinterpret_cast(native_gvr_api);
- return toJni(new NativeRenderer(gvrContext));
-#else
- return toJni(new NativeRenderer(nullptr));
-#endif
+ return toJni(new NativeRenderer());
}
JNI_METHOD(void, nativeDestroyRenderer)
diff --git a/android/app/src/main/cpp/renderer.cpp b/android/app/src/main/cpp/renderer.cpp
index a877ebd777..3b23b7e187 100644
--- a/android/app/src/main/cpp/renderer.cpp
+++ b/android/app/src/main/cpp/renderer.cpp
@@ -1,138 +1,14 @@
#include "renderer.h"
#include
+#include
#include
+
#include
-
-#include "GoogleVRHelpers.h"
-
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-#include
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#if 0
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
-
-template
-void withFrameBuffer(gvr::Frame& frame, int32_t index, F f) {
- frame.BindBuffer(index);
- f();
- frame.Unbind();
-}
-
-
-static const uint64_t kPredictionTimeWithoutVsyncNanos = 50000000;
-
-// Each shader has two variants: a single-eye ES 2.0 variant, and a multiview
-// ES 3.0 variant. The multiview vertex shaders use transforms defined by
-// arrays of mat4 uniforms, using gl_ViewID_OVR to determine the array index.
-
-#define UNIFORM_LIGHT_POS 20
-#define UNIFORM_M 16
-#define UNIFORM_MV 8
-#define UNIFORM_MVP 0
-
-#if 0
-uniform Transform { // API uses “Transform[2]” to refer to instance 2
- mat4 u_MVP[2];
- mat4 u_MVMatrix[2];
- mat4 u_Model;
- vec3 u_LightPos[2];
-};
-static const char *kDiffuseLightingVertexShader = R"glsl(
-#version 300 es
-#extension GL_OVR_multiview2 : enable
-
-layout(num_views=2) in;
-
-layout(location = 0) uniform mat4 u_MVP[2];
-layout(location = 8) uniform mat4 u_MVMatrix[2];
-layout(location = 16) uniform mat4 u_Model;
-layout(location = 20) uniform vec3 u_LightPos[2];
-
-layout(location = 0) in vec4 a_Position;
-layout(location = 1) in vec4 a_Color;
-layout(location = 2) in vec3 a_Normal;
-
-out vec4 v_Color;
-out vec3 v_Grid;
-
-void main() {
- mat4 mvp = u_MVP[gl_ViewID_OVR];
- mat4 modelview = u_MVMatrix[gl_ViewID_OVR];
- vec3 lightpos = u_LightPos[gl_ViewID_OVR];
- v_Grid = vec3(u_Model * a_Position);
- vec3 modelViewVertex = vec3(modelview * a_Position);
- vec3 modelViewNormal = vec3(modelview * vec4(a_Normal, 0.0));
- float distance = length(lightpos - modelViewVertex);
- vec3 lightVector = normalize(lightpos - modelViewVertex);
- float diffuse = max(dot(modelViewNormal, lightVector), 0.5);
- diffuse = diffuse * (1.0 / (1.0 + (0.00001 * distance * distance)));
- v_Color = vec4(a_Color.rgb * diffuse, a_Color.a);
- gl_Position = mvp * a_Position;
-}
-)glsl";
-#endif
-
-
-static const char *kSimepleVertexShader = R"glsl(
-#version 300 es
+static const char *kSimepleVertexShader = R"glsl(#version 300 es
#extension GL_OVR_multiview2 : enable
layout(num_views=2) in;
@@ -147,9 +23,7 @@ void main() {
}
)glsl";
-
-static const char *kPassthroughFragmentShader = R"glsl(
-#version 300 es
+static const char *kPassthroughFragmentShader = R"glsl(#version 300 es
precision mediump float;
in vec4 v_Color;
out vec4 FragColor;
@@ -157,6 +31,17 @@ out vec4 FragColor;
void main() { FragColor = v_Color; }
)glsl";
+
+int LoadGLShader(int type, const char *shadercode) {
+ GLuint result = 0;
+ std::string shaderError;
+ static const std::string SHADER_DEFINES;
+ if (!gl::compileShader(type, shadercode, SHADER_DEFINES, result, shaderError)) {
+ qWarning() << "QQQ" << __FUNCTION__ << "Shader compile failure" << shaderError.c_str();
+ }
+ return result;
+}
+
static void CheckGLError(const char* label) {
int gl_error = glGetError();
if (gl_error != GL_NO_ERROR) {
@@ -167,158 +52,6 @@ static void CheckGLError(const char* label) {
}
// Contains vertex, normal and other data.
-namespace cube {
- const std::array CUBE_COORDS{{
- // Front face
- -1.0f, 1.0f, 1.0f,
- -1.0f, -1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f, -1.0f, 1.0f,
- 1.0f, -1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
-
- // Right face
- 1.0f, 1.0f, 1.0f,
- 1.0f, -1.0f, 1.0f,
- 1.0f, 1.0f, -1.0f,
- 1.0f, -1.0f, 1.0f,
- 1.0f, -1.0f, -1.0f,
- 1.0f, 1.0f, -1.0f,
-
- // Back face
- 1.0f, 1.0f, -1.0f,
- 1.0f, -1.0f, -1.0f,
- -1.0f, 1.0f, -1.0f,
- 1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, -1.0f,
- -1.0f, 1.0f, -1.0f,
-
- // Left face
- -1.0f, 1.0f, -1.0f,
- -1.0f, -1.0f, -1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
-
- // Top face
- -1.0f, 1.0f, -1.0f,
- -1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, -1.0f,
- -1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, -1.0f,
-
- // Bottom face
- 1.0f, -1.0f, -1.0f,
- 1.0f, -1.0f, 1.0f,
- -1.0f, -1.0f, -1.0f,
- 1.0f, -1.0f, 1.0f,
- -1.0f, -1.0f, 1.0f,
- -1.0f, -1.0f, -1.0f
- }};
-
- const std::array CUBE_COLORS{{
- // front, green
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
-
- // right, blue
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
-
- // back, also green
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
- 0.0f, 0.5273f, 0.2656f,
-
- // left, also blue
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
- 0.0f, 0.3398f, 0.9023f,
-
- // top, red
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
-
- // bottom, also red
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f,
- 0.8359375f, 0.17578125f, 0.125f
- }};
-
- const std::array CUBE_NORMALS{{
- // Front face
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
-
- // Right face
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
-
- // Back face
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
-
- // Left face
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
-
- // Top face
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
-
- // Bottom face
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f
- }};
-}
-
namespace triangle {
static std::array TRIANGLE_VERTS {{
-0.5f, -0.5f, 0.0f,
@@ -327,229 +60,36 @@ namespace triangle {
}};
}
-std::array buildViewports(const std::unique_ptr &gvrapi) {
- return { {gvrapi->CreateBufferViewport(), gvrapi->CreateBufferViewport()} };
-};
-
-const std::string VERTEX_SHADER_DEFINES{ R"GLSL(
-#version 300 es
-#extension GL_EXT_clip_cull_distance : enable
-#define GPU_VERTEX_SHADER
-#define GPU_SSBO_TRANSFORM_OBJECT 1
-#define GPU_TRANSFORM_IS_STEREO
-#define GPU_TRANSFORM_STEREO_CAMERA
-#define GPU_TRANSFORM_STEREO_CAMERA_INSTANCED
-#define GPU_TRANSFORM_STEREO_SPLIT_SCREEN
-)GLSL" };
-
-const std::string PIXEL_SHADER_DEFINES{ R"GLSL(
-#version 300 es
-precision mediump float;
-#define GPU_PIXEL_SHADER
-#define GPU_TRANSFORM_IS_STEREO
-#define GPU_TRANSFORM_STEREO_CAMERA
-#define GPU_TRANSFORM_STEREO_CAMERA_INSTANCED
-#define GPU_TRANSFORM_STEREO_SPLIT_SCREEN
-)GLSL" };
-
-
-#if defined(GVR)
-NativeRenderer::NativeRenderer(gvr_context *vrContext) :
- _gvrapi(new gvr::GvrApi(vrContext, false)),
- _viewports(buildViewports(_gvrapi)),
- _gvr_viewer_type(_gvrapi->GetViewerType())
-#else
-NativeRenderer::NativeRenderer(void *vrContext)
-#endif
-{
- start = std::chrono::system_clock::now();
- qDebug() << "QQQ" << __FUNCTION__;
-}
-
-
-/**
- * Converts a raw text file, saved as a resource, into an OpenGL ES shader.
- *
- * @param type The type of shader we will be creating.
- * @param resId The resource ID of the raw text file.
- * @return The shader object handler.
- */
-int LoadGLShader(int type, const char *shadercode) {
- GLuint result = 0;
- std::string shaderError;
- static const std::string SHADER_DEFINES;
- if (!gl::compileShader(type, shadercode, SHADER_DEFINES, result, shaderError)) {
- qWarning() << "QQQ" << __FUNCTION__ << "Shader compile failure" << shaderError.c_str();
- }
- return result;
-}
-
-// Computes a texture size that has approximately half as many pixels. This is
-// equivalent to scaling each dimension by approximately sqrt(2)/2.
-static gvr::Sizei HalfPixelCount(const gvr::Sizei &in) {
- // Scale each dimension by sqrt(2)/2 ~= 7/10ths.
- gvr::Sizei out;
- out.width = (7 * in.width) / 10;
- out.height = (7 * in.height) / 10;
- return out;
-}
-
-
-#if defined(GVR)
-void NativeRenderer::InitializeVR() {
- _gvrapi->InitializeGl();
- bool multiviewEnabled = _gvrapi->IsFeatureSupported(GVR_FEATURE_MULTIVIEW);
- qWarning() << "QQQ" << __FUNCTION__ << "Multiview enabled " << multiviewEnabled;
- // Because we are using 2X MSAA, we can render to half as many pixels and
- // achieve similar quality.
- _renderSize = HalfPixelCount(_gvrapi->GetMaximumEffectiveRenderTargetSize());
-
- std::vector specs;
- specs.push_back(_gvrapi->CreateBufferSpec());
- specs[0].SetColorFormat(GVR_COLOR_FORMAT_RGBA_8888);
- specs[0].SetDepthStencilFormat(GVR_DEPTH_STENCIL_FORMAT_DEPTH_16);
- specs[0].SetSamples(2);
- gvr::Sizei half_size = {_renderSize.width / 2, _renderSize.height};
- specs[0].SetMultiviewLayers(2);
- specs[0].SetSize(half_size);
-
- _swapchain.reset(new gvr::SwapChain(_gvrapi->CreateSwapChain(specs)));
- _viewportlist.reset(new gvr::BufferViewportList(_gvrapi->CreateEmptyBufferViewportList()));
-}
-void NativeRenderer::PrepareFramebuffer() {
- const gvr::Sizei recommended_size = HalfPixelCount(
- _gvrapi->GetMaximumEffectiveRenderTargetSize());
- if (_renderSize.width != recommended_size.width ||
- _renderSize.height != recommended_size.height) {
- // We need to resize the framebuffer. Note that multiview uses two texture
- // layers, each with half the render width.
- gvr::Sizei framebuffer_size = recommended_size;
- framebuffer_size.width /= 2;
- _swapchain->ResizeBuffer(0, framebuffer_size);
- _renderSize = recommended_size;
- }
-}
-#endif
-
-void testShaderBuild(const char* vs_src, const char * fs_src) {
- std::string error;
- GLuint vs, fs;
- if (!gl::compileShader(GL_VERTEX_SHADER, vs_src, VERTEX_SHADER_DEFINES, vs, error) ||
- !gl::compileShader(GL_FRAGMENT_SHADER, fs_src, PIXEL_SHADER_DEFINES, fs, error)) {
- throw std::runtime_error("Failed to compile shader");
- }
- auto pr = gl::compileProgram({ vs, fs }, error);
- if (!pr) {
- throw std::runtime_error("Failed to link shader");
- }
-}
void NativeRenderer::InitializeGl() {
- qDebug() << "QQQ" << __FUNCTION__;
- //gl::initModuleGl();
-#if defined(GVR)
- InitializeVR();
-#endif
-
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
-
-
const uint32_t vertShader = LoadGLShader(GL_VERTEX_SHADER, kSimepleVertexShader);
- //const uint32_t vertShader = LoadGLShader(GL_VERTEX_SHADER, kDiffuseLightingVertexShader);
const uint32_t fragShader = LoadGLShader(GL_FRAGMENT_SHADER, kPassthroughFragmentShader);
std::string error;
- _cubeProgram = gl::compileProgram({ vertShader, fragShader }, error);
+ _program = gl::compileProgram({ vertShader, fragShader }, error);
CheckGLError("build program");
- glGenBuffers(1, &_cubeBuffer);
- glBindBuffer(GL_ARRAY_BUFFER, _cubeBuffer);
+ glGenBuffers(1, &_geometryBuffer);
+ glBindBuffer(GL_ARRAY_BUFFER, _geometryBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 9, triangle::TRIANGLE_VERTS.data(), GL_STATIC_DRAW);
- /*
- glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 108 * 3, NULL, GL_STATIC_DRAW);
- glBufferSubData(GL_ARRAY_BUFFER, sizeof(float) * 108 * 0, sizeof(float) * 108, cube::CUBE_COORDS.data());
- glBufferSubData(GL_ARRAY_BUFFER, sizeof(float) * 108 * 1, sizeof(float) * 108, cube::CUBE_COLORS.data());
- glBufferSubData(GL_ARRAY_BUFFER, sizeof(float) * 108 * 2, sizeof(float) * 108, cube::CUBE_NORMALS.data());
- */
glBindBuffer(GL_ARRAY_BUFFER, 0);
CheckGLError("upload vertices");
- glGenVertexArrays(1, &_cubeVao);
- glBindBuffer(GL_ARRAY_BUFFER, _cubeBuffer);
- glBindVertexArray(_cubeVao);
+ glGenVertexArrays(1, &_vao);
+ glBindBuffer(GL_ARRAY_BUFFER, _geometryBuffer);
+ glBindVertexArray(_vao);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
- /*
- glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
- glEnableVertexAttribArray(0);
- glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, (const void*)(sizeof(float) * 108 * 1) );
- glEnableVertexAttribArray(1);
- glVertexAttribPointer(2, 3, GL_FLOAT, false, 0, (const void*)(sizeof(float) * 108 * 2));
- glEnableVertexAttribArray(2);
- */
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CheckGLError("build vao ");
-
- static std::once_flag once;
- std::call_once(once, [&]{
- testShaderBuild(sdf_text3D_vert, sdf_text3D_frag);
-
- testShaderBuild(DrawTransformUnitQuad_vert, DrawTexture_frag);
- testShaderBuild(DrawTexcoordRectTransformUnitQuad_vert, DrawTexture_frag);
- testShaderBuild(DrawViewportQuadTransformTexcoord_vert, DrawTexture_frag);
- testShaderBuild(DrawTransformUnitQuad_vert, DrawTextureOpaque_frag);
- testShaderBuild(DrawTransformUnitQuad_vert, DrawColoredTexture_frag);
-
- testShaderBuild(simple_vert, simple_frag);
- testShaderBuild(simple_vert, simple_textured_frag);
- testShaderBuild(simple_vert, simple_textured_unlit_frag);
- testShaderBuild(deferred_light_vert, directional_ambient_light_frag);
- testShaderBuild(deferred_light_vert, directional_skybox_light_frag);
- testShaderBuild(standardTransformPNTC_vert, standardDrawTexture_frag);
- testShaderBuild(standardTransformPNTC_vert, DrawTextureOpaque_frag);
-
- testShaderBuild(model_vert, model_frag);
- testShaderBuild(model_normal_map_vert, model_normal_map_frag);
- testShaderBuild(model_vert, model_specular_map_frag);
- testShaderBuild(model_normal_map_vert, model_normal_specular_map_frag);
- testShaderBuild(model_vert, model_translucent_frag);
- testShaderBuild(model_normal_map_vert, model_translucent_frag);
- testShaderBuild(model_lightmap_vert, model_lightmap_frag);
- testShaderBuild(model_lightmap_normal_map_vert, model_lightmap_normal_map_frag);
- testShaderBuild(model_lightmap_vert, model_lightmap_specular_map_frag);
- testShaderBuild(model_lightmap_normal_map_vert, model_lightmap_normal_specular_map_frag);
-
- testShaderBuild(skin_model_vert, model_frag);
- testShaderBuild(skin_model_normal_map_vert, model_normal_map_frag);
- testShaderBuild(skin_model_vert, model_specular_map_frag);
- testShaderBuild(skin_model_normal_map_vert, model_normal_specular_map_frag);
- testShaderBuild(skin_model_vert, model_translucent_frag);
- testShaderBuild(skin_model_normal_map_vert, model_translucent_frag);
-
- testShaderBuild(model_shadow_vert, model_shadow_frag);
-
- testShaderBuild(overlay3D_vert, overlay3D_frag);
-
-#if 0
- testShaderBuild(textured_particle_vert, textured_particle_frag);
- testShaderBuild(skybox_vert, skybox_frag);
- testShaderBuild(paintStroke_vert,paintStroke_frag);
- testShaderBuild(polyvox_vert, polyvox_frag);
-#endif
-
- });
-
- qDebug() << "done";
}
-static const float kZNear = 1.0f;
-static const float kZFar = 100.0f;
-static const gvr_rectf fullscreen = {0, 1, 0, 1};
void NativeRenderer::DrawFrame() {
auto now = std::chrono::duration_cast(
@@ -559,65 +99,12 @@ void NativeRenderer::DrawFrame() {
v.g = 1.0f - v.r;
v.b = 1.0f;
- PrepareFramebuffer();
-
- // A client app does its rendering here.
- gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow();
- target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos;
-
- using namespace googlevr;
- using namespace bilateral;
- const auto gvrHeadPose = _gvrapi->GetHeadSpaceFromStartSpaceRotation(target_time);
- _head_view = toGlm(gvrHeadPose);
- _viewportlist->SetToRecommendedBufferViewports();
-
- glm::mat4 eye_views[2];
- for_each_side([&](bilateral::Side side) {
- int eye = index(side);
- const gvr::Eye gvr_eye = eye == 0 ? GVR_LEFT_EYE : GVR_RIGHT_EYE;
- const auto& eyeView = eye_views[eye] = toGlm(_gvrapi->GetEyeFromHeadMatrix(gvr_eye)) * _head_view;
- auto& viewport = _viewports[eye];
-
- _viewportlist->GetBufferViewport(eye, &viewport);
- viewport.SetSourceUv(fullscreen);
- viewport.SetSourceLayer(eye);
- _viewportlist->SetBufferViewport(eye, viewport);
- const auto &mvc = _modelview_cube[eye] = eyeView * _model_cube;
- const auto &mvf = _modelview_floor[eye] = eyeView * _model_floor;
- const gvr_rectf fov = viewport.GetSourceFov();
- const glm::mat4 perspective = perspectiveMatrixFromView(fov, kZNear, kZFar);
- _modelview_projection_cube[eye] = perspective * mvc;
- _modelview_projection_floor[eye] = perspective * mvf;
- _light_pos_eye_space[eye] = glm::vec3(eyeView * _light_pos_world_space);
- });
-
-
- gvr::Frame frame = _swapchain->AcquireFrame();
- withFrameBuffer(frame, 0, [&]{
- glClearColor(v.r, v.g, v.b, 1);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glViewport(0, 0, _renderSize.width / 2, _renderSize.height);
- glUseProgram(_cubeProgram);
- glBindVertexArray(_cubeVao);
- glDrawArrays(GL_TRIANGLES, 0, 3);
- /*
- float* fp;
- fp = (float*)&_light_pos_eye_space[0];
- glUniform3fv(UNIFORM_LIGHT_POS, 2, fp);
- fp = (float*)&_modelview_cube[0];
- glUniformMatrix4fv(UNIFORM_MV, 2, GL_FALSE, fp);
- fp = (float*)&_modelview_projection_cube[0];
- glUniformMatrix4fv(UNIFORM_MVP, 2, GL_FALSE, fp);
- fp = (float*)&_model_cube;
- glUniformMatrix4fv(UNIFORM_M, 1, GL_FALSE, fp);
- glDrawArrays(GL_TRIANGLES, 0, 36);
- */
- glBindVertexArray(0);
- });
-
- frame.Submit(*_viewportlist, gvrHeadPose);
- CheckGLError("onDrawFrame");
-
+ glClearColor(v.r, v.g, v.b, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glUseProgram(_program);
+ glBindVertexArray(_vao);
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+ glBindVertexArray(0);
}
void NativeRenderer::OnTriggerEvent() {
@@ -626,11 +113,8 @@ void NativeRenderer::OnTriggerEvent() {
void NativeRenderer::OnPause() {
qDebug() << "QQQ" << __FUNCTION__;
- _gvrapi->PauseTracking();
}
void NativeRenderer::OnResume() {
qDebug() << "QQQ" << __FUNCTION__;
- _gvrapi->ResumeTracking();
- _gvrapi->RefreshViewerProfile();
}
diff --git a/android/app/src/main/cpp/renderer.h b/android/app/src/main/cpp/renderer.h
index df7c51cab4..522f672e3b 100644
--- a/android/app/src/main/cpp/renderer.h
+++ b/android/app/src/main/cpp/renderer.h
@@ -4,21 +4,8 @@
#include
#include
-#define GVR
-
-#if defined(GVR)
-#include
-#endif
-
class NativeRenderer {
public:
-
-#if defined(GVR)
- NativeRenderer(gvr_context* vrContext);
-#else
- NativeRenderer(void* vrContext);
-#endif
-
void InitializeGl();
void DrawFrame();
void OnTriggerEvent();
@@ -26,35 +13,9 @@ public:
void OnResume();
private:
+ std::chrono::time_point start { std::chrono::system_clock::now() };
-
- std::chrono::time_point start;
-#if defined(GVR)
- void InitializeVR();
- void PrepareFramebuffer();
-
- std::unique_ptr _gvrapi;
- gvr::ViewerType _gvr_viewer_type;
- std::unique_ptr _viewportlist;
- std::unique_ptr _swapchain;
- std::array _viewports;
- gvr::Sizei _renderSize;
-#endif
-
- uint32_t _cubeBuffer { 0 };
- uint32_t _cubeVao { 0 };
- uint32_t _cubeProgram { 0 };
-
- glm::mat4 _head_view;
- glm::mat4 _model_cube;
- glm::mat4 _camera;
- glm::mat4 _view;
- glm::mat4 _model_floor;
-
- std::array _modelview_cube;
- std::array _modelview_floor;
- std::array _modelview_projection_cube;
- std::array _modelview_projection_floor;
- std::array _light_pos_eye_space;
- const glm::vec4 _light_pos_world_space{ 0, 2, 0, 1};
+ uint32_t _geometryBuffer { 0 };
+ uint32_t _vao { 0 };
+ uint32_t _program { 0 };
};
diff --git a/android/app/src/main/java/org/saintandreas/testapp/MainActivity.java b/android/app/src/main/java/org/saintandreas/testapp/MainActivity.java
index 7eea14dce9..65e6c394e7 100644
--- a/android/app/src/main/java/org/saintandreas/testapp/MainActivity.java
+++ b/android/app/src/main/java/org/saintandreas/testapp/MainActivity.java
@@ -26,10 +26,9 @@ public class MainActivity extends Activity {
}
private long nativeRenderer;
- private GvrLayout gvrLayout;
private GLSurfaceView surfaceView;
- private native long nativeCreateRenderer(ClassLoader appClassLoader, Context context, long nativeGvrContext);
+ private native long nativeCreateRenderer(ClassLoader appClassLoader, Context context);
private native void nativeDestroyRenderer(long renderer);
private native void nativeInitializeGl(long renderer);
private native void nativeDrawFrame(long renderer);
@@ -55,30 +54,21 @@ public class MainActivity extends Activity {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { setImmersiveSticky(); }
});
- gvrLayout = new GvrLayout(this);
nativeRenderer = nativeCreateRenderer(
getClass().getClassLoader(),
- getApplicationContext(),
- gvrLayout.getGvrApi().getNativeGvrContext());
+ getApplicationContext());
surfaceView = new GLSurfaceView(this);
surfaceView.setEGLContextClientVersion(3);
surfaceView.setEGLConfigChooser(8, 8, 8, 0, 0, 0);
surfaceView.setPreserveEGLContextOnPause(true);
surfaceView.setRenderer(new NativeRenderer());
-
- gvrLayout.setPresentationView(surfaceView);
- setContentView(gvrLayout);
- if (gvrLayout.setAsyncReprojectionEnabled(true)) {
- AndroidCompat.setSustainedPerformanceMode(this, true);
- }
- AndroidCompat.setVrModeEnabled(this, true);
+ setContentView(surfaceView);
}
@Override
protected void onDestroy() {
super.onDestroy();
- gvrLayout.shutdown();
nativeDestroyRenderer(nativeRenderer);
nativeRenderer = 0;
}
@@ -87,14 +77,12 @@ public class MainActivity extends Activity {
protected void onPause() {
surfaceView.queueEvent(()->nativeOnPause(nativeRenderer));
surfaceView.onPause();
- gvrLayout.onPause();
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
- gvrLayout.onResume();
surfaceView.onResume();
surfaceView.queueEvent(()->nativeOnResume(nativeRenderer));
}
diff --git a/android/build.gradle b/android/build.gradle
index 77c3dd498c..75b1b7ad4e 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,91 +1,216 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.3'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.android.tools.build:gradle:3.0.1'
}
}
+plugins {
+ id 'de.undercouch.download' version '3.3.0'
+}
+
allprojects {
repositories {
jcenter()
+ google()
}
}
+
+def baseFolder = new File(HIFI_ANDROID_PRECOMPILED)
+def jniFolder = new File('app/src/main/jniLibs/arm64-v8a')
+
+import org.apache.tools.ant.taskdefs.condition.Os
+
+def baseUrl = 'https://hifi-public.s3.amazonaws.com/austin/android/'
+def qtFile='qt-5.9.3_linux_armv8-libcpp.tgz'
+def qtChecksum='547da3547d5690144e23d6504c6d6e91'
+if (Os.isFamily(Os.FAMILY_MAC)) {
+ qtFile = 'qt-5.9.3_osx_armv8-libcpp.tgz'
+ qtChecksum='6fa3e068cfdee863fc909b294a3a0cc6'
+} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ qtFile = 'qt-5.9.3_win_armv8-libcpp.tgz'
+ qtChecksum='3a757378a7e9dbbfc662177e0eb46408'
+}
+
+def packages = [
+ qt: [
+ file: qtFile,
+ checksum: qtChecksum,
+ sharedLibFolder: '',
+ includeLibs: ['lib/*.so', 'plugins/*/*.so']
+ ],
+ bullet: [
+ file: 'bullet-2.83_armv8-libcpp.tgz',
+ checksum: '2c558d604fce337f5eba3eb7ec1252fd'
+ ],
+ draco: [
+ file: 'draco_armv8-libcpp.tgz',
+ checksum: '617a80d213a5ec69fbfa21a1f2f738cd'
+ ],
+ gvr: [
+ file: 'gvrsdk_v1.101.0.tgz',
+ checksum: '57fd02baa069176ba18597a29b6b4fc7'
+ ],
+ openssl: [
+ file: 'openssl-1.1.0g_armv8.tgz',
+ checksum: 'cabb681fbccd79594f65fcc266e02f32'
+ ],
+ polyvox: [
+ file: 'polyvox_armv8-libcpp.tgz',
+ checksum: '5c918288741ee754c16aeb12bb46b9e1',
+ sharedLibFolder: 'lib',
+ includeLibs: ['Release/libPolyVoxCore.so', 'libPolyVoxUtil.so']
+ ],
+ tbb: [
+ file: 'tbb-2018_U1_armv8_libcpp.tgz',
+ checksum: '20768f298f53b195e71b414b0ae240c4',
+ sharedLibFolder: 'lib/release',
+ includeLibs: ['libtbb.so', 'libtbbmalloc.so']
+ ]
+]
+
+task downloadDependencies {
+ doLast {
+ packages.each { entry ->
+ def filename = entry.value['file'];
+ def url = baseUrl + filename;
+ download {
+ src url
+ dest new File(baseFolder, filename)
+ onlyIfNewer true
+ }
+ }
+ }
+}
+
+import de.undercouch.gradle.tasks.download.Verify
+
+task verifyQt(type: Verify) { def p = packages['qt']; src new File(baseFolder, p['file']); checksum p['checksum']; }
+task verifyBullet(type: Verify) { def p = packages['bullet']; src new File(baseFolder, p['file']); checksum p['checksum'] }
+task verifyDraco(type: Verify) { def p = packages['draco']; src new File(baseFolder, p['file']); checksum p['checksum'] }
+task verifyGvr(type: Verify) { def p = packages['gvr']; src new File(baseFolder, p['file']); checksum p['checksum'] }
+task verifyOpenSSL(type: Verify) { def p = packages['openssl']; src new File(baseFolder, p['file']); checksum p['checksum'] }
+task verifyPolyvox(type: Verify) { def p = packages['polyvox']; src new File(baseFolder, p['file']); checksum p['checksum'] }
+task verifyTBB(type: Verify) { def p = packages['tbb']; src new File(baseFolder, p['file']); checksum p['checksum'] }
+
+task verifyDependencyDownloads(dependsOn: downloadDependencies) { }
+verifyDependencyDownloads.dependsOn verifyQt
+verifyDependencyDownloads.dependsOn verifyBullet
+verifyDependencyDownloads.dependsOn verifyDraco
+verifyDependencyDownloads.dependsOn verifyGvr
+verifyDependencyDownloads.dependsOn verifyOpenSSL
+verifyDependencyDownloads.dependsOn verifyPolyvox
+verifyDependencyDownloads.dependsOn verifyTBB
+
+task extractDependencies(dependsOn: verifyDependencyDownloads) {
+ doLast {
+ packages.each { entry ->
+ def folder = entry.key;
+ def filename = entry.value['file'];
+ def localFile = new File(HIFI_ANDROID_PRECOMPILED, filename)
+ def localFolder = new File(HIFI_ANDROID_PRECOMPILED, folder)
+ copy {
+ from tarTree(resources.gzip(localFile))
+ into localFolder
+ }
+ }
+ }
+}
+
+task copyDependencies(dependsOn: extractDependencies) {
+ doLast {
+ packages.each { entry ->
+ def packageName = entry.key
+ def currentPackage = entry.value;
+ if (currentPackage.containsKey('sharedLibFolder')) {
+ def localFolder = new File(baseFolder, packageName + '/' + currentPackage['sharedLibFolder'])
+ def tree = fileTree(localFolder);
+ if (currentPackage.containsKey('includeLibs')) {
+ currentPackage['includeLibs'].each { includeSpec -> tree.include includeSpec }
+ }
+ tree.visit { element ->
+ if (!element.file.isDirectory()) {
+ copy { from element.file; into jniFolder }
+ }
+ }
+ }
+ }
+ }
+}
+
+def scribeFile='scribe_linux_x86_64'
+def scribeLocalFile='scribe'
+def scribeChecksum='c98678d9726bd8bbf1bab792acf3ff6c'
+if (Os.isFamily(Os.FAMILY_MAC)) {
+ scribeFile = 'scribe_osx_x86_64'
+ scribeChecksum='a137ad62c1bf7cca739da219544a9a16'
+} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ scribeFile = 'scribe_win32_x86_64.exe'
+ scribeLocalFile = 'scribe.exe'
+ scribeChecksum='75c2ce9ed45d17de375e3988bfaba816'
+
+}
+
+import de.undercouch.gradle.tasks.download.Download
+
+task downloadScribe(type: Download) {
+ src baseUrl + scribeFile
+ dest new File(baseFolder, scribeLocalFile)
+ onlyIfNewer true
+}
+
+task verifyScribe (type: Verify, dependsOn: downloadScribe) {
+ src new File(baseFolder, scribeLocalFile);
+ checksum scribeChecksum
+}
+
+task fixScribePermissions(type: Exec, dependsOn: verifyScribe) {
+ commandLine 'chmod', 'a+x', HIFI_ANDROID_PRECOMPILED + '/' + scribeLocalFile
+}
+
+task setupScribe(dependsOn: verifyScribe) { }
+
+// On Windows, we don't need to set the executable bit, but on OSX and Unix we do
+if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
+ setupScribe.dependsOn fixScribePermissions
+}
+
+task extractGvrBinaries(dependsOn: extractDependencies) {
+ doLast {
+ def gvrLibFolder = new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries');
+ zipTree(new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries/sdk-audio-1.101.0.aar')).visit { element ->
+ def fileName = element.file.toString();
+ if (fileName.endsWith('libgvr_audio.so') && fileName.contains('arm64-v8a')) {
+ copy { from element.file; into gvrLibFolder }
+ }
+ }
+ zipTree(new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries/sdk-base-1.101.0.aar')).visit { element ->
+ def fileName = element.file.toString();
+ if (fileName.endsWith('libgvr.so') && fileName.contains('arm64-v8a')) {
+ copy { from element.file; into gvrLibFolder }
+ }
+ }
+ fileTree(gvrLibFolder).visit { element ->
+ if (element.file.toString().endsWith('.so')) {
+ copy { from element.file; into jniFolder }
+ }
+ }
+ }
+
+}
+
+task setupDependencies(dependsOn: [setupScribe, copyDependencies, extractGvrBinaries]) {
+}
+
+task cleanDependencies(type: Delete) {
+ delete HIFI_ANDROID_PRECOMPILED
+ delete 'app/src/main/jniLibs/arm64-v8a'
+}
+
task clean(type: Delete) {
delete rootProject.buildDir
}
-
-task extractQt5jars(type: Copy) {
- from fileTree(QT5_ROOT + "/jar")
- into("${project.rootDir}/libraries/jar")
- include("*.jar")
-}
-
-task extractQt5so(type: Copy) {
- from fileTree(QT5_ROOT + "/lib")
- into("${project.rootDir}/libraries/jni/armeabi-v7a/")
- include("libQt5AndroidExtras.so")
- include("libQt5Concurrent.so")
- include("libQt5Core.so")
- include("libQt5Gamepad.so")
- include("libQt5Gui.so")
- include("libQt5Location.so")
- include("libQt5Multimedia.so")
- include("libQt5MultimediaQuick_p.so")
- include("libQt5Network.so")
- include("libQt5NetworkAuth.so")
- include("libQt5OpenGL.so")
- include("libQt5Positioning.so")
- include("libQt5Qml.so")
- include("libQt5Quick.so")
- include("libQt5QuickControls2.so")
- include("libQt5QuickParticles.so")
- include("libQt5QuickTemplates2.so")
- include("libQt5QuickWidgets.so")
- include("libQt5Script.so")
- include("libQt5ScriptTools.so")
- include("libQt5Sensors.so")
- include("libQt5Svg.so")
- include("libQt5WebChannel.so")
- include("libQt5WebSockets.so")
- include("libQt5WebView.so")
- include("libQt5Widgets.so")
- include("libQt5Xml.so")
- include("libQt5XmlPatterns.so")
-}
-
-task extractAudioSo(type: Copy) {
- from zipTree(GVR_ROOT + "/libraries/sdk-audio-1.80.0.aar")
- into "${project.rootDir}/libraries/"
- include "jni/armeabi-v7a/libgvr_audio.so"
-}
-
-task extractGvrSo(type: Copy) {
- from zipTree(GVR_ROOT + "/libraries/sdk-base-1.80.0.aar")
- into "${project.rootDir}/libraries/"
- include "jni/armeabi-v7a/libgvr.so"
-}
-
-task extractNdk { }
-extractNdk.dependsOn extractAudioSo
-extractNdk.dependsOn extractGvrSo
-
-task extractQt5 { }
-extractQt5.dependsOn extractQt5so
-extractQt5.dependsOn extractQt5jars
-
-task extractBinaries { }
-extractBinaries.dependsOn extractQt5
-extractBinaries.dependsOn extractNdk
-
-task deleteBinaries(type: Delete) {
- delete "${project.rootDir}/libraries/jni"
-}
-
-//clean.dependsOn(deleteBinaries)
diff --git a/android/setupGVR.gradle b/android/setupGVR.gradle
new file mode 100644
index 0000000000..c91674068f
--- /dev/null
+++ b/android/setupGVR.gradle
@@ -0,0 +1,41 @@
+buildscript {
+ repositories {
+ jcenter()
+ google()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.0.1'
+ classpath 'de.undercouch:gradle-download-task:3.3.0'
+ }
+}
+
+
+def file='gvrsdk_v1.101.0.tgz'
+def url='https://hifi-public.s3.amazonaws.com/austin/android/' + file
+def destFile = new File(HIFI_ANDROID_PRECOMPILED, file)
+
+// FIXME find a way to only download if the file doesn't exist
+task downloadGVR(type: de.undercouch.gradle.tasks.download.Download) {
+ src url
+ dest destFile
+}
+
+task extractGVR(dependsOn: downloadGVR, type: Copy) {
+ from tarTree(resources.gzip(destFile))
+ into new File(HIFI_ANDROID_PRECOMPILED, 'gvr')
+}
+
+task copyGVRAudioLibs(dependsOn: extractGVR, type: Copy) {
+ from zipTree(new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries/sdk-audio-1.101.0.aar'))
+ include 'jni/arm64-v8a/libgvr_audio.so'
+ into HIFI_ANDROID_PRECOMPILED
+}
+
+task copyGVRLibs(dependsOn: extractGVR, type: Copy) {
+ from zipTree(new File(HIFI_ANDROID_PRECOMPILED, 'gvr/gvr-android-sdk-1.101.0/libraries/sdk-base-1.101.0.aar'))
+ include 'jni/arm64-v8a/libgvr.so'
+ into HIFI_ANDROID_PRECOMPILED
+}
+
+task setupGVR(dependsOn: [copyGVRLibs, copyGVRAudioLibs]) {
+}
diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt
index 0421195612..e657587a7a 100644
--- a/assignment-client/CMakeLists.txt
+++ b/assignment-client/CMakeLists.txt
@@ -13,9 +13,25 @@ setup_memory_debugger()
link_hifi_libraries(
audio avatars octree gpu model fbx entities
networking animation recording shared script-engine embedded-webserver
- controllers physics plugins midi baking image
+ controllers physics plugins midi image
)
+add_dependencies(${TARGET_NAME} oven)
+
+if (WIN32)
+ add_custom_command(
+ TARGET ${TARGET_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ $
+ $)
+else()
+ add_custom_command(
+ TARGET ${TARGET_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ $
+ $/oven)
+endif()
+
if (WIN32)
package_libraries_for_deployment()
endif()
diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp
index 4efc3343d1..f166a780ff 100644
--- a/assignment-client/src/Agent.cpp
+++ b/assignment-client/src/Agent.cpp
@@ -441,7 +441,7 @@ void Agent::executeScript() {
Transform audioTransform;
auto headOrientation = scriptedAvatar->getHeadOrientation();
- audioTransform.setTranslation(scriptedAvatar->getPosition());
+ audioTransform.setTranslation(scriptedAvatar->getWorldPosition());
audioTransform.setRotation(headOrientation);
QByteArray encodedBuffer;
@@ -452,7 +452,7 @@ void Agent::executeScript() {
}
AbstractAudioInterface::emitAudioPacket(encodedBuffer.data(), encodedBuffer.size(), audioSequenceNumber,
- audioTransform, scriptedAvatar->getPosition(), glm::vec3(0),
+ audioTransform, scriptedAvatar->getWorldPosition(), glm::vec3(0),
packetType, _selectedCodecName);
});
@@ -742,10 +742,10 @@ void Agent::processAgentAvatarAudio() {
audioPacket->writePrimitive(numAvailableSamples);
// use the orientation and position of this avatar for the source of this audio
- audioPacket->writePrimitive(scriptedAvatar->getPosition());
+ audioPacket->writePrimitive(scriptedAvatar->getWorldPosition());
glm::quat headOrientation = scriptedAvatar->getHeadOrientation();
audioPacket->writePrimitive(headOrientation);
- audioPacket->writePrimitive(scriptedAvatar->getPosition());
+ audioPacket->writePrimitive(scriptedAvatar->getWorldPosition());
audioPacket->writePrimitive(glm::vec3(0));
// no matter what, the loudness should be set to 0
@@ -759,10 +759,10 @@ void Agent::processAgentAvatarAudio() {
audioPacket->writePrimitive((quint8)0);
// use the orientation and position of this avatar for the source of this audio
- audioPacket->writePrimitive(scriptedAvatar->getPosition());
+ audioPacket->writePrimitive(scriptedAvatar->getWorldPosition());
glm::quat headOrientation = scriptedAvatar->getHeadOrientation();
audioPacket->writePrimitive(headOrientation);
- audioPacket->writePrimitive(scriptedAvatar->getPosition());
+ audioPacket->writePrimitive(scriptedAvatar->getWorldPosition()); // HUH? why do we write this twice??
audioPacket->writePrimitive(glm::vec3(0));
QByteArray encodedBuffer;
diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp
index 5539d6a0bb..1868ccfafe 100644
--- a/assignment-client/src/AssignmentClientMonitor.cpp
+++ b/assignment-client/src/AssignmentClientMonitor.cpp
@@ -28,6 +28,10 @@
const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor";
const int WAIT_FOR_CHILD_MSECS = 1000;
+#ifdef Q_OS_WIN
+HANDLE PROCESS_GROUP = createProcessGroup();
+#endif
+
AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks,
const unsigned int minAssignmentClientForks,
const unsigned int maxAssignmentClientForks,
@@ -202,6 +206,10 @@ void AssignmentClientMonitor::spawnChildClient() {
assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels);
assignmentClient->start(QCoreApplication::applicationFilePath(), _childArguments);
+#ifdef Q_OS_WIN
+ addProcessToGroup(PROCESS_GROUP, assignmentClient->processId());
+#endif
+
QString stdoutPath, stderrPath;
if (_wantsChildFileLogging) {
diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp
index ca0f222e0c..1b533f10f3 100644
--- a/assignment-client/src/assets/AssetServer.cpp
+++ b/assignment-client/src/assets/AssetServer.cpp
@@ -29,11 +29,10 @@
#include
#include
-#include
-#include
#include
#include
#include
+#include
#include "AssetServerLogging.h"
#include "BakeAssetTask.h"
@@ -250,7 +249,7 @@ AssetServer::AssetServer(ReceivedMessage& message) :
image::setNormalTexturesCompressionEnabled(true);
image::setCubeTexturesCompressionEnabled(true);
- BAKEABLE_TEXTURE_EXTENSIONS = TextureBaker::getSupportedFormats();
+ BAKEABLE_TEXTURE_EXTENSIONS = image::getSupportedFormats();
qDebug() << "Supported baking texture formats:" << BAKEABLE_MODEL_EXTENSIONS;
// Most of the work will be I/O bound, reading from disk and constructing packet objects,
@@ -416,6 +415,9 @@ void AssetServer::completeSetup() {
if (assetsFilesizeLimit != 0 && assetsFilesizeLimit < MAX_UPLOAD_SIZE) {
_filesizeLimit = assetsFilesizeLimit * BITS_PER_MEGABITS;
}
+
+ PathUtils::removeTemporaryApplicationDirs();
+ PathUtils::removeTemporaryApplicationDirs("Oven");
}
void AssetServer::cleanupUnmappedFiles() {
diff --git a/assignment-client/src/assets/BakeAssetTask.cpp b/assignment-client/src/assets/BakeAssetTask.cpp
index 6c78d2baf3..49322ca4cb 100644
--- a/assignment-client/src/assets/BakeAssetTask.cpp
+++ b/assignment-client/src/assets/BakeAssetTask.cpp
@@ -11,11 +11,18 @@
#include "BakeAssetTask.h"
-#include
+#include
+
+#include
+#include
-#include
#include
-#include
+
+static const int OVEN_STATUS_CODE_SUCCESS { 0 };
+static const int OVEN_STATUS_CODE_FAIL { 1 };
+static const int OVEN_STATUS_CODE_ABORT { 2 };
+
+std::once_flag registerMetaTypesFlag;
BakeAssetTask::BakeAssetTask(const AssetHash& assetHash, const AssetPath& assetPath, const QString& filePath) :
_assetHash(assetHash),
@@ -23,6 +30,10 @@ BakeAssetTask::BakeAssetTask(const AssetHash& assetHash, const AssetPath& assetP
_filePath(filePath)
{
+ std::call_once(registerMetaTypesFlag, []() {
+ qRegisterMetaType("QProcess::ProcessError");
+ qRegisterMetaType("QProcess::ExitStatus");
+ });
}
void cleanupTempFiles(QString tempOutputDir, std::vector files) {
@@ -41,67 +52,76 @@ void cleanupTempFiles(QString tempOutputDir, std::vector files) {
};
void BakeAssetTask::run() {
- _isBaking.store(true);
-
- qRegisterMetaType >("QVector");
- TextureBakerThreadGetter fn = []() -> QThread* { return QThread::currentThread(); };
-
- QString tempOutputDir;
-
- if (_assetPath.endsWith(".fbx")) {
- tempOutputDir = PathUtils::generateTemporaryDir();
- _baker = std::unique_ptr {
- new FBXBaker(QUrl("file:///" + _filePath), fn, tempOutputDir)
- };
- } else if (_assetPath.endsWith(".js", Qt::CaseInsensitive)) {
- _baker = std::unique_ptr{
- new JSBaker(QUrl("file:///" + _filePath), PathUtils::generateTemporaryDir())
- };
- } else {
- tempOutputDir = PathUtils::generateTemporaryDir();
- _baker = std::unique_ptr {
- new TextureBaker(QUrl("file:///" + _filePath), image::TextureUsage::CUBE_TEXTURE,
- tempOutputDir)
- };
+ if (_isBaking.exchange(true)) {
+ qWarning() << "Tried to start bake asset task while already baking";
+ return;
}
- QEventLoop loop;
- connect(_baker.get(), &Baker::finished, &loop, &QEventLoop::quit);
- connect(_baker.get(), &Baker::aborted, &loop, &QEventLoop::quit);
- QMetaObject::invokeMethod(_baker.get(), "bake", Qt::QueuedConnection);
- loop.exec();
+ QString tempOutputDir = PathUtils::generateTemporaryDir();
+ auto base = QFileInfo(QCoreApplication::applicationFilePath()).absoluteDir();
+ QString path = base.absolutePath() + "/oven";
+ QString extension = _assetPath.mid(_assetPath.lastIndexOf('.') + 1);
+ QStringList args {
+ "-i", _filePath,
+ "-o", tempOutputDir,
+ "-t", extension,
+ };
- if (_baker->wasAborted()) {
- qDebug() << "Aborted baking: " << _assetHash << _assetPath;
+ _ovenProcess.reset(new QProcess());
- _wasAborted.store(true);
+ connect(_ovenProcess.get(), static_cast(&QProcess::finished),
+ this, [this, tempOutputDir](int exitCode, QProcess::ExitStatus exitStatus) {
+ qDebug() << "Baking process finished: " << exitCode << exitStatus;
- cleanupTempFiles(tempOutputDir, _baker->getOutputFiles());
+ if (exitStatus == QProcess::CrashExit) {
+ if (_wasAborted) {
+ emit bakeAborted(_assetHash, _assetPath);
+ } else {
+ QString errors = "Fatal error occurred while baking";
+ emit bakeFailed(_assetHash, _assetPath, errors);
+ }
+ } else if (exitCode == OVEN_STATUS_CODE_SUCCESS) {
+ QDir outputDir = tempOutputDir;
+ auto files = outputDir.entryInfoList(QDir::Files);
+ QVector outputFiles;
+ for (auto& file : files) {
+ outputFiles.push_back(file.absoluteFilePath());
+ }
- emit bakeAborted(_assetHash, _assetPath);
- } else if (_baker->hasErrors()) {
- qDebug() << "Failed to bake: " << _assetHash << _assetPath << _baker->getErrors();
+ emit bakeComplete(_assetHash, _assetPath, tempOutputDir, outputFiles);
+ } else if (exitStatus == QProcess::NormalExit && exitCode == OVEN_STATUS_CODE_ABORT) {
+ _wasAborted.store(true);
+ emit bakeAborted(_assetHash, _assetPath);
+ } else {
+ QString errors;
+ if (exitCode == OVEN_STATUS_CODE_FAIL) {
+ QDir outputDir = tempOutputDir;
+ auto errorFilePath = outputDir.absoluteFilePath("errors.txt");
+ QFile errorFile { errorFilePath };
+ if (errorFile.open(QIODevice::ReadOnly)) {
+ errors = errorFile.readAll();
+ errorFile.close();
+ } else {
+ errors = "Unknown error occurred while baking";
+ }
+ }
+ emit bakeFailed(_assetHash, _assetPath, errors);
+ }
- auto errors = _baker->getErrors().join('\n'); // Join error list into a single string for convenience
-
- _didFinish.store(true);
-
- cleanupTempFiles(tempOutputDir, _baker->getOutputFiles());
+ });
+ qDebug() << "Starting oven for " << _assetPath;
+ _ovenProcess->start(path, args, QIODevice::ReadOnly);
+ if (!_ovenProcess->waitForStarted(-1)) {
+ QString errors = "Oven process failed to start";
emit bakeFailed(_assetHash, _assetPath, errors);
- } else {
- auto vectorOutputFiles = QVector::fromStdVector(_baker->getOutputFiles());
-
- qDebug() << "Finished baking: " << _assetHash << _assetPath << vectorOutputFiles;
-
- _didFinish.store(true);
-
- emit bakeComplete(_assetHash, _assetPath, tempOutputDir, vectorOutputFiles);
+ return;
}
+ _ovenProcess->waitForFinished();
}
void BakeAssetTask::abort() {
- if (_baker) {
- _baker->abort();
+ if (!_wasAborted.exchange(true)) {
+ _ovenProcess->terminate();
}
}
diff --git a/assignment-client/src/assets/BakeAssetTask.h b/assignment-client/src/assets/BakeAssetTask.h
index 90458ac223..c73a8bff65 100644
--- a/assignment-client/src/assets/BakeAssetTask.h
+++ b/assignment-client/src/assets/BakeAssetTask.h
@@ -17,9 +17,10 @@
#include
#include
#include
+#include
+#include
#include
-#include
class BakeAssetTask : public QObject, public QRunnable {
Q_OBJECT
@@ -32,7 +33,6 @@ public:
void abort();
bool wasAborted() const { return _wasAborted.load(); }
- bool didFinish() const { return _didFinish.load(); }
signals:
void bakeComplete(QString assetHash, QString assetPath, QString tempOutputDir, QVector outputFiles);
@@ -44,9 +44,8 @@ private:
AssetHash _assetHash;
AssetPath _assetPath;
QString _filePath;
- std::unique_ptr _baker;
+ std::unique_ptr _ovenProcess { nullptr };
std::atomic _wasAborted { false };
- std::atomic _didFinish { false };
};
#endif // hifi_BakeAssetTask_h
diff --git a/assignment-client/src/audio/AudioMixer.cpp b/assignment-client/src/audio/AudioMixer.cpp
index 9ed6c7fdbc..7f088d8183 100644
--- a/assignment-client/src/audio/AudioMixer.cpp
+++ b/assignment-client/src/audio/AudioMixer.cpp
@@ -29,6 +29,7 @@
#include
#include
+#include "AudioLogging.h"
#include "AudioHelpers.h"
#include "AudioRingBuffer.h"
#include "AudioMixerClientData.h"
@@ -130,7 +131,7 @@ void AudioMixer::queueReplicatedAudioPacket(QSharedPointer mess
PacketType rewrittenType = PacketTypeEnum::getReplicatedPacketMapping().key(message->getType());
if (rewrittenType == PacketType::Unknown) {
- qDebug() << "Cannot unwrap replicated packet type not present in REPLICATED_PACKET_WRAPPING";
+ qCDebug(audio) << "Cannot unwrap replicated packet type not present in REPLICATED_PACKET_WRAPPING";
}
auto replicatedMessage = QSharedPointer::create(audioData, rewrittenType,
@@ -345,7 +346,7 @@ void AudioMixer::sendStatsPacket() {
void AudioMixer::run() {
- qDebug() << "Waiting for connection to domain to request settings from domain-server.";
+ qCDebug(audio) << "Waiting for connection to domain to request settings from domain-server.";
// wait until we have the domain-server settings, otherwise we bail
DomainHandler& domainHandler = DependencyManager::get()->getDomainHandler();
@@ -502,14 +503,14 @@ void AudioMixer::throttle(std::chrono::microseconds duration, int frame) {
int proportionalTerm = 1 + (_trailingMixRatio - TARGET) / 0.1f;
_throttlingRatio += THROTTLE_RATE * proportionalTerm;
_throttlingRatio = std::min(_throttlingRatio, 1.0f);
- qDebug("audio-mixer is struggling (%f mix/sleep) - throttling %f of streams",
- (double)_trailingMixRatio, (double)_throttlingRatio);
+ qCDebug(audio) << "audio-mixer is struggling (" << _trailingMixRatio << "mix/sleep) - throttling"
+ << _throttlingRatio << "of streams";
} else if (_throttlingRatio > 0.0f && _trailingMixRatio <= BACKOFF_TARGET) {
int proportionalTerm = 1 + (TARGET - _trailingMixRatio) / 0.2f;
_throttlingRatio -= BACKOFF_RATE * proportionalTerm;
_throttlingRatio = std::max(_throttlingRatio, 0.0f);
- qDebug("audio-mixer is recovering (%f mix/sleep) - throttling %f of streams",
- (double)_trailingMixRatio, (double)_throttlingRatio);
+ qCDebug(audio) << "audio-mixer is recovering (" << _trailingMixRatio << "mix/sleep) - throttling"
+ << _throttlingRatio << "of streams";
}
}
}
@@ -534,7 +535,7 @@ void AudioMixer::clearDomainSettings() {
}
void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
- qDebug() << "AVX2 Support:" << (cpuSupportsAVX2() ? "enabled" : "disabled");
+ qCDebug(audio) << "AVX2 Support:" << (cpuSupportsAVX2() ? "enabled" : "disabled");
if (settingsObject.contains(AUDIO_THREADING_GROUP_KEY)) {
QJsonObject audioThreadingGroupObject = settingsObject[AUDIO_THREADING_GROUP_KEY].toObject();
@@ -557,7 +558,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
const QString DYNAMIC_JITTER_BUFFER_JSON_KEY = "dynamic_jitter_buffer";
bool enableDynamicJitterBuffer = audioBufferGroupObject[DYNAMIC_JITTER_BUFFER_JSON_KEY].toBool();
if (enableDynamicJitterBuffer) {
- qDebug() << "Enabling dynamic jitter buffers.";
+ qCDebug(audio) << "Enabling dynamic jitter buffers.";
bool ok;
const QString DESIRED_JITTER_BUFFER_FRAMES_KEY = "static_desired_jitter_buffer_frames";
@@ -565,9 +566,9 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
if (!ok) {
_numStaticJitterFrames = InboundAudioStream::DEFAULT_STATIC_JITTER_FRAMES;
}
- qDebug() << "Static desired jitter buffer frames:" << _numStaticJitterFrames;
+ qCDebug(audio) << "Static desired jitter buffer frames:" << _numStaticJitterFrames;
} else {
- qDebug() << "Disabling dynamic jitter buffers.";
+ qCDebug(audio) << "Disabling dynamic jitter buffers.";
_numStaticJitterFrames = DISABLE_STATIC_JITTER_FRAMES;
}
@@ -621,7 +622,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
if (audioEnvGroupObject[CODEC_PREFERENCE_ORDER].isString()) {
QString codecPreferenceOrder = audioEnvGroupObject[CODEC_PREFERENCE_ORDER].toString();
_codecPreferenceOrder = codecPreferenceOrder.split(",");
- qDebug() << "Codec preference order changed to" << _codecPreferenceOrder;
+ qCDebug(audio) << "Codec preference order changed to" << _codecPreferenceOrder;
}
const QString ATTENATION_PER_DOULING_IN_DISTANCE = "attenuation_per_doubling_in_distance";
@@ -630,7 +631,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
float attenuation = audioEnvGroupObject[ATTENATION_PER_DOULING_IN_DISTANCE].toString().toFloat(&ok);
if (ok) {
_attenuationPerDoublingInDistance = attenuation;
- qDebug() << "Attenuation per doubling in distance changed to" << _attenuationPerDoublingInDistance;
+ qCDebug(audio) << "Attenuation per doubling in distance changed to" << _attenuationPerDoublingInDistance;
}
}
@@ -640,7 +641,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
float noiseMutingThreshold = audioEnvGroupObject[NOISE_MUTING_THRESHOLD].toString().toFloat(&ok);
if (ok) {
_noiseMutingThreshold = noiseMutingThreshold;
- qDebug() << "Noise muting threshold changed to" << _noiseMutingThreshold;
+ qCDebug(audio) << "Noise muting threshold changed to" << _noiseMutingThreshold;
}
}
@@ -680,8 +681,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
glm::vec3 dimensions(xMax - xMin, yMax - yMin, zMax - zMin);
AABox zoneAABox(corner, dimensions);
_audioZones.insert(zone, zoneAABox);
- qDebug() << "Added zone:" << zone << "(corner:" << corner
- << ", dimensions:" << dimensions << ")";
+ qCDebug(audio) << "Added zone:" << zone << "(corner:" << corner << ", dimensions:" << dimensions << ")";
}
}
}
@@ -712,7 +712,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
_audioZones.contains(settings.source) && _audioZones.contains(settings.listener)) {
_zoneSettings.push_back(settings);
- qDebug() << "Added Coefficient:" << settings.source << settings.listener << settings.coefficient;
+ qCDebug(audio) << "Added Coefficient:" << settings.source << settings.listener << settings.coefficient;
}
}
}
@@ -745,7 +745,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
_zoneReverbSettings.push_back(settings);
- qDebug() << "Added Reverb:" << zone << reverbTime << wetLevel;
+ qCDebug(audio) << "Added Reverb:" << zone << reverbTime << wetLevel;
}
}
}
diff --git a/assignment-client/src/audio/AudioMixerClientData.cpp b/assignment-client/src/audio/AudioMixerClientData.cpp
index 9bba9c7f30..49453c6fc6 100644
--- a/assignment-client/src/audio/AudioMixerClientData.cpp
+++ b/assignment-client/src/audio/AudioMixerClientData.cpp
@@ -19,6 +19,7 @@
#include "InjectedAudioStream.h"
+#include "AudioLogging.h"
#include "AudioHelpers.h"
#include "AudioMixer.h"
#include "AudioMixerClientData.h"
@@ -132,7 +133,7 @@ void AudioMixerClientData::optionallyReplicatePacket(ReceivedMessage& message, c
if (PacketTypeEnum::getReplicatedPacketMapping().key(message.getType()) != PacketType::Unknown) {
mirroredType = message.getType();
} else {
- qDebug() << "Packet passed to optionallyReplicatePacket was not a replicatable type - returning";
+ qCDebug(audio) << "Packet passed to optionallyReplicatePacket was not a replicatable type - returning";
return;
}
}
@@ -189,8 +190,16 @@ void AudioMixerClientData::parsePerAvatarGainSet(ReceivedMessage& message, const
uint8_t packedGain;
message.readPrimitive(&packedGain);
float gain = unpackFloatGainFromByte(packedGain);
- hrtfForStream(avatarUuid, QUuid()).setGainAdjustment(gain);
- qDebug() << "Setting gain adjustment for hrtf[" << uuid << "][" << avatarUuid << "] to " << gain;
+
+ if (avatarUuid.isNull()) {
+ // set the MASTER avatar gain
+ setMasterAvatarGain(gain);
+ qCDebug(audio) << "Setting MASTER avatar gain for " << uuid << " to " << gain;
+ } else {
+ // set the per-source avatar gain
+ hrtfForStream(avatarUuid, QUuid()).setGainAdjustment(gain);
+ qCDebug(audio) << "Setting avatar gain adjustment for hrtf[" << uuid << "][" << avatarUuid << "] to " << gain;
+ }
}
void AudioMixerClientData::parseNodeIgnoreRequest(QSharedPointer message, const SharedNodePointer& node) {
@@ -276,7 +285,7 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
auto avatarAudioStream = new AvatarAudioStream(isStereo, AudioMixer::getStaticJitterFrames());
avatarAudioStream->setupCodec(_codec, _selectedCodecName, AudioConstants::MONO);
- qDebug() << "creating new AvatarAudioStream... codec:" << _selectedCodecName;
+ qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName;
connect(avatarAudioStream, &InboundAudioStream::mismatchedAudioCodec,
this, &AudioMixerClientData::handleMismatchAudioFormat);
@@ -315,7 +324,7 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
#if INJECTORS_SUPPORT_CODECS
injectorStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
- qDebug() << "creating new injectorStream... codec:" << _selectedCodecName;
+ qCDebug(audio) << "creating new injectorStream... codec:" << _selectedCodecName;
#endif
auto emplaced = _audioStreams.emplace(
@@ -339,8 +348,8 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
auto parseResult = matchingStream->parseData(message);
if (matchingStream->getOverflowCount() > overflowBefore) {
- qDebug() << "Just overflowed on stream from" << message.getSourceID() << "at" << message.getSenderSockAddr();
- qDebug() << "This stream is for" << (isMicStream ? "microphone audio" : "injected audio");
+ qCDebug(audio) << "Just overflowed on stream from" << message.getSourceID() << "at" << message.getSenderSockAddr();
+ qCDebug(audio) << "This stream is for" << (isMicStream ? "microphone audio" : "injected audio");
}
return parseResult;
@@ -689,7 +698,7 @@ void AudioMixerClientData::setupCodecForReplicatedAgent(QSharedPointerreadString();
if (codecString != _selectedCodecName) {
- qDebug() << "Manually setting codec for replicated agent" << uuidStringWithoutCurlyBraces(getNodeID())
+ qCDebug(audio) << "Manually setting codec for replicated agent" << uuidStringWithoutCurlyBraces(getNodeID())
<< "-" << codecString;
const std::pair codec = AudioMixer::negotiateCodec({ codecString });
diff --git a/assignment-client/src/audio/AudioMixerClientData.h b/assignment-client/src/audio/AudioMixerClientData.h
index 7a8690d8cc..c3a31715ea 100644
--- a/assignment-client/src/audio/AudioMixerClientData.h
+++ b/assignment-client/src/audio/AudioMixerClientData.h
@@ -83,6 +83,9 @@ public:
// uses randomization to have the AudioMixer send a stats packet to this node around every second
bool shouldSendStats(int frameNumber);
+ float getMasterAvatarGain() const { return _masterAvatarGain; }
+ void setMasterAvatarGain(float gain) { _masterAvatarGain = gain; }
+
AudioLimiter audioLimiter;
void setupCodec(CodecPluginPointer codec, const QString& codecName);
@@ -175,6 +178,8 @@ private:
int _frameToSendStats { 0 };
+ float _masterAvatarGain { 1.0f }; // per-listener mixing gain, applied only to avatars
+
CodecPluginPointer _codec;
QString _selectedCodecName;
Encoder* _encoder{ nullptr }; // for outbound mixed stream
diff --git a/assignment-client/src/audio/AudioMixerSlave.cpp b/assignment-client/src/audio/AudioMixerSlave.cpp
index a131e266d2..6d150a0dc3 100644
--- a/assignment-client/src/audio/AudioMixerSlave.cpp
+++ b/assignment-client/src/audio/AudioMixerSlave.cpp
@@ -48,8 +48,8 @@ void sendEnvironmentPacket(const SharedNodePointer& node, AudioMixerClientData&
// mix helpers
inline float approximateGain(const AvatarAudioStream& listeningNodeStream, const PositionalAudioStream& streamToAdd,
const glm::vec3& relativePosition);
-inline float computeGain(const AvatarAudioStream& listeningNodeStream, const PositionalAudioStream& streamToAdd,
- const glm::vec3& relativePosition, bool isEcho);
+inline float computeGain(const AudioMixerClientData& listenerNodeData, const AvatarAudioStream& listeningNodeStream,
+ const PositionalAudioStream& streamToAdd, const glm::vec3& relativePosition, bool isEcho);
inline float computeAzimuth(const AvatarAudioStream& listeningNodeStream, const PositionalAudioStream& streamToAdd,
const glm::vec3& relativePosition);
@@ -266,7 +266,7 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU
glm::vec3 relativePosition = streamToAdd.getPosition() - listeningNodeStream.getPosition();
float distance = glm::max(glm::length(relativePosition), EPSILON);
- float gain = computeGain(listeningNodeStream, streamToAdd, relativePosition, isEcho);
+ float gain = computeGain(listenerNodeData, listeningNodeStream, streamToAdd, relativePosition, isEcho);
float azimuth = isEcho ? 0.0f : computeAzimuth(listeningNodeStream, listeningNodeStream, relativePosition);
const int HRTF_DATASET_INDEX = 1;
@@ -484,10 +484,12 @@ float approximateGain(const AvatarAudioStream& listeningNodeStream, const Positi
// when throttling, as close streams are expected to be heard by a user
float distance = glm::length(relativePosition);
return gain / distance;
+
+ // avatar: skip master gain - it is constant for all streams
}
-float computeGain(const AvatarAudioStream& listeningNodeStream, const PositionalAudioStream& streamToAdd,
- const glm::vec3& relativePosition, bool isEcho) {
+float computeGain(const AudioMixerClientData& listenerNodeData, const AvatarAudioStream& listeningNodeStream,
+ const PositionalAudioStream& streamToAdd, const glm::vec3& relativePosition, bool isEcho) {
float gain = 1.0f;
// injector: apply attenuation
@@ -507,6 +509,9 @@ float computeGain(const AvatarAudioStream& listeningNodeStream, const Positional
float offAxisCoefficient = MAX_OFF_AXIS_ATTENUATION + (angleOfDelivery * (OFF_AXIS_ATTENUATION_STEP / PI_OVER_TWO));
gain *= offAxisCoefficient;
+
+ // apply master gain, only to avatars
+ gain *= listenerNodeData.getMasterAvatarGain();
}
auto& audioZones = AudioMixer::getAudioZones();
diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp
index c67e998dd4..3ca924b007 100644
--- a/assignment-client/src/avatars/AvatarMixer.cpp
+++ b/assignment-client/src/avatars/AvatarMixer.cpp
@@ -870,8 +870,8 @@ AvatarMixerClientData* AvatarMixer::getOrCreateClientData(SharedNodePointer node
node->setLinkedData(std::unique_ptr { new AvatarMixerClientData(node->getUUID()) });
clientData = dynamic_cast(node->getLinkedData());
auto& avatar = clientData->getAvatar();
- avatar.setDomainMinimumScale(_domainMinimumScale);
- avatar.setDomainMaximumScale(_domainMaximumScale);
+ avatar.setDomainMinimumHeight(_domainMinimumHeight);
+ avatar.setDomainMaximumHeight(_domainMaximumHeight);
}
return clientData;
@@ -939,21 +939,21 @@ void AvatarMixer::parseDomainServerSettings(const QJsonObject& domainSettings) {
const QString AVATARS_SETTINGS_KEY = "avatars";
- static const QString MIN_SCALE_OPTION = "min_avatar_scale";
- float settingMinScale = domainSettings[AVATARS_SETTINGS_KEY].toObject()[MIN_SCALE_OPTION].toDouble(MIN_AVATAR_SCALE);
- _domainMinimumScale = glm::clamp(settingMinScale, MIN_AVATAR_SCALE, MAX_AVATAR_SCALE);
+ static const QString MIN_HEIGHT_OPTION = "min_avatar_height";
+ float settingMinHeight = domainSettings[AVATARS_SETTINGS_KEY].toObject()[MIN_HEIGHT_OPTION].toDouble(MIN_AVATAR_HEIGHT);
+ _domainMinimumHeight = glm::clamp(settingMinHeight, MIN_AVATAR_HEIGHT, MAX_AVATAR_HEIGHT);
- static const QString MAX_SCALE_OPTION = "max_avatar_scale";
- float settingMaxScale = domainSettings[AVATARS_SETTINGS_KEY].toObject()[MAX_SCALE_OPTION].toDouble(MAX_AVATAR_SCALE);
- _domainMaximumScale = glm::clamp(settingMaxScale, MIN_AVATAR_SCALE, MAX_AVATAR_SCALE);
+ static const QString MAX_HEIGHT_OPTION = "max_avatar_height";
+ float settingMaxHeight = domainSettings[AVATARS_SETTINGS_KEY].toObject()[MAX_HEIGHT_OPTION].toDouble(MAX_AVATAR_HEIGHT);
+ _domainMaximumHeight = glm::clamp(settingMaxHeight, MIN_AVATAR_HEIGHT, MAX_AVATAR_HEIGHT);
// make sure that the domain owner didn't flip min and max
- if (_domainMinimumScale > _domainMaximumScale) {
- std::swap(_domainMinimumScale, _domainMaximumScale);
+ if (_domainMinimumHeight > _domainMaximumHeight) {
+ std::swap(_domainMinimumHeight, _domainMaximumHeight);
}
- qCDebug(avatars) << "This domain requires a minimum avatar scale of" << _domainMinimumScale
- << "and a maximum avatar scale of" << _domainMaximumScale;
+ qCDebug(avatars) << "This domain requires a minimum avatar height of" << _domainMinimumHeight
+ << "and a maximum avatar height of" << _domainMaximumHeight;
const QString AVATAR_WHITELIST_DEFAULT{ "" };
static const QString AVATAR_WHITELIST_OPTION = "avatar_whitelist";
diff --git a/assignment-client/src/avatars/AvatarMixer.h b/assignment-client/src/avatars/AvatarMixer.h
index 610da8ad57..cb5f536faa 100644
--- a/assignment-client/src/avatars/AvatarMixer.h
+++ b/assignment-client/src/avatars/AvatarMixer.h
@@ -90,8 +90,8 @@ private:
float _maxKbpsPerNode = 0.0f;
- float _domainMinimumScale { MIN_AVATAR_SCALE };
- float _domainMaximumScale { MAX_AVATAR_SCALE };
+ float _domainMinimumHeight { MIN_AVATAR_HEIGHT };
+ float _domainMaximumHeight { MAX_AVATAR_HEIGHT };
RateCounter<> _broadcastRate;
p_high_resolution_clock::time_point _lastDebugMessage;
diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp
index a4bf8fa253..288652715a 100644
--- a/assignment-client/src/avatars/AvatarMixerClientData.cpp
+++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp
@@ -25,6 +25,23 @@ AvatarMixerClientData::AvatarMixerClientData(const QUuid& nodeID) :
_avatar->setID(nodeID);
}
+uint64_t AvatarMixerClientData::getLastOtherAvatarEncodeTime(QUuid otherAvatar) const {
+ std::unordered_map::const_iterator itr = _lastOtherAvatarEncodeTime.find(otherAvatar);
+ if (itr != _lastOtherAvatarEncodeTime.end()) {
+ return itr->second;
+ }
+ return 0;
+}
+
+void AvatarMixerClientData::setLastOtherAvatarEncodeTime(const QUuid& otherAvatar, const uint64_t& time) {
+ std::unordered_map::iterator itr = _lastOtherAvatarEncodeTime.find(otherAvatar);
+ if (itr != _lastOtherAvatarEncodeTime.end()) {
+ itr->second = time;
+ } else {
+ _lastOtherAvatarEncodeTime.emplace(std::pair(otherAvatar, time));
+ }
+}
+
void AvatarMixerClientData::queuePacket(QSharedPointer message, SharedNodePointer node) {
if (!_packetQueue.node) {
_packetQueue.node = node;
diff --git a/assignment-client/src/avatars/AvatarMixerClientData.h b/assignment-client/src/avatars/AvatarMixerClientData.h
index 12b0286088..acd9be0702 100644
--- a/assignment-client/src/avatars/AvatarMixerClientData.h
+++ b/assignment-client/src/avatars/AvatarMixerClientData.h
@@ -91,7 +91,7 @@ public:
void loadJSONStats(QJsonObject& jsonObject) const;
- glm::vec3 getPosition() const { return _avatar ? _avatar->getPosition() : glm::vec3(0); }
+ glm::vec3 getPosition() const { return _avatar ? _avatar->getWorldPosition() : glm::vec3(0); }
glm::vec3 getGlobalBoundingBoxCorner() const { return _avatar ? _avatar->getGlobalBoundingBoxCorner() : glm::vec3(0); }
bool isRadiusIgnoring(const QUuid& other) const { return _radiusIgnoredOthers.find(other) != _radiusIgnoredOthers.end(); }
void addToRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.insert(other); }
@@ -110,16 +110,10 @@ public:
bool getRequestsDomainListData() { return _requestsDomainListData; }
void setRequestsDomainListData(bool requesting) { _requestsDomainListData = requesting; }
- ViewFrustum getViewFrustom() const { return _currentViewFrustum; }
+ ViewFrustum getViewFrustum() const { return _currentViewFrustum; }
- quint64 getLastOtherAvatarEncodeTime(QUuid otherAvatar) {
- quint64 result = 0;
- if (_lastOtherAvatarEncodeTime.find(otherAvatar) != _lastOtherAvatarEncodeTime.end()) {
- result = _lastOtherAvatarEncodeTime[otherAvatar];
- }
- _lastOtherAvatarEncodeTime[otherAvatar] = usecTimestampNow();
- return result;
- }
+ uint64_t getLastOtherAvatarEncodeTime(QUuid otherAvatar) const;
+ void setLastOtherAvatarEncodeTime(const QUuid& otherAvatar, const uint64_t& time);
QVector& getLastOtherAvatarSentJoints(QUuid otherAvatar) {
_lastOtherAvatarSentJoints[otherAvatar].resize(_avatar->getJointCount());
@@ -143,7 +137,7 @@ private:
// this is a map of the last time we encoded an "other" avatar for
// sending to "this" node
- std::unordered_map _lastOtherAvatarEncodeTime;
+ std::unordered_map _lastOtherAvatarEncodeTime;
std::unordered_map> _lastOtherAvatarSentJoints;
uint64_t _identityChangeTimestamp;
diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp
index 5d36a6d261..47a81ba1fe 100644
--- a/assignment-client/src/avatars/AvatarMixerSlave.cpp
+++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -32,7 +33,6 @@
#include "AvatarMixerClientData.h"
#include "AvatarMixerSlave.h"
-
void AvatarMixerSlave::configure(ConstIter begin, ConstIter end) {
_begin = begin;
_end = end;
@@ -184,10 +184,9 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
// setup list of AvatarData as well as maps to map betweeen the AvatarData and the original nodes
- // for calling the AvatarData::sortAvatars() function and getting our sorted list of client nodes
- QList avatarList;
+ std::vector avatarsToSort;
std::unordered_map avatarDataToNodes;
-
+ std::unordered_map avatarEncodeTimes;
std::for_each(_begin, _end, [&](const SharedNodePointer& otherNode) {
// make sure this is an agent that we have avatar data for before considering it for inclusion
if (otherNode->getType() == NodeType::Agent
@@ -195,36 +194,56 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
const AvatarMixerClientData* otherNodeData = reinterpret_cast(otherNode->getLinkedData());
AvatarSharedPointer otherAvatar = otherNodeData->getAvatarSharedPointer();
- avatarList << otherAvatar;
+ avatarsToSort.push_back(otherAvatar);
avatarDataToNodes[otherAvatar] = otherNode;
+ QUuid id = otherAvatar->getSessionUUID();
+ avatarEncodeTimes[id] = nodeData->getLastOtherAvatarEncodeTime(id);
}
});
- AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer();
- ViewFrustum cameraView = nodeData->getViewFrustom();
- std::priority_queue sortedAvatars;
- AvatarData::sortAvatars(avatarList, cameraView, sortedAvatars,
- [&](AvatarSharedPointer avatar)->uint64_t {
- auto avatarNode = avatarDataToNodes[avatar];
- assert(avatarNode); // we can't have gotten here without the avatarData being a valid key in the map
- return nodeData->getLastBroadcastTime(avatarNode->getUUID());
- }, [&](AvatarSharedPointer avatar)->float{
- glm::vec3 nodeBoxHalfScale = (avatar->getPosition() - avatar->getGlobalBoundingBoxCorner() * avatar->getSensorToWorldScale());
- return glm::max(nodeBoxHalfScale.x, glm::max(nodeBoxHalfScale.y, nodeBoxHalfScale.z));
- }, [&](AvatarSharedPointer avatar)->bool {
+ class SortableAvatar: public PrioritySortUtil::Sortable {
+ public:
+ SortableAvatar() = delete;
+ SortableAvatar(const AvatarSharedPointer& avatar, uint64_t lastEncodeTime)
+ : _avatar(avatar), _lastEncodeTime(lastEncodeTime) {}
+ glm::vec3 getPosition() const override { return _avatar->getWorldPosition(); }
+ float getRadius() const override {
+ glm::vec3 nodeBoxHalfScale = (_avatar->getWorldPosition() - _avatar->getGlobalBoundingBoxCorner() * _avatar->getSensorToWorldScale());
+ return glm::max(nodeBoxHalfScale.x, glm::max(nodeBoxHalfScale.y, nodeBoxHalfScale.z));
+ }
+ uint64_t getTimestamp() const override {
+ return _lastEncodeTime;
+ }
+ const AvatarSharedPointer& getAvatar() const { return _avatar; }
+
+ private:
+ AvatarSharedPointer _avatar;
+ uint64_t _lastEncodeTime;
+ };
+
+ // prepare to sort
+ ViewFrustum cameraView = nodeData->getViewFrustum();
+ PrioritySortUtil::PriorityQueue sortedAvatars(cameraView,
+ AvatarData::_avatarSortCoefficientSize,
+ AvatarData::_avatarSortCoefficientCenter,
+ AvatarData::_avatarSortCoefficientAge);
+
+ // ignore or sort
+ const AvatarSharedPointer& thisAvatar = nodeData->getAvatarSharedPointer();
+ for (const auto& avatar : avatarsToSort) {
if (avatar == thisAvatar) {
- return true; // ignore ourselves...
+ // don't echo updates to self
+ continue;
}
bool shouldIgnore = false;
-
- // We will also ignore other nodes for a couple of different reasons:
+ // We ignore other nodes for a couple of reasons:
// 1) ignore bubbles and ignore specific node
// 2) the node hasn't really updated it's frame data recently, this can
// happen if for example the avatar is connected on a desktop and sending
// updates at ~30hz. So every 3 frames we skip a frame.
- auto avatarNode = avatarDataToNodes[avatar];
+ auto avatarNode = avatarDataToNodes[avatar];
assert(avatarNode); // we can't have gotten here without the avatarData being a valid key in the map
const AvatarMixerClientData* avatarNodeData = reinterpret_cast(avatarNode->getLinkedData());
@@ -240,7 +259,6 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|| (avatarNode->isIgnoringNodeWithID(node->getUUID()) && !getsAnyIgnored)) {
shouldIgnore = true;
} else {
-
// Check to see if the space bubble is enabled
// Don't bother with these checks if the other avatar has their bubble enabled and we're gettingAnyIgnored
if (node->isIgnoreRadiusEnabled() || (avatarNode->isIgnoreRadiusEnabled() && !getsAnyIgnored)) {
@@ -267,8 +285,6 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
nodeData->removeFromRadiusIgnoringSet(node, avatarNode->getUUID());
}
}
- quint64 endIgnoreCalculation = usecTimestampNow();
- _stats.ignoreCalculationElapsedTime += (endIgnoreCalculation - startIgnoreCalculation);
if (!shouldIgnore) {
AvatarDataSequenceNumber lastSeqToReceiver = nodeData->getLastBroadcastSequenceNumber(avatarNode->getUUID());
@@ -292,20 +308,26 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
++numAvatarsWithSkippedFrames;
}
}
- return shouldIgnore;
- });
+ quint64 endIgnoreCalculation = usecTimestampNow();
+ _stats.ignoreCalculationElapsedTime += (endIgnoreCalculation - startIgnoreCalculation);
+
+ if (!shouldIgnore) {
+ // sort this one for later
+ uint64_t lastEncodeTime = 0;
+ std::unordered_map::const_iterator itr = avatarEncodeTimes.find(avatar->getSessionUUID());
+ if (itr != avatarEncodeTimes.end()) {
+ lastEncodeTime = itr->second;
+ }
+ sortedAvatars.push(SortableAvatar(avatar, lastEncodeTime));
+ }
+ }
// loop through our sorted avatars and allocate our bandwidth to them accordingly
- int avatarRank = 0;
- // this is overly conservative, because it includes some avatars we might not consider
int remainingAvatars = (int)sortedAvatars.size();
-
while (!sortedAvatars.empty()) {
- AvatarPriority sortData = sortedAvatars.top();
+ const auto& avatarData = sortedAvatars.top().getAvatar();
sortedAvatars.pop();
- const auto& avatarData = sortData.avatar;
- avatarRank++;
remainingAvatars--;
auto otherNode = avatarDataToNodes[avatarData];
@@ -332,10 +354,8 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
nodeData->setLastBroadcastTime(otherNode->getUUID(), usecTimestampNow());
}
+ // determine if avatar is in view which determines how much data to send
glm::vec3 otherPosition = otherAvatar->getClientGlobalPosition();
-
-
- // determine if avatar is in view, to determine how much data to include...
glm::vec3 otherNodeBoxScale = (otherPosition - otherNodeData->getGlobalBoundingBoxCorner()) * 2.0f * otherAvatar->getSensorToWorldScale();
AABox otherNodeBox(otherNodeData->getGlobalBoundingBoxCorner(), otherNodeBoxScale);
bool isInView = nodeData->otherAvatarInView(otherNodeBox);
@@ -405,14 +425,18 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
// set the last sent sequence number for this sender on the receiver
nodeData->setLastBroadcastSequenceNumber(otherNode->getUUID(),
otherNodeData->getLastReceivedSequenceNumber());
+ nodeData->setLastOtherAvatarEncodeTime(otherNode->getUUID(), usecTimestampNow());
}
+ } else {
+ // TODO? this avatar is not included now, and will probably not be included next frame.
+ // It would be nice if we could tweak its future sort priority to put it at the back of the list.
}
avatarPacketList->endSegment();
quint64 endAvatarDataPacking = usecTimestampNow();
_stats.avatarDataPackingElapsedTime += (endAvatarDataPacking - startAvatarDataPacking);
- };
+ }
quint64 startPacketSending = usecTimestampNow();
diff --git a/assignment-client/src/avatars/ScriptableAvatar.cpp b/assignment-client/src/avatars/ScriptableAvatar.cpp
index 5060891284..c9ded2d6fb 100644
--- a/assignment-client/src/avatars/ScriptableAvatar.cpp
+++ b/assignment-client/src/avatars/ScriptableAvatar.cpp
@@ -20,7 +20,7 @@
QByteArray ScriptableAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) {
- _globalPosition = getPosition();
+ _globalPosition = getWorldPosition();
return AvatarData::toByteArrayStateful(dataDetail);
}
diff --git a/assignment-client/src/entities/EntityServer.cpp b/assignment-client/src/entities/EntityServer.cpp
index 995a5bad27..ecdf14ebec 100644
--- a/assignment-client/src/entities/EntityServer.cpp
+++ b/assignment-client/src/entities/EntityServer.cpp
@@ -477,7 +477,7 @@ void EntityServer::startDynamicDomainVerification() {
QNetworkRequest networkRequest;
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
- QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
+ QUrl requestURL = NetworkingConstants::METAVERSE_SERVER_URL();
requestURL.setPath("/api/v1/commerce/proof_of_purchase_status/location");
QJsonObject request;
request["certificate_id"] = i.key();
diff --git a/assignment-client/src/entities/EntityTreeSendThread.cpp b/assignment-client/src/entities/EntityTreeSendThread.cpp
index 11e4d533fb..e5cee84f1b 100644
--- a/assignment-client/src/entities/EntityTreeSendThread.cpp
+++ b/assignment-client/src/entities/EntityTreeSendThread.cpp
@@ -23,6 +23,17 @@ EntityTreeSendThread::EntityTreeSendThread(OctreeServer* myServer, const SharedN
{
connect(std::static_pointer_cast(myServer->getOctree()).get(), &EntityTree::editingEntityPointer, this, &EntityTreeSendThread::editingEntityPointer, Qt::QueuedConnection);
connect(std::static_pointer_cast(myServer->getOctree()).get(), &EntityTree::deletingEntityPointer, this, &EntityTreeSendThread::deletingEntityPointer, Qt::QueuedConnection);
+
+ // connect to connection ID change on EntityNodeData so we can clear state for this receiver
+ auto nodeData = static_cast(node->getLinkedData());
+ connect(nodeData, &EntityNodeData::incomingConnectionIDChanged, this, &EntityTreeSendThread::resetState);
+}
+
+void EntityTreeSendThread::resetState() {
+ qCDebug(entities) << "Clearing known EntityTreeSendThread state for" << _nodeUuid;
+
+ _knownState.clear();
+ _traversal.reset();
}
void EntityTreeSendThread::preDistributionProcessing() {
diff --git a/assignment-client/src/entities/EntityTreeSendThread.h b/assignment-client/src/entities/EntityTreeSendThread.h
index a96a18494d..594f423838 100644
--- a/assignment-client/src/entities/EntityTreeSendThread.h
+++ b/assignment-client/src/entities/EntityTreeSendThread.h
@@ -33,6 +33,9 @@ protected:
void traverseTreeAndSendContents(SharedNodePointer node, OctreeQueryNode* nodeData,
bool viewFrustumChanged, bool isFullScene) override;
+private slots:
+ void resetState(); // clears our known state forcing entities to appear unsent
+
private:
// the following two methods return booleans to indicate if any extra flagged entities were new additions to set
bool addAncestorsToExtraFlaggedEntities(const QUuid& filteredEntityID, EntityItem& entityItem, EntityNodeData& nodeData);
diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp
index 89e3d403fc..3ae653307f 100644
--- a/assignment-client/src/octree/OctreeSendThread.cpp
+++ b/assignment-client/src/octree/OctreeSendThread.cpp
@@ -82,8 +82,12 @@ bool OctreeSendThread::process() {
if (auto node = _node.lock()) {
OctreeQueryNode* nodeData = static_cast(node->getLinkedData());
- // Sometimes the node data has not yet been linked, in which case we can't really do anything
- if (nodeData && !nodeData->isShuttingDown()) {
+ // If we don't have the OctreeQueryNode at all
+ // or it's uninitialized because we haven't received a query yet from the client
+ // or we don't know where we should send packets for this node
+ // or we're shutting down
+ // then we can't send an entity data packet
+ if (nodeData && nodeData->hasReceivedFirstQuery() && node->getActiveSocket() && !nodeData->isShuttingDown()) {
bool viewFrustumChanged = nodeData->updateCurrentViewFrustum();
packetDistributor(node, nodeData, viewFrustumChanged);
}
diff --git a/assignment-client/src/octree/OctreeSendThread.h b/assignment-client/src/octree/OctreeSendThread.h
index bc7d2c2588..220952e209 100644
--- a/assignment-client/src/octree/OctreeSendThread.h
+++ b/assignment-client/src/octree/OctreeSendThread.h
@@ -59,7 +59,8 @@ protected:
OctreePacketData _packetData;
QWeakPointer _node;
OctreeServer* _myServer { nullptr };
-
+ QUuid _nodeUuid;
+
private:
/// Called before a packetDistributor pass to allow for pre-distribution processing
virtual void preDistributionProcessing() {};
@@ -71,8 +72,6 @@ private:
virtual void preStartNewScene(OctreeQueryNode* nodeData, bool isFullScene);
virtual bool shouldTraverseAndSend(OctreeQueryNode* nodeData) { return hasSomethingToSend(nodeData); }
- QUuid _nodeUuid;
-
int _truePacketsSent { 0 }; // available for debug stats
int _trueBytesSent { 0 }; // available for debug stats
int _packetsSentThisInterval { 0 }; // used for bandwidth throttle condition
diff --git a/cmake/externals/hifiAudioCodec/CMakeLists.txt b/cmake/externals/hifiAudioCodec/CMakeLists.txt
index a30396c6fd..e3ba36a440 100644
--- a/cmake/externals/hifiAudioCodec/CMakeLists.txt
+++ b/cmake/externals/hifiAudioCodec/CMakeLists.txt
@@ -5,43 +5,41 @@ set(EXTERNAL_NAME hifiAudioCodec)
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
-if (NOT ANDROID)
-
- if (WIN32 OR APPLE)
- ExternalProject_Add(
- ${EXTERNAL_NAME}
- URL http://s3.amazonaws.com/hifi-public/dependencies/codecSDK-1.zip
- URL_MD5 23ec3fe51eaa155ea159a4971856fc13
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- LOG_DOWNLOAD 1
- )
- else ()
- ExternalProject_Add(
- ${EXTERNAL_NAME}
- URL http://s3.amazonaws.com/hifi-public/dependencies/codecSDK-linux.zip
- URL_MD5 7d37914a18aa4de971d2f45dd3043bde
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- LOG_DOWNLOAD 1
- )
- endif()
-
- # Hide this external target (for ide users)
- set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
-
- ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
-
- set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE INTERNAL)
-
- if (WIN32)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/audio.lib CACHE TYPE INTERNAL)
- elseif(APPLE)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/libaudio.a CACHE TYPE INTERNAL)
- elseif(NOT ANDROID)
- set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/libaudio.a CACHE TYPE INTERNAL)
- endif()
-
+if (WIN32)
+ set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/codecSDK-win-2.0.zip)
+ set(DOWNLOAD_MD5 9199d4dbd6b16bed736b235efe980e67)
+elseif (APPLE)
+ set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/codecSDK-mac-2.0.zip)
+ set(DOWNLOAD_MD5 21649881e7d5dc94f922179be96f76ba)
+elseif (ANDROID)
+ set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/codecSDK-android-2.0.zip)
+ set(DOWNLOAD_MD5 aef2a852600d498d58aa586668191683)
+elseif (UNIX)
+ set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/codecSDK-linux-2.0.zip)
+ set(DOWNLOAD_MD5 67fb7755f9bcafb98a9fceea53bc7481)
+else()
+ return()
+endif()
+
+ExternalProject_Add(
+ ${EXTERNAL_NAME}
+ URL ${DOWNLOAD_URL}
+ URL_MD5 ${DOWNLOAD_MD5}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ LOG_DOWNLOAD 1
+)
+
+# Hide this external target (for ide users)
+set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
+
+ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
+
+set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE INTERNAL)
+
+if (WIN32)
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/audio.lib CACHE TYPE INTERNAL)
+else()
+ set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/libaudio.a CACHE TYPE INTERNAL)
endif()
diff --git a/cmake/macros/GenerateInstallers.cmake b/cmake/macros/GenerateInstallers.cmake
index 6c131168d5..702636dd01 100644
--- a/cmake/macros/GenerateInstallers.cmake
+++ b/cmake/macros/GenerateInstallers.cmake
@@ -29,10 +29,6 @@ macro(GENERATE_INSTALLERS)
if (WIN32)
- # Do not install the Visual Studio C runtime libraries. The installer will do this automatically
- set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
-
- include(InstallRequiredSystemLibraries)
set(CPACK_NSIS_MUI_ICON "${HF_CMAKE_DIR}/installer/installer.ico")
# install and reference the Add/Remove icon
@@ -49,6 +45,10 @@ macro(GENERATE_INSTALLERS)
set(_UNINSTALLER_HEADER_BAD_PATH "${HF_CMAKE_DIR}/installer/uninstaller-header.bmp")
set(UNINSTALLER_HEADER_IMAGE "")
fix_path_for_nsis(${_UNINSTALLER_HEADER_BAD_PATH} UNINSTALLER_HEADER_IMAGE)
+
+ # grab the latest VC redist (2017) and add it to the installer, our NSIS template
+ # will call it during the install
+ install(CODE "file(DOWNLOAD https://go.microsoft.com/fwlink/?LinkId=746572 \"\${CMAKE_INSTALL_PREFIX}/vcredist_x64.exe\")")
elseif (APPLE)
# produce a drag and drop DMG on OS X
set(CPACK_GENERATOR "DragNDrop")
@@ -84,4 +84,3 @@ macro(GENERATE_INSTALLERS)
include(CPack)
endmacro()
-
diff --git a/cmake/macros/SetFromEnv.cmake b/cmake/macros/SetFromEnv.cmake
new file mode 100644
index 0000000000..0832c5a536
--- /dev/null
+++ b/cmake/macros/SetFromEnv.cmake
@@ -0,0 +1,17 @@
+#
+# Created by Bradley Austin Davis on 2017/11/27
+# Copyright 2013-2017 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
+#
+
+function(set_from_env _RESULT_NAME _ENV_VAR_NAME _DEFAULT_VALUE)
+ if (NOT DEFINED ${_RESULT_NAME})
+ if ("$ENV{${_ENV_VAR_NAME}}" STREQUAL "")
+ set (${_RESULT_NAME} ${_DEFAULT_VALUE} PARENT_SCOPE)
+ else()
+ set (${_RESULT_NAME} $ENV{${_ENV_VAR_NAME}} PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()
diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake
index 8faa4e6d96..e26f81edd9 100644
--- a/cmake/macros/SetPackagingParameters.cmake
+++ b/cmake/macros/SetPackagingParameters.cmake
@@ -15,13 +15,14 @@ macro(SET_PACKAGING_PARAMETERS)
set(PR_BUILD 0)
set(PRODUCTION_BUILD 0)
set(DEV_BUILD 0)
-
- set(RELEASE_TYPE $ENV{RELEASE_TYPE})
- set(RELEASE_NUMBER $ENV{RELEASE_NUMBER})
- string(TOLOWER "$ENV{BRANCH}" BUILD_BRANCH)
set(BUILD_GLOBAL_SERVICES "DEVELOPMENT")
set(USE_STABLE_GLOBAL_SERVICES 0)
+ set_from_env(RELEASE_TYPE RELEASE_TYPE "DEV")
+ set_from_env(RELEASE_NUMBER RELEASE_NUMBER "")
+ set_from_env(BUILD_BRANCH BRANCH "")
+ string(TOLOWER "${BUILD_BRANCH}" BUILD_BRANCH)
+
message(STATUS "The BUILD_BRANCH variable is: ${BUILD_BRANCH}")
message(STATUS "The BRANCH environment variable is: $ENV{BRANCH}")
message(STATUS "The RELEASE_TYPE variable is: ${RELEASE_TYPE}")
diff --git a/cmake/macros/SetupQt.cmake b/cmake/macros/SetupQt.cmake
index ac67e12044..00a398761b 100644
--- a/cmake/macros/SetupQt.cmake
+++ b/cmake/macros/SetupQt.cmake
@@ -1,21 +1,11 @@
#
-# Copyright 2015 High Fidelity, Inc.
-# Created by Bradley Austin Davis on 2015/10/10
+# Created by Bradley Austin Davis on 2017/09/02
+# Copyright 2013-2017 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
#
-function(set_from_env _RESULT_NAME _ENV_VAR_NAME _DEFAULT_VALUE)
- if (NOT DEFINED ${_RESULT_NAME})
- if ("$ENV{${_ENV_VAR_NAME}}" STREQUAL "")
- set (${_RESULT_NAME} ${_DEFAULT_VALUE} PARENT_SCOPE)
- else()
- set (${_RESULT_NAME} $ENV{${_ENV_VAR_NAME}} PARENT_SCOPE)
- endif()
- endif()
-endfunction()
-
# Construct a default QT location from a root path, a version and an architecture
function(calculate_default_qt_dir _RESULT_NAME)
if (ANDROID)
diff --git a/cmake/macros/TargetBullet.cmake b/cmake/macros/TargetBullet.cmake
index 207595d23f..48fe0e0c05 100644
--- a/cmake/macros/TargetBullet.cmake
+++ b/cmake/macros/TargetBullet.cmake
@@ -6,8 +6,19 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(TARGET_BULLET)
- add_dependency_external_projects(bullet)
- find_package(Bullet REQUIRED)
+ if (ANDROID)
+ set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/bullet)
+ set(BULLET_INCLUDE_DIRS "${INSTALL_DIR}/include/bullet" CACHE TYPE INTERNAL)
+
+ set(LIB_DIR ${INSTALL_DIR}/lib)
+ list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletDynamics.a)
+ list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletCollision.a)
+ list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libLinearMath.a)
+ list(APPEND BULLET_LIBRARIES ${LIB_DIR}/libBulletSoftBody.a)
+ else()
+ add_dependency_external_projects(bullet)
+ find_package(Bullet REQUIRED)
+ endif()
# perform the system include hack for OS X to ignore warnings
if (APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
@@ -16,3 +27,5 @@ macro(TARGET_BULLET)
endif()
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
endmacro()
+
+
diff --git a/cmake/macros/TargetDraco.cmake b/cmake/macros/TargetDraco.cmake
new file mode 100755
index 0000000000..c198ac35b0
--- /dev/null
+++ b/cmake/macros/TargetDraco.cmake
@@ -0,0 +1,18 @@
+macro(TARGET_DRACO)
+ if (ANDROID)
+ set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/draco)
+ set(DRACO_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+
+ set(LIB_DIR ${INSTALL_DIR}/lib)
+ list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdraco.a)
+ list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdracodec.a)
+ list(APPEND DRACO_LIBRARIES ${LIB_DIR}/libdracoenc.a)
+ else()
+ add_dependency_external_projects(draco)
+ find_package(Draco REQUIRED)
+ list(APPEND DRACO_LIBRARIES ${DRACO_LIBRARY})
+ list(APPEND DRACO_LIBRARIES ${DRACO_ENCODER_LIBRARY})
+ endif()
+ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${DRACO_INCLUDE_DIRS})
+ target_link_libraries(${TARGET_NAME} ${DRACO_LIBRARIES})
+endmacro()
diff --git a/cmake/macros/TargetGoogleVR.cmake b/cmake/macros/TargetGoogleVR.cmake
new file mode 100644
index 0000000000..852037770d
--- /dev/null
+++ b/cmake/macros/TargetGoogleVR.cmake
@@ -0,0 +1,14 @@
+#
+# Created by Bradley Austin Davis on 2017/11/28
+# Copyright 2013-2017 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
+#
+macro(TARGET_GOOGLEVR)
+ if (ANDROID)
+ set(GVR_ROOT "${HIFI_ANDROID_PRECOMPILED}/gvr/gvr-android-sdk-1.101.0/")
+ target_include_directories(native-lib PRIVATE "${GVR_ROOT}/libraries/headers")
+ target_link_libraries(native-lib "${GVR_ROOT}/libraries/libgvr.so")
+ endif()
+endmacro()
diff --git a/cmake/macros/TargetOpenSSL.cmake b/cmake/macros/TargetOpenSSL.cmake
index 7ee0283a48..82601bf6aa 100644
--- a/cmake/macros/TargetOpenSSL.cmake
+++ b/cmake/macros/TargetOpenSSL.cmake
@@ -6,14 +6,10 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(TARGET_OPENSSL)
-
if (ANDROID)
-
- # FIXME use a distributable binary
- set(OPENSSL_INSTALL_DIR C:/Android/openssl)
+ set(OPENSSL_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/openssl)
set(OPENSSL_INCLUDE_DIR "${OPENSSL_INSTALL_DIR}/include" CACHE TYPE INTERNAL)
set(OPENSSL_LIBRARIES "${OPENSSL_INSTALL_DIR}/lib/libcrypto.a;${OPENSSL_INSTALL_DIR}/lib/libssl.a" CACHE TYPE INTERNAL)
-
else()
find_package(OpenSSL REQUIRED)
@@ -28,5 +24,4 @@ macro(TARGET_OPENSSL)
include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES})
-
endmacro()
diff --git a/cmake/macros/TargetPolyvox.cmake b/cmake/macros/TargetPolyvox.cmake
new file mode 100644
index 0000000000..9db6b522c7
--- /dev/null
+++ b/cmake/macros/TargetPolyvox.cmake
@@ -0,0 +1,24 @@
+#
+# Created by Bradley Austin Davis on 2017/11/28
+# Copyright 2013-2017 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
+#
+macro(TARGET_POLYVOX)
+ if (ANDROID)
+ set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/polyvox)
+ set(POLYVOX_INCLUDE_DIRS "${INSTALL_DIR}/include" CACHE TYPE INTERNAL)
+ set(LIB_DIR ${INSTALL_DIR}/lib)
+ list(APPEND POLYVOX_LIBRARIES ${LIB_DIR}/libPolyVoxUtil.so)
+ list(APPEND POLYVOX_LIBRARIES ${LIB_DIR}/Release/libPolyVoxCore.so)
+ else()
+ add_dependency_external_projects(polyvox)
+ find_package(PolyVox REQUIRED)
+ endif()
+ target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS})
+ target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES})
+endmacro()
+
+
+
diff --git a/cmake/macros/TargetTBB.cmake b/cmake/macros/TargetTBB.cmake
index e9c4639c3d..1e2e69eeaa 100644
--- a/cmake/macros/TargetTBB.cmake
+++ b/cmake/macros/TargetTBB.cmake
@@ -8,10 +8,10 @@
macro(TARGET_TBB)
if (ANDROID)
- set(TBB_INSTALL_DIR C:/tbb-2018/built)
- set(TBB_LIBRARY ${HIFI_ANDROID_PRECOMPILED}/libtbb.so CACHE FILEPATH "TBB library location")
- set(TBB_MALLOC_LIBRARY ${HIFI_ANDROID_PRECOMPILED}/libtbbmalloc.so CACHE FILEPATH "TBB malloc library location")
- set(TBB_INCLUDE_DIRS ${TBB_INSTALL_DIR}/include CACHE TYPE "List of tbb include directories" CACHE FILEPATH "TBB includes location")
+ set(TBB_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/tbb)
+ set(TBB_INCLUDE_DIRS ${TBB_INSTALL_DIR}/include CACHE FILEPATH "TBB includes location")
+ set(TBB_LIBRARY ${TBB_INSTALL_DIR}/lib/release/libtbb.so CACHE FILEPATH "TBB library location")
+ set(TBB_MALLOC_LIBRARY ${TBB_INSTALL_DIR}/lib/release/libtbbmalloc.so CACHE FILEPATH "TBB malloc library location")
set(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY})
else()
add_dependency_external_projects(tbb)
diff --git a/cmake/templates/FixupBundlePostBuild.cmake.in b/cmake/templates/FixupBundlePostBuild.cmake.in
index d4726884c2..57379bb48b 100644
--- a/cmake/templates/FixupBundlePostBuild.cmake.in
+++ b/cmake/templates/FixupBundlePostBuild.cmake.in
@@ -45,5 +45,4 @@ else()
endif()
file(GLOB EXTRA_PLUGINS "${BUNDLE_PLUGIN_DIR}/*.${PLUGIN_EXTENSION}")
-fixup_bundle("${BUNDLE_EXECUTABLE}" "${EXTRA_PLUGINS}" "@FIXUP_LIBS@")
-
+fixup_bundle("${BUNDLE_EXECUTABLE}" "${EXTRA_PLUGINS}" "@FIXUP_LIBS@" IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe")
diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json
index d55da6c848..c6d118a87b 100644
--- a/domain-server/resources/describe-settings.json
+++ b/domain-server/resources/describe-settings.json
@@ -1,5 +1,5 @@
{
- "version": 2.0,
+ "version": 2.1,
"settings": [
{
"name": "label",
@@ -916,6 +916,14 @@
"default": false
}
]
+ },
+ {
+ "name": "multi_kick_logged_in",
+ "type": "checkbox",
+ "label": "Multi-Kick for Logged In Users",
+ "help": "Kick logged in users by machine fingerprint (in addition to the default kick by username)",
+ "default": false,
+ "advanced": true
}
]
},
@@ -1007,20 +1015,20 @@
"assignment-types": [ 1, 2 ],
"settings": [
{
- "name": "min_avatar_scale",
+ "name": "min_avatar_height",
"type": "double",
- "label": "Minimum Avatar Scale",
- "help": "Limits the scale of avatars in your domain. Must be at least 0.005.",
- "placeholder": 0.25,
- "default": 0.25
+ "label": "Minimum Avatar Height (meters)",
+ "help": "Limits the height of avatars in your domain. Must be at least 0.009.",
+ "placeholder": 0.4,
+ "default": 0.4
},
{
- "name": "max_avatar_scale",
+ "name": "max_avatar_height",
"type": "double",
- "label": "Maximum Avatar Scale",
- "help": "Limits the scale of avatars in your domain. Cannot be greater than 1000.",
- "placeholder": 3.0,
- "default": 3.0
+ "label": "Maximum Avatar Height (meters)",
+ "help": "Limits the scale of avatars in your domain. Cannot be greater than 1755.",
+ "placeholder": 5.2,
+ "default": 5.2
},
{
"name": "avatar_whitelist",
diff --git a/domain-server/resources/web/content/index.shtml b/domain-server/resources/web/content/index.shtml
index e1ba5499b6..0e48c1eff8 100644
--- a/domain-server/resources/web/content/index.shtml
+++ b/domain-server/resources/web/content/index.shtml
@@ -19,12 +19,13 @@
Upload an entities file (e.g.: models.json.gz) to replace the content of this domain.
Note: Your domain's content will be replaced by the content you upload, but the backup files of your domain's content will not immediately be changed.
-
- If your domain has any content that you would like to re-use at a later date, save a manual backup of your models.json.gz file, which is usually stored at the following paths:
-
If your domain has any content that you would like to re-use at a later date, save a manual backup of your models.json.gz file, which is usually stored at the following paths:
diff --git a/domain-server/resources/web/css/style.css b/domain-server/resources/web/css/style.css
index 8b004687b9..158008fc2b 100644
--- a/domain-server/resources/web/css/style.css
+++ b/domain-server/resources/web/css/style.css
@@ -1,3 +1,17 @@
+/* cairo-regular - latin */
+@font-face {
+ font-family: 'Cairo';
+ font-style: normal;
+ font-weight: 400;
+ src: url('/fonts/cairo-v2-latin-regular.eot'); /* IE9 Compat Modes */
+ src: local('Cairo'), local('Cairo-Regular'),
+ url('/fonts/cairo-v2-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
+ url('/fonts/cairo-v2-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
+ url('/fonts/cairo-v2-latin-regular.woff') format('woff'), /* Modern Browsers */
+ url('/fonts/cairo-v2-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
+ url('/fonts/cairo-v2-latin-regular.svg#Cairo') format('svg'); /* Legacy iOS */
+}
+
body {
position: relative;
padding-bottom: 30px;
@@ -80,11 +94,23 @@ span.port {
display: none;
}
-#setup-sidebar.affix {
- /* This overrides a case where going to the bottom of the page,
- * then scrolling up, causes `position: relative` to be added to the style
- */
- position: fixed !important;
+@media (min-width: 768px) {
+ #setup-sidebar.affix {
+ /* This overrides a case where going to the bottom of the page,
+ * then scrolling up, causes `position: relative` to be added to the style
+ */
+ position: fixed !important;
+ }
+}
+
+@media (max-width: 767px) {
+ #setup-sidebar.affix {
+ position: static !important;
+ }
+
+ #setup-sidebar {
+ margin-bottom: 20px;
+ }
}
#setup-sidebar button {
@@ -302,17 +328,17 @@ table .headers + .headers td {
}
.account-connected-header {
+ vertical-align: middle;
color: #6FCF97;
font-size: 30px;
margin-right: 20px;
}
-#visit-domain-link,
.blue-link {
font-size: 14px;
text-decoration-line: underline;
font-weight: normal;
- color: #2F80ED;
+ color: #00B3F8;
}
#manage-cloud-domains-link {
diff --git a/domain-server/resources/web/fonts/cairo-v2-latin-regular.eot b/domain-server/resources/web/fonts/cairo-v2-latin-regular.eot
new file mode 100644
index 0000000000..6a22e7926d
Binary files /dev/null and b/domain-server/resources/web/fonts/cairo-v2-latin-regular.eot differ
diff --git a/domain-server/resources/web/fonts/cairo-v2-latin-regular.svg b/domain-server/resources/web/fonts/cairo-v2-latin-regular.svg
new file mode 100644
index 0000000000..64e5a31732
--- /dev/null
+++ b/domain-server/resources/web/fonts/cairo-v2-latin-regular.svg
@@ -0,0 +1 @@
+Error 500 (Server Error)!!1
500. That’s an error.
There was an error. Please try again later. That’s all we know.
\ No newline at end of file
diff --git a/domain-server/resources/web/fonts/cairo-v2-latin-regular.ttf b/domain-server/resources/web/fonts/cairo-v2-latin-regular.ttf
new file mode 100644
index 0000000000..216effc099
Binary files /dev/null and b/domain-server/resources/web/fonts/cairo-v2-latin-regular.ttf differ
diff --git a/domain-server/resources/web/fonts/cairo-v2-latin-regular.woff b/domain-server/resources/web/fonts/cairo-v2-latin-regular.woff
new file mode 100644
index 0000000000..73f2ef82fa
Binary files /dev/null and b/domain-server/resources/web/fonts/cairo-v2-latin-regular.woff differ
diff --git a/domain-server/resources/web/fonts/cairo-v2-latin-regular.woff2 b/domain-server/resources/web/fonts/cairo-v2-latin-regular.woff2
new file mode 100644
index 0000000000..1d36dc0112
Binary files /dev/null and b/domain-server/resources/web/fonts/cairo-v2-latin-regular.woff2 differ
diff --git a/domain-server/resources/web/header.html b/domain-server/resources/web/header.html
index 7b07458784..1e32e9f02f 100644
--- a/domain-server/resources/web/header.html
+++ b/domain-server/resources/web/header.html
@@ -39,7 +39,7 @@
diff --git a/domain-server/resources/web/images/checkmark.svg b/domain-server/resources/web/images/checkmark.svg
deleted file mode 100644
index f4403921ee..0000000000
--- a/domain-server/resources/web/images/checkmark.svg
+++ /dev/null
@@ -1,25 +0,0 @@
-
diff --git a/domain-server/resources/web/images/copy-icon.svg b/domain-server/resources/web/images/copy-icon.svg
new file mode 100644
index 0000000000..ce1d841072
--- /dev/null
+++ b/domain-server/resources/web/images/copy-icon.svg
@@ -0,0 +1,17 @@
+
+
+
diff --git a/domain-server/resources/web/images/wizard-congratulation-header.jpg b/domain-server/resources/web/images/wizard-congratulation-header.jpg
new file mode 100644
index 0000000000..80a3823033
Binary files /dev/null and b/domain-server/resources/web/images/wizard-congratulation-header.jpg differ
diff --git a/domain-server/resources/web/js/shared.js b/domain-server/resources/web/js/shared.js
index 66159209ea..00f699fa4e 100644
--- a/domain-server/resources/web/js/shared.js
+++ b/domain-server/resources/web/js/shared.js
@@ -62,26 +62,25 @@ var Strings = {
// dialog with new path still set, allowing them to retry immediately, and without
// having to type the new path in again.
EDIT_PLACE_TITLE: "Modify Viewpoint or Path",
- EDIT_PLACE_ERROR: "Failed to update place path. Please try again.",
+ EDIT_PLACE_ERROR: "Failed to update Viewpoint or Path for this Place Name. Please try again.",
EDIT_PLACE_CONFIRM_BUTTON: "Save",
EDIT_PLACE_CONFIRM_BUTTON_PENDING: "Saving...",
EDIT_PLACE_CANCEL_BUTTON: "Cancel",
- REMOVE_PLACE_TITLE: "Are you sure you want to remove {{place}}?",
- REMOVE_PLACE_ERROR: "Failed to remove place. Please try again.",
- REMOVE_PLACE_DELETE_BUTTON: "Delete",
+ REMOVE_PLACE_TITLE: "Are you sure you want to remove {{place}} and its path information?",
+ REMOVE_PLACE_ERROR: "Failed to remove Place Name and its Path information.",
+ REMOVE_PLACE_DELETE_BUTTON: "This action removes your Place Name",
REMOVE_PLACE_DELETE_BUTTON_PENDING: "Deleting...",
REMOVE_PLACE_CANCEL_BUTTON: "Cancel",
ADD_PLACE_TITLE: "Choose a place",
- ADD_PLACE_MESSAGE: "Choose the High Fidelity place to point at this domain server.",
- ADD_PLACE_CONFIRM_BUTTON: "Choose place",
+ ADD_PLACE_MESSAGE: "Choose a Place Name that you own or register a new Place Name.",
+ ADD_PLACE_CONFIRM_BUTTON: "Save",
ADD_PLACE_CONFIRM_BUTTON_PENDING: "Saving...",
ADD_PLACE_CANCEL_BUTTON: "Cancel",
- ADD_PLACE_UNKNOWN_ERROR: "There was an error adding this place name.",
+ ADD_PLACE_UNKNOWN_ERROR: "There was an error adding this Place Name. Try saving again",
- ADD_PLACE_NO_PLACES_MESSAGE: "
You do not have any places in your High Fidelity account."
- + "
Go to your places page to create a new one. Once your place is created re-open this dialog to select it.
",
+ ADD_PLACE_NO_PLACES_MESSAGE: "You don't have any Place Names registered. Once you have a Place Name, reopen this window to select it.",
ADD_PLACE_NO_PLACES_BUTTON: "Create new place",
ADD_PLACE_UNABLE_TO_LOAD_ERROR: "We were unable to load your place names. Please try again later.",
ADD_PLACE_LOADING_DIALOG: "Loading your places...",
@@ -236,7 +235,7 @@ function chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAd
if (forcePathTo === undefined || forcePathTo === null) {
var path = "
diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js
index 7f99b367a3..3faeff4482 100644
--- a/domain-server/resources/web/settings/js/settings.js
+++ b/domain-server/resources/web/settings/js/settings.js
@@ -503,7 +503,7 @@ function showDomainCreationAlert(justConnected) {
swal({
title: 'Create new domain ID',
type: 'input',
- text: 'Enter a short description for this machine.This will help you identify which domain ID belongs to which machine.',
+ text: 'Enter a label this machine.This will help you identify which domain ID belongs to which machine.',
showCancelButton: true,
confirmButtonText: "Create",
closeOnConfirm: false,
@@ -527,13 +527,12 @@ function showDomainCreationAlert(justConnected) {
function createNewDomainID(label, justConnected) {
// get the JSON object ready that we'll use to create a new domain
var domainJSON = {
- "label": label
- //"access_token": $(Settings.ACCESS_TOKEN_SELECTOR).val()
+ "label": label
}
$.post("/api/domains", domainJSON, function(data){
// we successfully created a domain ID, set it on that field
- var domainID = data.domain_id;
+ var domainID = data.domain.id;
console.log("Setting domain id to ", data, domainID);
$(Settings.DOMAIN_ID_SELECTOR).val(domainID).change();
@@ -620,18 +619,14 @@ function parseJSONResponse(xhr) {
function showOrHideLabel() {
var type = getCurrentDomainIDType();
- if (!accessTokenIsSet() || (type !== DOMAIN_ID_TYPE_FULL && type !== DOMAIN_ID_TYPE_UNKNOWN)) {
- $(".panel#label").hide();
- return false;
- }
- $(".panel#label").show();
- return true;
+ var shouldShow = accessTokenIsSet() && (type === DOMAIN_ID_TYPE_FULL || type === DOMAIN_ID_TYPE_UNKNOWN);
+ $(".panel#label").toggle(shouldShow);
+ $("li a[href='#label']").parent().toggle(shouldShow);
+ return shouldShow;
}
function setupDomainLabelSetting() {
- if (!showOrHideLabel()) {
- return;
- }
+ showOrHideLabel();
var html = "
- Add your High Fidelity username and any other usernames to grant administrator privileges.
-
+ Add your High Fidelity username and any other usernames to grant administrator privileges
@@ -78,7 +77,7 @@
- Who can connect to your domain?
+ Who can connect to your domain?
@@ -87,25 +86,21 @@
@@ -113,7 +108,7 @@
- Who can rez items in your domain?
+ Who can rez items in your domain?
@@ -122,33 +117,32 @@
-
+
+
+
+
-
+
@@ -188,36 +182,79 @@
-
+
+
+
+
-
+
-
-
+
+
+
Congratulations!
-
-
Congratulations! You have successfully setup and configured your cloud hosted domain.
+
+
You have successfully setup and configured your cloud hosted domain.
-
-
-
+
+
+
+ Invite people in!
+
+
+ Share your domain:
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+ Go to your Domain:
+
+
+
Browse environments in the Marketplace to select the perfect content set for your VR world.
+
Invite people to your domain right now.
+
Meet new people and explore other domains.
+
+
+
+
+ Continue to Domain settings:
+
+
+
Set additional permissions for who can visit and make changes.
+
Adjust audio settings.
+
Back up your domain's content.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/domain-server/resources/web/wizard/js/wizard.js b/domain-server/resources/web/wizard/js/wizard.js
index 1af3f305b7..c0d17ca02c 100644
--- a/domain-server/resources/web/wizard/js/wizard.js
+++ b/domain-server/resources/web/wizard/js/wizard.js
@@ -2,6 +2,8 @@ var Metaverse = {
accessToken: null
}
+var currentStepNumber;
+
$(document).ready(function(){
Strings.ADD_PLACE_NOT_CONNECTED_MESSAGE = "You must have an access token to query your High Fidelity places.
" +
"Please go back and connect your account.";
@@ -10,6 +12,22 @@ $(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
+ $('.perms-link').on('click', function() {
+ var modal_body = '
';
+ modal_body += 'None - No one will have permissions. Only you and the users your have given administrator privileges to will have permissions.';
+ modal_body += 'Friends - Users who are your Friends in High Fidelity.';
+ modal_body += 'Users logged into High Fidelity - Users who are currently logged into High Fidelity.';
+ modal_body += 'Everyone - Anyone who uses High Fidelity.';
+ modal_body += '
';
+
+ dialog = bootbox.dialog({
+ title: "User definition",
+ message: modal_body,
+ closeButton: true
+ });
+ return false;
+ });
+
$('body').on('click', '.next-button', function() {
goToNextStep();
});
@@ -52,8 +70,38 @@ $(document).ready(function(){
});
});
- $('body').on('click', '#explore-settings', function() {
- exploreSettings();
+ $('body').on('click', '#visit-domain', function() {
+ $('#share-link')[0].click();
+ });
+
+ $('input[type=radio][name=connect-radio]').change(function() {
+ var inputs = $('input[type=radio][name=rez-radio]');
+ var disabled = [];
+
+ switch (this.value) {
+ case 'none':
+ disabled = inputs.splice(1);
+ break;
+ case 'friends':
+ disabled = inputs.splice(2);
+ break;
+ case 'logged-in':
+ disabled = inputs.splice(3);
+ break;
+ case 'everyone':
+ disabled = inputs.splice(4);
+ break;
+ }
+
+ $.each(inputs, function() {
+ $(this).prop('disabled', false);
+ });
+ $.each(disabled, function() {
+ if ($(this).prop('checked')) {
+ $(inputs.last()).prop('checked', true);
+ }
+ $(this).prop('disabled', true);
+ });
});
reloadSettings(function(success) {
@@ -72,13 +120,21 @@ $(document).ready(function(){
});
});
+function copyToClipboard(element) {
+ var $temp = $("");
+ $("body").append($temp);
+ $temp.val($(element).text()).select();
+ document.execCommand("copy");
+ $temp.remove();
+}
+
function setupWizardSteps() {
- var stepsCompleted = Settings.data.values.wizard.steps_completed;
+ currentStepNumber = Settings.data.values.wizard.steps_completed;
var steps = null;
if (Settings.data.values.wizard.cloud_domain) {
$('.desktop-only').remove();
- $('.wizard-step').find('.back-button').hide();
+ $('.wizard-step:first').find('.back-button').hide();
steps = $('.wizard-step');
$(steps).each(function(i) {
@@ -86,7 +142,7 @@ function setupWizardSteps() {
});
$('#permissions-description').html('You have been assigned administrator privileges to this domain.');
- $('#admin-description').html('Add more High Fidelity usernames to grant administrator privileges.');
+ $('#admin-description').html('Add more High Fidelity usernames');
} else {
$('.cloud-only').remove();
$('#save-permissions').text("Finish");
@@ -96,18 +152,20 @@ function setupWizardSteps() {
$(this).children(".step-title").text("Step " + (i + 1) + " of " + steps.length);
});
- if (stepsCompleted == 0) {
+ if (currentStepNumber == 0) {
$('#skip-wizard-button').show();
}
}
- var currentStep = steps[stepsCompleted];
+ var currentStep = steps[currentStepNumber];
$(currentStep).show();
}
function updatePlaceNameLink(address) {
if (address) {
- $('#place-name-link').html('Your domain is reachable at: ' + address + '');
+ var url = URLs.PLACE_URL + '/' + address;
+ $('#place-name-link').html('Your domain is reachable at: ' + address + '');
+ $('#share-field a').attr('href', url).text(url);
}
}
@@ -204,7 +262,7 @@ function goToNextStep() {
currentStep.hide();
nextStep.show();
- var currentStepNumber = parseInt(Settings.data.values.wizard.steps_completed) + 1;
+ currentStepNumber += 1;
postSettings({
"wizard": {
@@ -233,7 +291,7 @@ function goToPreviousStep() {
currentStep.hide();
previousStep.show();
- var currentStepNumber = parseInt(Settings.data.values.wizard.steps_completed) - 1;
+ currentStepNumber -= 1;
postSettings({
"wizard": {
@@ -439,7 +497,7 @@ function saveUsernamePassword() {
return;
}
- var currentStepNumber = parseInt(Settings.data.values.wizard.steps_completed) + 1;
+ currentStepNumber += 1;
var formJSON = {
"security": {
@@ -459,14 +517,3 @@ function saveUsernamePassword() {
location.reload();
});
}
-
-function exploreSettings() {
- if ($('#go-to-domain').is(":checked")) {
- var link = $('#place-name-link a:first');
- if (link.length > 0) {
- window.open(link.attr("href"));
- }
- }
-
- goToNextStep();
-}
diff --git a/domain-server/src/DomainGatekeeper.cpp b/domain-server/src/DomainGatekeeper.cpp
index 188c420a5d..c6eaa03634 100644
--- a/domain-server/src/DomainGatekeeper.cpp
+++ b/domain-server/src/DomainGatekeeper.cpp
@@ -183,6 +183,11 @@ NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QStrin
#ifdef WANT_DEBUG
qDebug() << "| user-permissions: specific MAC matches, so:" << userPerms;
+#endif
+ } else if (_server->_settingsManager.hasPermissionsForMachineFingerprint(machineFingerprint)) {
+ userPerms = _server->_settingsManager.getPermissionsForMachineFingerprint(machineFingerprint);
+#ifdef WANT_DEBUG
+ qDebug(() << "| user-permissions: specific Machine Fingerprint matches, so: " << userPerms;
#endif
} else if (_server->_settingsManager.hasPermissionsForIP(senderAddress)) {
// this user comes from an IP we have in our permissions table, apply those permissions
diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp
index c2fe3af7c1..2d8bf7418a 100644
--- a/domain-server/src/DomainServer.cpp
+++ b/domain-server/src/DomainServer.cpp
@@ -94,7 +94,7 @@ bool DomainServer::forwardMetaverseAPIRequest(HTTPConnection* connection,
root.insert(requestSubobjectKey, subobject);
QJsonDocument doc { root };
- QUrl url { NetworkingConstants::METAVERSE_SERVER_URL.toString() + metaversePath };
+ QUrl url { NetworkingConstants::METAVERSE_SERVER_URL().toString() + metaversePath };
QNetworkRequest req(url);
req.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
@@ -420,7 +420,7 @@ bool DomainServer::optionallySetupOAuth() {
// if we don't have an oauth provider URL then we default to the default node auth url
if (_oauthProviderURL.isEmpty()) {
- _oauthProviderURL = NetworkingConstants::METAVERSE_SERVER_URL;
+ _oauthProviderURL = NetworkingConstants::METAVERSE_SERVER_URL();
}
auto accountManager = DependencyManager::get();
@@ -2159,7 +2159,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
QJsonDocument doc(root);
- QUrl url { NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/api/v1/places/" + place_id };
+ QUrl url { NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/api/v1/places/" + place_id };
url.setQuery("access_token=" + accessTokenVariant->toString());
diff --git a/domain-server/src/DomainServerSettingsManager.cpp b/domain-server/src/DomainServerSettingsManager.cpp
index 6c50e5245d..05227d35b7 100644
--- a/domain-server/src/DomainServerSettingsManager.cpp
+++ b/domain-server/src/DomainServerSettingsManager.cpp
@@ -304,6 +304,26 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
*wizardCompletedOnce = QVariant(true);
}
+ if (oldVersion < 2.1) {
+ // convert old avatar scale settings into avatar height.
+
+ const QString AVATAR_MIN_SCALE_KEYPATH = "avatars.min_avatar_scale";
+ const QString AVATAR_MAX_SCALE_KEYPATH = "avatars.max_avatar_scale";
+ const QString AVATAR_MIN_HEIGHT_KEYPATH = "avatars.min_avatar_height";
+ const QString AVATAR_MAX_HEIGHT_KEYPATH = "avatars.max_avatar_height";
+
+ QVariant* avatarMinScale = _configMap.valueForKeyPath(AVATAR_MIN_SCALE_KEYPATH);
+ if (avatarMinScale) {
+ float scale = avatarMinScale->toFloat();
+ _configMap.valueForKeyPath(AVATAR_MIN_HEIGHT_KEYPATH, scale * DEFAULT_AVATAR_HEIGHT);
+ }
+
+ QVariant* avatarMaxScale = _configMap.valueForKeyPath(AVATAR_MAX_SCALE_KEYPATH);
+ if (avatarMaxScale) {
+ float scale = avatarMaxScale->toFloat();
+ _configMap.valueForKeyPath(AVATAR_MAX_HEIGHT_KEYPATH, scale * DEFAULT_AVATAR_HEIGHT);
+ }
+ }
// write the current description version to our settings
*versionVariant = _descriptionVersion;
@@ -550,6 +570,7 @@ void DomainServerSettingsManager::unpackPermissions() {
} else {
// anonymous, logged in, and friend users get connect permissions by default
perms->set(NodePermissions::Permission::canConnectToDomain);
+ perms->set(NodePermissions::Permission::canRezTemporaryCertifiedEntities);
}
// add the permissions to the standard map
@@ -671,7 +692,7 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointerclear(NodePermissions::Permission::canConnectToDomain);
- } else {
+ }
+
+ // if we didn't have a username, or this domain-server uses the "multi-kick" setting to
+ // kick logged in users via username AND machine fingerprint (or IP as fallback)
+ // then we remove connect permissions for the machine fingerprint (or IP as fallback)
+ const QString MULTI_KICK_SETTINGS_KEYPATH = "security.multi_kick_logged_in";
+
+ if (verifiedUsername.isEmpty() || valueOrDefaultValueForKeyPath(MULTI_KICK_SETTINGS_KEYPATH).toBool()) {
// remove connect permissions for the machine fingerprint
DomainServerNodeData* nodeData = static_cast(matchingNode->getLinkedData());
if (nodeData) {
@@ -718,8 +746,8 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointergetPublicSockAddr().getAddress() ||
- kickAddress == limitedNodeList->getLocalSockAddr().getAddress() ||
- kickAddress.isLoopback() ) {
+ kickAddress == limitedNodeList->getLocalSockAddr().getAddress() ||
+ kickAddress.isLoopback() ) {
qWarning() << "attempt to kick node running on same machine as domain server, ignoring KickRequest";
return;
}
diff --git a/ice-server/src/IceServer.cpp b/ice-server/src/IceServer.cpp
index f8bf1f62ae..3cf1e1450e 100644
--- a/ice-server/src/IceServer.cpp
+++ b/ice-server/src/IceServer.cpp
@@ -208,7 +208,7 @@ void IceServer::requestDomainPublicKey(const QUuid& domainID) {
// send a request to the metaverse API for the public key for this domain
auto& networkAccessManager = NetworkAccessManager::getInstance();
- QUrl publicKeyURL { NetworkingConstants::METAVERSE_SERVER_URL };
+ QUrl publicKeyURL { NetworkingConstants::METAVERSE_SERVER_URL() };
QString publicKeyPath = QString("/api/v1/domains/%1/public_key").arg(uuidStringWithoutCurlyBraces(domainID));
publicKeyURL.setPath(publicKeyPath);
diff --git a/interface/resources/controllers/oculus_touch.json b/interface/resources/controllers/oculus_touch.json
index 03fc1cbefb..b818d371e3 100644
--- a/interface/resources/controllers/oculus_touch.json
+++ b/interface/resources/controllers/oculus_touch.json
@@ -13,11 +13,11 @@
{ "from": "OculusTouch.LY", "to": "Standard.LY",
"filters": [
- { "type": "deadZone", "min": 0.3 },
+ { "type": "deadZone", "min": 0.7 },
"invert"
]
},
- { "from": "OculusTouch.LX", "filters": { "type": "deadZone", "min": 0.3 }, "to": "Standard.LX" },
+ { "from": "OculusTouch.LX", "filters": { "type": "deadZone", "min": 0.7 }, "to": "Standard.LX" },
{ "from": "OculusTouch.LT", "to": "Standard.LTClick",
"peek": true,
"filters": [ { "type": "hysteresis", "min": 0.85, "max": 0.9 } ]
@@ -29,11 +29,11 @@
{ "from": "OculusTouch.RY", "to": "Standard.RY",
"filters": [
- { "type": "deadZone", "min": 0.3 },
+ { "type": "deadZone", "min": 0.7 },
"invert"
]
},
- { "from": "OculusTouch.RX", "filters": { "type": "deadZone", "min": 0.3 }, "to": "Standard.RX" },
+ { "from": "OculusTouch.RX", "filters": { "type": "deadZone", "min": 0.7 }, "to": "Standard.RX" },
{ "from": "OculusTouch.RT", "to": "Standard.RTClick",
"peek": true,
"filters": [ { "type": "hysteresis", "min": 0.85, "max": 0.9 } ]
diff --git a/interface/resources/fonts/hifi-glyphs.ttf b/interface/resources/fonts/hifi-glyphs.ttf
index 3db48602b1..4cc5a0fe4f 100644
Binary files a/interface/resources/fonts/hifi-glyphs.ttf and b/interface/resources/fonts/hifi-glyphs.ttf differ
diff --git a/interface/resources/html/createGlobalEventBridge.js b/interface/resources/html/createGlobalEventBridge.js
index 4a0de464c3..a180fbc6cc 100644
--- a/interface/resources/html/createGlobalEventBridge.js
+++ b/interface/resources/html/createGlobalEventBridge.js
@@ -33,6 +33,56 @@ var EventBridge;
// replace the TempEventBridge with the real one.
var tempEventBridge = EventBridge;
EventBridge = channel.objects.eventBridge;
+ EventBridge.audioOutputDeviceChanged.connect(function(deviceName) {
+ navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(function(mediaStream) {
+ navigator.mediaDevices.enumerateDevices().then(function(devices) {
+ devices.forEach(function(device) {
+ if (device.kind == "audiooutput") {
+ if (device.label == deviceName){
+ console.log("Changing HTML audio output to device " + device.label);
+ var deviceId = device.deviceId;
+ var videos = document.getElementsByTagName("video");
+ for (var i = 0; i < videos.length; i++){
+ videos[i].setSinkId(deviceId);
+ }
+ var audios = document.getElementsByTagName("audio");
+ for (var i = 0; i < audios.length; i++){
+ audios[i].setSinkId(deviceId);
+ }
+ }
+ }
+ });
+
+ }).catch(function(err) {
+ console.log("Error getting media devices"+ err.name + ": " + err.message);
+ });
+ }).catch(function(err) {
+ console.log("Error getting user media"+ err.name + ": " + err.message);
+ });
+ });
+
+ // To be able to update the state of the output device selection for every element added to the DOM
+ // we need to listen to events that might precede the addition of this elements.
+ // A more robust hack will be to add a setInterval that look for DOM changes every 100-300 ms (low performance?)
+
+ window.addEventListener("load",function(event) {
+ setTimeout(function() {
+ EventBridge.forceHtmlAudioOutputDeviceUpdate();
+ }, 1200);
+ }, false);
+
+ document.addEventListener("click",function(){
+ setTimeout(function() {
+ EventBridge.forceHtmlAudioOutputDeviceUpdate();
+ }, 1200);
+ }, false);
+
+ document.addEventListener("change",function(){
+ setTimeout(function() {
+ EventBridge.forceHtmlAudioOutputDeviceUpdate();
+ }, 1200);
+ }, false);
+
tempEventBridge._callbacks.forEach(function (callback) {
EventBridge.scriptEventReceived.connect(callback);
});
diff --git a/interface/resources/html/help.html b/interface/resources/html/help.html
deleted file mode 100644
index 1c70300297..0000000000
--- a/interface/resources/html/help.html
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
- Welcome to Interface
-
-
-
-
-
-
-
To request entry and get free HFC, please contact info@highfidelity.com with your High Fidelity account username and the email address registered to that account.");
+ }
ListElement {
isExpanded: false;
question: "What are private keys?"
@@ -118,12 +92,7 @@ Item {
ListElement {
isExpanded: false;
question: "My HFC balance isn't what I expect it to be. Why?"
- answer: qsTr('High Fidelity Coin (HFC) transactions are backed by a blockchain, which takes time to update. The status of a transaction usually updates within 90 seconds.
Tap here to learn more about the blockchain.');
- }
- ListElement {
- isExpanded: false;
- question: "My friend purchased my item from the Marketplace, but I still haven't received the money from the sale. Why not?"
- answer: qsTr('High Fidelity Coin (HFC) transactions are backed by a blockchain, which takes time to update. The status of a transaction usually updates within 90 seconds, at which point you will receive your money.
Tap here to learn more about the blockchain.');
+ answer: qsTr('High Fidelity Coin (HFC) transactions are backed by a blockchain, which takes time to update. The status of a transaction usually updates within a few seconds.