Merge branch 'master' of github.com:highfidelity/hifi into toulouse

This commit is contained in:
Sam Gateau 2019-08-09 11:25:03 -07:00
commit fe08609b0c
28 changed files with 1228 additions and 141 deletions

View file

@ -5,7 +5,7 @@ If you are upgrading from previous versions, do a clean uninstall of those versi
Note: The prerequisites will require about 10 GB of space on your drive. You will also need a system with at least 8GB of main memory.
### Step 1. Visual Studio & Python
### Step 1. Visual Studio & Python 3.x
If you dont have Community or Professional edition of Visual Studio, download [Visual Studio Community 2019](https://visualstudio.microsoft.com/vs/). If you have Visual Studio 2017, you are not required to download Visual Studio 2019.
@ -21,7 +21,7 @@ When selecting components, check "Desktop development with C++". On the right on
* MSVC v141 - VS 2017 C++ x64/x86 build tools
* MSVC v140 - VS 2015 C++ build tools (v14.00)
If you do not already have a Python development environment installed, also check "Python Development" in this screen.
If you do not already have a Python 3.x development environment installed, also check "Python Development" in this screen.
If you already have Visual Studio installed and need to add Python, open the "Add or remove programs" control panel and find the "Microsoft Visual Studio Installer". Select it and click "Modify". In the installer, select "Modify" again, then check "Python Development" and allow the installer to apply the changes.
@ -31,9 +31,10 @@ If you do not wish to use the Python installation bundled with Visual Studio, yo
### Step 2. Installing CMake
Download and install the latest version of CMake 3.14.
Download and install the latest version of CMake 3.15.
* Note that earlier versions of CMake will work, but there is a specific bug related to the interaction of Visual Studio 2019 and CMake versions prior to 3.15 that will cause Visual Studio to rebuild far more than it needs to on every build
Download the file named win64-x64 Installer from the [CMake Website](https://cmake.org/download/). You can access the installer on this [3.14 Version page](https://cmake.org/files/v3.14/). During installation, make sure to check "Add CMake to system PATH for all users" when prompted.
Download the file named win64-x64 Installer from the [CMake Website](https://cmake.org/download/). You can access the installer on this [3.15 Version page](https://cmake.org/files/v3.15/). During installation, make sure to check "Add CMake to system PATH for all users" when prompted.
### Step 3. Create VCPKG environment variable
In the next step, you will use CMake to build High Fidelity. By default, the CMake process builds dependency files in Windows' `%TEMP%` directory, which is periodically cleared by the operating system. To prevent you from having to re-build the dependencies in the event that Windows clears that directory, we recommend that you create a `HIFI_VCPKG_BASE` environment variable linked to a directory somewhere on your machine. That directory will contain all dependency files until you manually remove them.
@ -42,9 +43,18 @@ To create this variable:
* Naviagte to 'Edit the System Environment Variables' Through the start menu.
* Click on 'Environment Variables'
* Select 'New'
* Set "Variable name" to HIFI_VCPKG_BASE
* Set "Variable name" to `HIFI_VCPKG_BASE`
* Set "Variable value" to any directory that you have control over.
Additionally, if you have Visual Studio 2019 installed and _only_ Visual Studio 2019 (i.e. you do not have Visual Studio 2017 installed) you must add an additional environment variable `HIFI_VCPKG_BOOTSTRAP` that will fix a bug in our `vcpkg` pre-build step.
To create this variable:
* Naviagte to 'Edit the System Environment Variables' Through the start menu.
* Click on 'Environment Variables'
* Select 'New'
* Set "Variable name" to `HIFI_VCPKG_BOOTSTRAP`
* Set "Variable value" to `1`
### Step 4. Running CMake to Generate Build Files
Run Command Prompt from Start and run the following commands:

View file

@ -71,16 +71,19 @@ endif()
if 'Windows' == system:
self.exe = os.path.join(self.path, 'vcpkg.exe')
self.bootstrapCmd = 'bootstrap-vcpkg.bat'
self.vcpkgUrl = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/vcpkg-win32.tar.gz?versionId=YZYkDejDRk7L_hrK_WVFthWvisAhbDzZ'
self.vcpkgHash = '3e0ff829a74956491d57666109b3e6b5ce4ed0735c24093884317102387b2cb1b2cd1ff38af9ed9173501f6e32ffa05cc6fe6d470b77a71ca1ffc3e0aa46ab9e'
self.hostTriplet = 'x64-windows'
elif 'Darwin' == system:
self.exe = os.path.join(self.path, 'vcpkg')
self.bootstrapCmd = 'bootstrap-vcpkg.sh'
self.vcpkgUrl = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/vcpkg-osx.tar.gz?versionId=_fhqSxjfrtDJBvEsQ8L_ODcdUjlpX9cc'
self.vcpkgHash = '519d666d02ef22b87c793f016ca412e70f92e1d55953c8f9bd4ee40f6d9f78c1df01a6ee293907718f3bbf24075cc35492fb216326dfc50712a95858e9cbcb4d'
self.hostTriplet = 'x64-osx'
else:
self.exe = os.path.join(self.path, 'vcpkg')
self.bootstrapCmd = 'bootstrap-vcpkg.sh'
self.vcpkgUrl = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/vcpkg-linux.tar.gz?versionId=97Nazh24etEVKWz33XwgLY0bvxEfZgMU'
self.vcpkgHash = '6a1ce47ef6621e699a4627e8821ad32528c82fce62a6939d35b205da2d299aaa405b5f392df4a9e5343dd6a296516e341105fbb2dd8b48864781d129d7fba10d'
self.hostTriplet = 'x64-linux'
@ -141,8 +144,14 @@ endif()
downloadVcpkg = True
if downloadVcpkg:
print("Fetching vcpkg from {} to {}".format(self.vcpkgUrl, self.path))
hifi_utils.downloadAndExtract(self.vcpkgUrl, self.path, self.vcpkgHash)
if "HIFI_VCPKG_BOOTSTRAP" in os.environ:
print("Cloning vcpkg from github to {}".format(self.path))
hifi_utils.executeSubprocess(['git', 'clone', 'git@github.com:microsoft/vcpkg.git', self.path])
print("Bootstrapping vcpkg")
hifi_utils.executeSubprocess([self.bootstrapCmd], folder=self.path)
else:
print("Fetching vcpkg from {} to {}".format(self.vcpkgUrl, self.path))
hifi_utils.downloadAndExtract(self.vcpkgUrl, self.path, self.vcpkgHash)
print("Replacing port files")
portsPath = os.path.join(self.path, 'ports')

File diff suppressed because it is too large Load diff

View file

@ -292,7 +292,7 @@ static const uint32_t MAX_CONCURRENT_RESOURCE_DOWNLOADS = 4;
// For processing on QThreadPool, we target a number of threads after reserving some
// based on how many are being consumed by the application and the display plugin. However,
// we will never drop below the 'min' value
static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
static const int MIN_PROCESSING_THREAD_POOL_SIZE = 2;
static const QString SNAPSHOT_EXTENSION = ".jpg";
static const QString JPG_EXTENSION = ".jpg";

View file

@ -258,6 +258,7 @@ void GraphicsEngine::render_performFrame() {
batch.setFramebuffer(finalFramebuffer);
batch.enableSkybox(true);
batch.enableStereo(isStereo);
batch.clearDepthStencilFramebuffer(1.0, 0);
batch.setViewportTransform({ 0, 0, finalFramebuffer->getSize() });
_splashScreen->render(batch, viewFrustum, renderArgs._renderMethod == RenderArgs::RenderMethod::FORWARD);
});

View file

@ -43,6 +43,8 @@ set(src_files
src/LaunchInterface.h
src/CustomUI.h
src/CustomUI.m
src/NSTask+NSTaskExecveAdditions.h
src/NSTask+NSTaskExecveAdditions.m
src/main.mm
nib/Window.xib
nib/SplashScreen.xib

View file

@ -7,6 +7,7 @@
#import "ProcessScreen.h"
#import "ErrorViewController.h"
#import "Settings.h"
#import "NSTask+NSTaskExecveAdditions.h"
@interface Launcher ()
@ -456,8 +457,6 @@ static BOOL const DELETE_ZIP_FILES = TRUE;
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
NSURL *url = [NSURL fileURLWithPath:[workspace fullPathForApplication:[[self getAppPath] stringByAppendingString:@"interface.app/Contents/MacOS/interface"]]];
NSError *error = nil;
NSString* contentPath = [[self getDownloadPathForContentAndScripts] stringByAppendingString:@"content"];
NSString* displayName = [ self displayName];
NSString* scriptsPath = [[self getAppPath] stringByAppendingString:@"interface.app/Contents/Resources/scripts/simplifiedUIBootstrapper.js"];
@ -484,13 +483,11 @@ static BOOL const DELETE_ZIP_FILES = TRUE;
@"--no-updater",
@"--no-launcher", nil];
}
[workspace launchApplicationAtURL:url options:NSWorkspaceLaunchNewInstance configuration:[NSDictionary dictionaryWithObject:arguments forKey:NSWorkspaceLaunchConfigurationArguments] error:&error];
[NSTimer scheduledTimerWithTimeInterval: 3.0
target: self
selector: @selector(exitLauncher:)
userInfo:nil
repeats: NO];
NSTask *task = [[NSTask alloc] init];
task.launchPath = [url path];
task.arguments = arguments;
[task replaceThisProcess];
}
- (ProcessState) currentProccessState
@ -500,15 +497,20 @@ static BOOL const DELETE_ZIP_FILES = TRUE;
- (void) callLaunchInterface:(NSTimer*) timer
{
NSWindow* mainWindow = [[[NSApplication sharedApplication] windows] objectAtIndex:0];
ProcessScreen* processScreen = [[ProcessScreen alloc] initWithNibName:@"ProcessScreen" bundle:nil];
[[[[NSApplication sharedApplication] windows] objectAtIndex:0] setContentViewController: processScreen];
[self launchInterface];
}
- (void) exitLauncher:(NSTimer*) timer
{
[NSApp terminate:self];
[mainWindow setContentViewController: processScreen];
@try
{
[self launchInterface];
}
@catch (NSException *exception)
{
NSLog(@"Caught exception: Name: %@, Reason: %@", exception.name, exception.reason);
ErrorViewController* errorViewController = [[ErrorViewController alloc] initWithNibName:@"ErrorScreen" bundle:nil];
[mainWindow setContentViewController: errorViewController];
}
}
@end

