Merge branch 'master' of github.com:highfidelity/hifi into tablet-imporvments

This commit is contained in:
Dante Ruiz 2018-06-12 10:21:12 -07:00
commit f1d11f9566
8 changed files with 72 additions and 163 deletions

View file

@ -624,8 +624,8 @@ AudioMixerClientData::IgnoreZone& AudioMixerClientData::IgnoreZoneMemo::get(unsi
scale = MIN_IGNORE_BOX_SCALE;
}
// quadruple the scale (this is arbitrary number chosen for comfort)
const float IGNORE_BOX_SCALE_FACTOR = 4.0f;
// (this is arbitrary number determined empirically for comfort)
const float IGNORE_BOX_SCALE_FACTOR = 2.4f;
scale *= IGNORE_BOX_SCALE_FACTOR;
// create the box (we use a box for the zone for convenience)

View file

@ -271,8 +271,9 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
if (glm::any(glm::lessThan(otherNodeBoxScale, minBubbleSize))) {
otherNodeBox.setScaleStayCentered(minBubbleSize);
}
// Quadruple the scale of both bounding boxes
otherNodeBox.embiggen(4.0f);
// Change the scale of both bounding boxes
// (This is an arbitrary number determined empirically)
otherNodeBox.embiggen(2.4f);
// Perform the collision check between the two bounding boxes
if (nodeBox.touches(otherNodeBox)) {

View file

@ -2607,10 +2607,55 @@ void Application::initializeGL() {
_isGLInitialized = true;
}
_glWidget->makeCurrent();
glClearColor(0.2f, 0.2f, 0.2f, 1);
glClear(GL_COLOR_BUFFER_BIT);
_glWidget->swapBuffers();
if (!_glWidget->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make window context current");
}
#if !defined(DISABLE_QML)
// Build a shared canvas / context for the Chromium processes
{
// Disable signed distance field font rendering on ATI/AMD GPUs, due to
// https://highfidelity.manuscript.com/f/cases/13677/Text-showing-up-white-on-Marketplace-app
std::string vendor{ (const char*)glGetString(GL_VENDOR) };
if ((vendor.find("AMD") != std::string::npos) || (vendor.find("ATI") != std::string::npos)) {
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", QByteArray("--disable-distance-field-text"));
}
// Chromium rendering uses some GL functions that prevent nSight from capturing
// frames, so we only create the shared context if nsight is NOT active.
if (!nsightActive()) {
_chromiumShareContext = new OffscreenGLCanvas();
_chromiumShareContext->setObjectName("ChromiumShareContext");
_chromiumShareContext->create(_glWidget->qglContext());
if (!_chromiumShareContext->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make chromium shared context current");
}
qt_gl_set_global_share_context(_chromiumShareContext->getContext());
_chromiumShareContext->doneCurrent();
// Restore the GL widget context
if (!_glWidget->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make window context current");
}
} else {
qCWarning(interfaceapp) << "nSight detected, disabling chrome rendering";
}
}
#endif
// Build a shared canvas / context for the QML rendering
{
_qmlShareContext = new OffscreenGLCanvas();
_qmlShareContext->setObjectName("QmlShareContext");
_qmlShareContext->create(_glWidget->qglContext());
if (!_qmlShareContext->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make QML shared context current");
}
OffscreenQmlSurface::setSharedContext(_qmlShareContext->getContext());
_qmlShareContext->doneCurrent();
if (!_glWidget->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make window context current");
}
}
// Build an offscreen GL context for the main thread.
_offscreenContext = new OffscreenGLCanvas();
@ -2622,6 +2667,11 @@ void Application::initializeGL() {
_offscreenContext->doneCurrent();
_offscreenContext->setThreadContext();
_glWidget->makeCurrent();
glClearColor(0.2f, 0.2f, 0.2f, 1);
glClear(GL_COLOR_BUFFER_BIT);
_glWidget->swapBuffers();
// Move the GL widget context to the render event handler thread
_renderEventHandler = new RenderEventHandler(_glWidget->qglContext());
if (!_offscreenContext->makeCurrent()) {
@ -2744,40 +2794,6 @@ extern void setupPreferences();
static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);
void Application::initializeUi() {
// Build a shared canvas / context for the Chromium processes
#if !defined(DISABLE_QML)
// Chromium rendering uses some GL functions that prevent nSight from capturing
// frames, so we only create the shared context if nsight is NOT active.
if (!nsightActive()) {
_chromiumShareContext = new OffscreenGLCanvas();
_chromiumShareContext->setObjectName("ChromiumShareContext");
_chromiumShareContext->create(_offscreenContext->getContext());
if (!_chromiumShareContext->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make chromium shared context current");
}
qt_gl_set_global_share_context(_chromiumShareContext->getContext());
_chromiumShareContext->doneCurrent();
// Restore the GL widget context
_offscreenContext->makeCurrent();
} else {
qCWarning(interfaceapp) << "nSIGHT detected, disabling chrome rendering";
}
#endif
// Build a shared canvas / context for the QML rendering
_qmlShareContext = new OffscreenGLCanvas();
_qmlShareContext->setObjectName("QmlShareContext");
_qmlShareContext->create(_offscreenContext->getContext());
if (!_qmlShareContext->makeCurrent()) {
qCWarning(interfaceapp, "Unable to make QML shared context current");
}
OffscreenQmlSurface::setSharedContext(_qmlShareContext->getContext());
_qmlShareContext->doneCurrent();
// Restore the GL widget context
_offscreenContext->makeCurrent();
// Make sure all QML surfaces share the main thread GL context
OffscreenQmlSurface::setSharedContext(_offscreenContext->getContext());
AddressBarDialog::registerType();
ErrorDialog::registerType();
LoginDialog::registerType();

View file

@ -131,6 +131,9 @@ void ModelOverlay::update(float deltatime) {
if (!_texturesLoaded && _model->getGeometry() && _model->getGeometry()->areTexturesLoaded()) {
_texturesLoaded = true;
if (!_modelTextures.isEmpty()) {
_model->setTextures(_modelTextures);
}
_model->updateRenderItems();
}
}
@ -229,8 +232,7 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
if (texturesValue.isValid() && texturesValue.canConvert(QVariant::Map)) {
_texturesLoaded = false;
QVariantMap textureMap = texturesValue.toMap();
QMetaObject::invokeMethod(_model.get(), "setTextures", Qt::AutoConnection,
Q_ARG(const QVariantMap&, textureMap));
_modelTextures = textureMap;
}
auto groupCulledValue = properties["isGroupCulled"];

View file

@ -1074,15 +1074,11 @@ int Model::getLastFreeJointIndex(int jointIndex) const {
void Model::setTextures(const QVariantMap& textures) {
if (isLoaded()) {
_needsUpdateTextures = true;
_pendingTextures.clear();
_needsFixupInScene = true;
_renderGeometry->setTextures(textures);
} else {
// FIXME(Huffman): Disconnect previously connected lambdas so we don't set textures multiple
// after the geometry has finished loading.
connect(&_renderWatcher, &GeometryResourceWatcher::finished, this, [this, textures]() {
_renderGeometry->setTextures(textures);
});
_pendingTextures = textures;
}
}
@ -1106,7 +1102,8 @@ void Model::setURL(const QUrl& url) {
}
_needsReload = true;
_needsUpdateTextures = true;
// One might be tempted to _pendingTextures.clear(), thinking that a new URL means an old texture doesn't apply.
// But sometimes, particularly when first setting the values, the texture might be set first. So let's not clear here.
_visualGeometryRequestFailed = false;
_needsFixupInScene = true;
invalidCalculatedMeshBoxes();
@ -1123,6 +1120,8 @@ void Model::setURL(const QUrl& url) {
void Model::loadURLFinished(bool success) {
if (!success) {
_visualGeometryRequestFailed = true;
} else if (!_pendingTextures.empty()) {
setTextures(_pendingTextures);
}
emit setURLFinished(success);
}

View file

@ -457,7 +457,7 @@ protected:
bool _needsFixupInScene { true }; // needs to be removed/re-added to scene
bool _needsReload { true };
bool _needsUpdateClusterMatrices { true };
mutable bool _needsUpdateTextures { true };
QVariantMap _pendingTextures { };
friend class ModelMeshPartPayload;
Rig _rig;

View file

@ -40,7 +40,6 @@ var HOVER_TEXTURES = {
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6};
var SELECTED_COLOR = {red: 0xF3, green: 0x91, blue: 0x29};
var HOVER_COLOR = {red: 0xD0, green: 0xD0, blue: 0xD0}; // almost white for now
var conserveResources = true;
Script.include("/~/system/libraries/controllers.js");
@ -431,7 +430,7 @@ function addAvatarNode(id) {
alpha: 0.8,
color: color(selected, false, 0.0),
ignoreRayIntersection: false
}, selected, !conserveResources);
}, selected, true);
}
// Each open/refresh will capture a stable set of avatarsOfInterest, within the specified filter.
var avatarsOfInterest = {};
@ -496,7 +495,6 @@ function populateNearbyUserList(selectData, oldAudioData) {
print('PAL data:', JSON.stringify(avatarPalDatum));
});
getConnectionData(false, location.domainID); // Even admins don't get relationship data in requestUsernameFromID (which is still needed for admin status, which comes from domain).
conserveResources = Object.keys(avatarsOfInterest).length > 20;
sendToQml({ method: 'nearbyUsers', params: data });
if (selectData) {
selectData[2] = true;
@ -719,7 +717,7 @@ function onTabletScreenChanged(type, url) {
ContextOverlay.enabled = false;
Users.requestsDomainListData = true;
audioTimer = createAudioInterval(conserveResources ? AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS : AUDIO_LEVEL_UPDATE_INTERVAL_MS);
audioTimer = createAudioInterval(AUDIO_LEVEL_UPDATE_INTERVAL_MS);
tablet.tabletShownChanged.connect(tabletVisibilityChanged);
Script.update.connect(updateOverlays);
@ -874,7 +872,6 @@ startup();
var isWired = false;
var audioTimer;
var AUDIO_LEVEL_UPDATE_INTERVAL_MS = 100; // 10hz for now (change this and change the AVERAGING_RATIO too)
var AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS = 300;
function off() {
if (isWired) {
Script.update.disconnect(updateOverlays);

View file

@ -449,13 +449,6 @@ var labels = {
logWindow.open();
}
},
restoreBackup: {
label: 'Restore Backup Instructions',
click: function() {
var folder = getRootHifiDataDirectory() + "/Server Backup";
openBackupInstructions(folder);
}
},
share: {
label: 'Share',
click: function() {
@ -491,7 +484,6 @@ function buildMenuArray(serverState) {
menuArray.push(labels.stopServer);
menuArray.push(labels.settings);
menuArray.push(labels.viewLogs);
menuArray.push(labels.restoreBackup);
menuArray.push(separator);
menuArray.push(labels.share);
menuArray.push(separator);
@ -558,103 +550,6 @@ function backupResourceDirectories(folder) {
}
}
function openBackupInstructions(folder) {
// Explain user how to restore server
var window = new BrowserWindow({
icon: appIcon,
width: 800,
height: 520,
});
window.loadURL('file://' + __dirname + '/content-update.html');
if (!debug) {
window.setMenu(null);
}
window.show();
electron.ipcMain.on('setSize', function(event, obj) {
window.setSize(obj.width, obj.height);
});
electron.ipcMain.on('ready', function() {
log.debug("got ready");
window.webContents.send('update', folder);
});
}
function backupResourceDirectoriesAndRestart() {
homeServer.stop();
var folder = getRootHifiDataDirectory() + "/Server Backup - " + Date.now();
if (backupResourceDirectories(folder)) {
maybeInstallDefaultContentSet(onContentLoaded);
openBackupInstructions(folder);
} else {
dialog.showMessageBox({
type: 'warning',
buttons: ['Ok'],
title: 'Update Error',
message: 'There was an error updating the content, aborting.'
}, function() {});
}
}
function checkNewContent() {
if (argv.noUpdater) {
return;
}
// Start downloading content set
var req = request.head({
url: HOME_CONTENT_URL
}, function (error, response, body) {
if (error === null) {
var localContent = Date.parse(userConfig.get('homeContentLastModified'));
var remoteContent = Date.parse(response.headers['last-modified']);
var shouldUpdate = isNaN(localContent) || (!isNaN(remoteContent) && (remoteContent > localContent));
var wantDebug = false;
if (wantDebug) {
log.debug('Last Modified: ' + response.headers['last-modified']);
log.debug(localContent + " " + remoteContent + " " + shouldUpdate + " " + new Date());
log.debug("Remote content is " + (shouldUpdate ? "newer" : "older") + " that local content.");
}
if (shouldUpdate) {
dialog.showMessageBox({
type: 'question',
buttons: ['Yes', 'No'],
defaultId: 1,
cancelId: 1,
title: 'High Fidelity Sandbox',
message: 'A newer version of the home content set is available.\nDo you wish to update?',
noLink: true,
}, function(idx) {
if (idx === 0) {
dialog.showMessageBox({
type: 'warning',
buttons: ['Yes', 'No'],
defaultId: 1,
cancelId: 1,
title: 'Are you sure?',
message: 'Updating with the new content will remove all your current content and settings and place them in a backup folder.\nAre you sure?',
noLink: true,
}, function(idx) {
if (idx === 0) {
backupResourceDirectoriesAndRestart();
}
});
} else {
// They don't want to update, mark content set as current
userConfig.set('homeContentLastModified', new Date());
userConfig.save(configPath);
}
});
} else if (fs.existsSync(UPDATER_LOCK_FULL_PATH)) {
backupResourceDirectoriesAndRestart();
}
}
});
}
function removeIncompleteUpdate(acResourceDirectory, dsResourceDirectory) {
if (fs.existsSync(UPDATER_LOCK_FULL_PATH)) {
log.debug('Removing incomplete content update files before copying new update');
@ -697,7 +592,6 @@ function maybeInstallDefaultContentSet(onComplete) {
log.debug("User has existing data, suppressing downloader");
onComplete();
checkNewContent();
return;
}