View file

@ -0,0 +1,9 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSTask (NSTaskExecveAdditions)
- (void) replaceThisProcess;
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,73 @@
#import "NSTask+NSTaskExecveAdditions.h"
#import <libgen.h>
char **
toCArray(NSArray<NSString *> *array)
{
// Add one to count to accommodate the NULL that terminates the array.
char **cArray = (char **) calloc([array count] + 1, sizeof(char *));
if (cArray == NULL) {
NSException *exception = [NSException
exceptionWithName:@"MemoryException"
reason:@"malloc failed"
userInfo:nil];
@throw exception;
}
char *str;
for (int i = 0; i < [array count]; i++) {
str = (char *) [array[i] UTF8String];
if (str == NULL) {
NSException *exception = [NSException
exceptionWithName:@"NULLStringException"
reason:@"UTF8String was NULL"
userInfo:nil];
@throw exception;
}
if (asprintf(&cArray[i], "%s", str) == -1) {
for (int j = 0; j < i; j++) {
free(cArray[j]);
}
free(cArray);
NSException *exception = [NSException
exceptionWithName:@"MemoryException"
reason:@"malloc failed"
userInfo:nil];
@throw exception;
}
}
return cArray;
}
@implementation NSTask (NSTaskExecveAdditions)
- (void) replaceThisProcess {
char **args = toCArray([@[[self launchPath]] arrayByAddingObjectsFromArray:[self arguments]]);
NSMutableArray *env = [[NSMutableArray alloc] init];
NSDictionary* environvment = [[NSProcessInfo processInfo] environment];
for (NSString* key in environvment) {
NSString* environmentVariable = [[key stringByAppendingString:@"="] stringByAppendingString:environvment[key]];
[env addObject:environmentVariable];
}
char** envp = toCArray(env);
// `execve` replaces the current process with `path`.
// It will only return if it fails to replace the current process.
chdir(dirname(args[0]));
execve(args[0], (char * const *)args, envp);
// If we're here `execve` failed. :(
for (int i = 0; i < [[self arguments] count]; i++) {
free((void *) args[i]);
}
free((void *) args);
NSException *exception = [NSException
exceptionWithName:@"ExecveException"
reason:[NSString stringWithFormat:@"couldn't execve: %s", strerror(errno)]
userInfo:nil];
@throw exception;
}
@end

View file

@ -57,14 +57,12 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
lowerBound = upperBound;
}
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1) {
_duringInterp = false;
switchRandomState(animVars, context, desiredState, _duringInterp);
switchRandomState(animVars, context, desiredState, false);
} else {
// firing a random switch, be sure that we aren't completing a previously triggered transition
if (currentStateHasPriority) {
if (desiredState->getID() != _currentState->getID()) {
_duringInterp = true;
switchRandomState(animVars, context, desiredState, _duringInterp);
switchRandomState(animVars, context, desiredState, true);
} else {
_duringInterp = false;
}
@ -79,8 +77,7 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
// evaluate currentState transitions
auto transitionState = evaluateTransitions(animVars);
if (transitionState != _currentState) {
_duringInterp = true;
switchRandomState(animVars, context, transitionState, _duringInterp);
switchRandomState(animVars, context, transitionState, true);
_triggerTime = randFloatInRange(_triggerTimeMin, _triggerTimeMax);
_randomSwitchTime = randFloatInRange(_randomSwitchTimeMin, _randomSwitchTimeMax);
}
@ -172,6 +169,9 @@ void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const A
_lastPlayedState = nextStateNode->getID();
if (shouldInterp) {
bool interpActive = _duringInterp;
_duringInterp = true;
const float FRAMES_PER_SECOND = 30.0f;
auto prevStateNode = _children[_currentState->getChildIndex()];
@ -195,13 +195,21 @@ void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const A
}
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
} else if (_interpType == InterpType::SnapshotPrev) {
// snapshot previoius pose
// snapshot previous pose
_prevPoses = _poses;
// no need to evaluate _nextPoses we will do it dynamically during the interp,
// however we need to set the current frame.
if (!desiredState->getResume()) {
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
}
} else if (_interpType == InterpType::EvaluateBoth) {
// need to set current frame in destination branch.
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
if (interpActive) {
// snapshot previous pose
_prevPoses = _poses;
_interpType = InterpType::SnapshotPrev;
}
} else {
assert(false);
}

View file

@ -128,6 +128,7 @@ void AnimStateMachine::switchState(const AnimVariantMap& animVars, const AnimCon
auto prevStateNode = _children[_currentState->getChildIndex()];
auto nextStateNode = _children[desiredState->getChildIndex()];
bool interpActive = _duringInterp;
_duringInterp = true;
_alpha = 0.0f;
float duration = std::max(0.001f, animVars.lookup(desiredState->_interpDurationVar, desiredState->_interpDuration));
@ -146,11 +147,19 @@ void AnimStateMachine::switchState(const AnimVariantMap& animVars, const AnimCon
nextStateNode->setCurrentFrame(desiredState->_interpTarget);
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
} else if (_interpType == InterpType::SnapshotPrev) {
// snapshot previoius pose
// snapshot previous pose
_prevPoses = _poses;
// no need to evaluate _nextPoses we will do it dynamically during the interp,
// however we need to set the current frame.
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
} else if (_interpType == InterpType::EvaluateBoth) {
// need to set current frame in destination branch.
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
if (interpActive) {
// snapshot previous pose
_prevPoses = _poses;
_interpType = InterpType::SnapshotPrev;
}
} else {
assert(false);
}

View file

@ -2112,8 +2112,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
}
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
_animVars.set("talkOverlayAlpha", easeOutInValue);
_animVars.set("idleOverlayAlpha", easeOutInValue); // backward compatibility for older anim graphs.
} else {
_animVars.set("talkOverlayAlpha", 1.0f);
_animVars.set("idleOverlayAlpha", 1.0f); // backward compatibility for older anim graphs.
}
} else {
if (_talkIdleInterpTime < 1.0f) {
@ -2124,8 +2126,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
float talkAlpha = 1.0f - easeOutInValue;
_animVars.set("talkOverlayAlpha", talkAlpha);
_animVars.set("idleOverlayAlpha", talkAlpha); // backward compatibility for older anim graphs.
} else {
_animVars.set("talkOverlayAlpha", 0.0f);
_animVars.set("idleOverlayAlpha", 0.0f); // backward compatibility for older anim graphs.
}
}

View file

@ -78,7 +78,8 @@ public:
void setVsyncEnabled(bool vsyncEnabled) { _vsyncEnabled = vsyncEnabled; }
bool isVsyncEnabled() const { return _vsyncEnabled; }
// Three threads, one for rendering, one for texture transfers, one reserved for the GL driver
int getRequiredThreadCount() const override { return 3; }
// Drop to one reserved for better other-task performance in desktop
int getRequiredThreadCount() const override { return 1; }
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&)> getHUDOperator() override;
void copyTextureToQuickFramebuffer(NetworkTexturePointer source,

View file

@ -53,6 +53,8 @@ public:
void updateVisionSqueezeParameters(float visionSqueezeX, float visionSqueezeY, float visionSqueezeTransition,
int visionSqueezePerEye, float visionSqueezeGroundPlaneY,
float visionSqueezeSpotlightSize);
// Attempt to reserve two threads.
int getRequiredThreadCount() const override { return 2; }
signals:
void hmdMountedChanged();

View file

@ -30,34 +30,18 @@ Q_DECLARE_METATYPE(QByteArray*)
XMLHttpRequestClass::XMLHttpRequestClass(QScriptEngine* engine) :
_engine(engine),
_async(true),
_url(),
_method(""),
_responseType(""),
_request(),
_reply(NULL),
_sendData(NULL),
_rawResponseData(),
_responseData(""),
_onTimeout(QScriptValue::NullValue),
_onReadyStateChange(QScriptValue::NullValue),
_readyState(XMLHttpRequestClass::UNSENT),
_errorCode(QNetworkReply::NoError),
_timeout(0),
_timer(this),
_numRedirects(0) {
_timer(this) {
_request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
_timer.setSingleShot(true);
}
XMLHttpRequestClass::~XMLHttpRequestClass() {
if (_reply) { delete _reply; }
if (_sendData) { delete _sendData; }
if (_reply) { _reply->deleteLater(); }
}
QScriptValue XMLHttpRequestClass::constructor(QScriptContext* context, QScriptEngine* engine) {
return engine->newQObject(new XMLHttpRequestClass(engine));
return engine->newQObject(new XMLHttpRequestClass(engine), QScriptEngine::ScriptOwnership);
}
QScriptValue XMLHttpRequestClass::getStatus() const {
@ -169,13 +153,12 @@ void XMLHttpRequestClass::send() {
void XMLHttpRequestClass::send(const QScriptValue& data) {
if (_readyState == OPENED && !_reply) {
if (!data.isNull()) {
_sendData = new QBuffer(this);
if (data.isObject()) {
QByteArray ba = qscriptvalue_cast<QByteArray>(data);
_sendData->setData(ba);
_sendData = qscriptvalue_cast<QByteArray>(data);
} else {
_sendData->setData(data.toString().toUtf8());
_sendData = data.toString().toUtf8();
}
}
@ -235,6 +218,10 @@ void XMLHttpRequestClass::requestFinished() {
}
}
disconnectFromReply(_reply);
_reply->deleteLater();
_reply = nullptr;
setReadyState(DONE);
emit requestComplete();
}
@ -246,7 +233,7 @@ void XMLHttpRequestClass::abortRequest() {
disconnectFromReply(_reply);
_reply->abort();
_reply->deleteLater();
_reply = NULL;
_reply = nullptr;
}
}

View file

@ -98,23 +98,23 @@ private:
void disconnectFromReply(QNetworkReply* reply);
void abortRequest();
QScriptEngine* _engine;
bool _async;
QScriptEngine* _engine { nullptr };
bool _async { true };
QUrl _url;
QString _method;
QString _responseType;
QNetworkRequest _request;
QNetworkReply* _reply;
QBuffer* _sendData;
QNetworkReply* _reply { nullptr };
QByteArray _sendData;
QByteArray _rawResponseData;
QScriptValue _responseData;
QScriptValue _onTimeout;
QScriptValue _onReadyStateChange;
ReadyState _readyState;
QNetworkReply::NetworkError _errorCode;
int _timeout;
QScriptValue _onTimeout { QScriptValue::NullValue };
QScriptValue _onReadyStateChange { QScriptValue::NullValue };
ReadyState _readyState { XMLHttpRequestClass::UNSENT };
QNetworkReply::NetworkError _errorCode { QNetworkReply::NoError };
int _timeout { 0 };
QTimer _timer;
int _numRedirects;
int _numRedirects { 0 };
private slots:
void requestFinished();

View file

@ -39,6 +39,10 @@ module.exports = {
if (error) {
response = { statusCode: httpRequest.status };
}
// Break circular reference to httpRequest so the engine can garbage collect it.
httpRequest.onreadystatechange = null;
callback(error, response, optionalCallbackParameter);
}
};

View file

@ -355,7 +355,7 @@ CameraManager = function() {
return;
}
if (event.isRightButton || (event.isLeftButton && event.isControl && !event.isShifted)) {
if (event.isRightButton || (event.isLeftButton && event.isAlt && !event.isShifted)) {
that.mode = MODE_ORBIT;
} else if (event.isMiddleButton || (event.isLeftButton && event.isControl && event.isShifted)) {
that.mode = MODE_PAN;