Merge branch 'master' into 21055

Conflicts:
	libraries/entities-renderer/src/RenderableWebEntityItem.cpp
This commit is contained in:
David Rowe 2016-10-04 10:51:14 +13:00
commit caf1a93354
7 changed files with 240 additions and 49 deletions

View file

@ -2170,7 +2170,7 @@ bool Application::event(QEvent* event) {
// handle custom URL
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
QUrl url = fileEvent->url();
@ -4361,8 +4361,13 @@ namespace render {
auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage();
auto sceneKeyLight = scene->getKeyLight();
auto defaultSkyboxAmbientTexture = qApp->getDefaultSkyboxAmbientTexture();
sceneKeyLight->setAmbientSphere(defaultSkyboxAmbientTexture->getIrradiance());
sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture);
if (defaultSkyboxAmbientTexture) {
sceneKeyLight->setAmbientSphere(defaultSkyboxAmbientTexture->getIrradiance());
sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture);
} else {
static QString repeatedMessage = LogHandler::getInstance().addRepeatedMessageRegex(
"Failed to get a valid Default Skybox Ambient Texture ? probably because it couldn't be find during initialization step");
}
// fall through: render defaults skybox
} else {
break;

View file

@ -331,5 +331,7 @@ bool RenderableWebEntityItem::isTransparent() {
}
void RenderableWebEntityItem::emitScriptEvent(const QVariant& message) {
_webSurface->emitScriptEvent(message);
if (_webSurface) {
_webSurface->emitScriptEvent(message);
}
}

View file

@ -511,9 +511,7 @@ void GL45Texture::stripToMip(uint16_t newMinMip) {
_minMip = newMinMip;
// Re-sync the sampler to force access to the new mip level
syncSampler();
size_t oldSize = _size;
updateSize();
Q_ASSERT(_size > oldSize);
// Re-insert into the texture-by-mips map if appropriate

View file

@ -0,0 +1,201 @@
"use strict";
/*jslint vars: true, plusplus: true*/
/*globals Script, MyAvatar, Quat, Render, ScriptDiscoveryService, Window, LODManager, Entities, print*/
//
// loadedMachine.js
// scripts/developer/tests/
//
// Created by Howard Stearns on 6/6/16.
// Copyright 2016 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
//
// Confirms that the specified domain is operating within specified constraints.
var MINIMUM_DESKTOP_FRAMERATE = 57; // frames per second
var MINIMUM_HMD_FRAMERATE = 86;
var EXPECTED_DESKTOP_FRAMERATE = 60;
var EXPECTED_HMD_FRAMERATE = 90;
var MAXIMUM_LOAD_TIME = 60; // seconds
var MINIMUM_AVATARS = 25; // FIXME: not implemented yet. Requires agent scripts. Idea is to have them organize themselves to the right number.
var version = 1;
function debug() {
print.apply(null, [].concat.apply(['hrs fixme', version], [].map.call(arguments, JSON.stringify)));
}
var emptyishPlace = 'empty';
var cachePlaces = ['localhost', 'Welcome'];
var isInCachePlace = cachePlaces.indexOf(location.hostname) >= 0;
var defaultPlace = isInCachePlace ? 'Playa' : location.hostname;
var prompt = "domain-check.js version " + version + "\n\nWhat place should we enter?";
debug(cachePlaces, isInCachePlace, defaultPlace, prompt);
var entryPlace = Window.prompt(prompt, defaultPlace);
var fail = false, results = "";
function addResult(label, actual, minimum, maximum) {
if ((minimum !== undefined) && (actual < minimum)) {
fail = true;
}
if ((maximum !== undefined) && (actual > maximum)) {
fail = true;
}
results += "\n" + label + ": " + actual + " (" + ((100 * actual) / (maximum || minimum)).toFixed(0) + "%)";
}
function giveReport() {
Window.alert(entryPlace + (fail ? " FAILED" : " OK") + "\n" + results);
}
// Tests are performed domain-wide, at full LOD
var initialLodIsAutomatic = LODManager.getAutomaticLODAdjust();
var LOD = 32768 * 400;
LODManager.setAutomaticLODAdjust(false);
LODManager.setOctreeSizeScale(LOD);
Script.scriptEnding.connect(function () { LODManager.setAutomaticLODAdjust(initialLodIsAutomatic); });
function startTwirl(targetRotation, degreesPerUpdate, interval, strafeDistance, optionalCallback) {
var initialRotation = Quat.safeEulerAngles(MyAvatar.orientation).y;
var accumulatedRotation = 0;
function tick() {
MyAvatar.orientation = Quat.fromPitchYawRollDegrees(0, accumulatedRotation + initialRotation, 0);
if (strafeDistance) {
MyAvatar.position = Vec3.sum(MyAvatar.position, Vec3.multiply(strafeDistance, Quat.getRight(MyAvatar.orientation)));
}
accumulatedRotation += degreesPerUpdate;
if (accumulatedRotation >= targetRotation) {
return optionalCallback && optionalCallback();
}
Script.setTimeout(tick, interval);
}
tick();
}
function doLoad(place, continuationWithLoadTime) { // Go to place and call continuationWithLoadTime(loadTimeInSeconds)
var start = Date.now(), timeout, onDownloadUpdate, finishedTwirl = false, loadTime;
function clearHandlers() {
debug('clearHandlers');
Stats.downloadsPendingChanged.disconnect(onDownloadUpdate);
Stats.downloadsChanged.disconnect(onDownloadUpdate);
}
function waitForLoad(flag) {
debug('entry', place, 'initial downloads/pending', Stats.downloads, Stats.downloadsPending);
location.hostChanged.disconnect(waitForLoad);
timeout = Script.setTimeout(function () {
debug('downloads timeout', Date());
clearHandlers();
Window.alert("Timeout during " + place + " load. FAILED");
Script.stop();
}, MAXIMUM_LOAD_TIME * 1000);
startTwirl(360, 6, 90, null, function () {
finishedTwirl = true;
if (loadTime) {
continuationWithLoadTime(loadTime);
}
});
Stats.downloadsPendingChanged.connect(onDownloadUpdate);
Stats.downloadsChanged.connect(onDownloadUpdate);
}
function isLoading() {
// FIXME: This tells us when download are completed, but it doesn't tell us when the objects are parsed and loaded.
// We really want something like _physicsEnabled, but that isn't signalled.
return Stats.downloads || Stats.downloadsPending;
}
onDownloadUpdate = function onDownloadUpdate() {
debug('update downloads/pending', Stats.downloads, Stats.downloadsPending);
if (isLoading()) {
return;
}
Script.clearTimeout(timeout);
clearHandlers();
loadTime = (Date.now() - start) / 1000;
if (finishedTwirl) {
continuationWithLoadTime(loadTime);
}
};
function doit() {
debug('go', place);
location.hostChanged.connect(waitForLoad);
location.handleLookupString(place);
}
if (location.placename.toLowerCase() === place.toLowerCase()) {
location.handleLookupString(emptyishPlace);
Script.setTimeout(doit, 1000);
} else {
doit();
}
}
var config = Render.getConfig("Stats");
function doRender(continuation) {
var start = Date.now(), frames = 0;
function onNewStats() { // Accumulates frames on signal during load test
frames++;
}
config.newStats.connect(onNewStats);
startTwirl(720, 1, 15, 0.08, function () {
var end = Date.now();
config.newStats.disconnect(onNewStats);
addResult('frame rate', 1000 * frames / (end - start),
HMD.active ? MINIMUM_HMD_FRAMERATE : MINIMUM_DESKTOP_FRAMERATE,
HMD.active ? EXPECTED_HMD_FRAMERATE : EXPECTED_DESKTOP_FRAMERATE);
continuation();
});
}
function maybePrepareCache(continuation) {
var prepareCache = Window.confirm("Prepare cache?\n\n\
Should we start with all and only those items cached that are encountered when visiting:\n" + cachePlaces.join(', ') + "\n\
If 'yes', cache will be cleared and we will visit these two, with a turn in each, and wait for everything to be loaded.\n\
You would want to say 'no' (and make other preparations) if you were testing these places.");
if (prepareCache) {
location.handleLookupString(emptyishPlace);
Window.alert("Please do menu Edit->Reload Content (Clears all caches) and THEN press 'ok'.");
function loadNext() {
var place = cachePlaces.shift();
doLoad(place, function (prepTime) {
debug(place, 'ready', prepTime);
if (cachePlaces.length) {
loadNext();
} else {
continuation();
}
});
}
loadNext();
} else {
continuation();
}
}
function maybeRunTribbles(continuation) {
if (Window.confirm("Run tribbles?\n\n\
At most, only one participant should say yes.")) {
Script.load('http://howard-stearns.github.io/models/scripts/tests/performance/tribbles.js'); // FIXME: replace with AWS
Script.setTimeout(continuation, 3000);
} else {
continuation();
}
}
if (!entryPlace) {
Window.alert("domain-check.js cancelled");
Script.stop();
} else {
maybePrepareCache(function (prepTime) {
debug('cache ready', prepTime);
doLoad(entryPlace, function (loadTime) {
addResult("load time", loadTime, undefined, MAXIMUM_LOAD_TIME);
maybeRunTribbles(function () {
doRender(function () {
giveReport();
Script.stop();
});
});
});
});
}
Script.scriptEnding.connect(function () { print("domain-check completed"); });

View file

@ -17,11 +17,9 @@
// keystroke:
//
// CTRL/s for snapshot.
// CTRL/m for mic mute and unmute.
// System generated notifications:
// If Screen is resized.
// If mic is muted for any reason.
// Connection refused.
//
// To add a new System notification type:
//
@ -92,16 +90,12 @@ var lodTextID = false;
var NotificationType = {
UNKNOWN: 0,
MUTE_TOGGLE: 1,
SNAPSHOT: 2,
WINDOW_RESIZE: 3,
LOD_WARNING: 4,
CONNECTION_REFUSED: 5,
EDIT_ERROR: 6,
SNAPSHOT: 1,
LOD_WARNING: 2,
CONNECTION_REFUSED: 3,
EDIT_ERROR: 4,
properties: [
{ text: "Mute Toggle" },
{ text: "Snapshot" },
{ text: "Window Resize" },
{ text: "Level of Detail" },
{ text: "Connection Refused" },
{ text: "Edit error" }
@ -446,19 +440,6 @@ function wordWrap(str) {
return stringDivider(str, 43.0, "\n");
}
// This fires a notification on window resize
function checkSize() {
if ((Window.innerWidth !== ourWidth) || (Window.innerHeight !== ourHeight)) {
var windowResize = "Window has been resized";
ourWidth = Window.innerWidth;
ourHeight = Window.innerHeight;
windowDimensions = Controller.getViewportDimensions();
overlayLocationX = (windowDimensions.x - (width + 60.0));
buttonLocationX = overlayLocationX + (width - 35.0);
createNotification(windowResize, NotificationType.WINDOW_RESIZE);
}
}
function update() {
var nextOverlay,
noticeOut,
@ -480,7 +461,6 @@ function update() {
frame += 1;
if ((frame % 60.0) === 0) { // only update once a second
checkSize(); // checks for size change to trigger windowResize notification
locationY = 20.0;
for (i = 0; i < arrays.length; i += 1) { //repositions overlays as others fade
nextOverlay = Overlays.getOverlayAtPoint({ x: overlayLocationX, y: locationY });
@ -533,16 +513,6 @@ function isStartingUp() {
return startingUp;
}
// Triggers mic mute notification
function onMuteStateChanged() {
var muteState,
muteString;
muteState = AudioDevice.getMuted() ? "muted" : "unmuted";
muteString = "Microphone is now " + muteState;
createNotification(muteString, NotificationType.MUTE_TOGGLE);
}
function onDomainConnectionRefused(reason) {
createNotification("Connection refused: " + reason, NotificationType.CONNECTION_REFUSED);
}
@ -653,7 +623,6 @@ LODManager.LODDecreased.connect(function() {
}
});
AudioDevice.muteToggled.connect(onMuteStateChanged);
Controller.keyPressEvent.connect(keyPressEvent);
Controller.mousePressEvent.connect(mousePressEvent);
Controller.keyReleaseEvent.connect(keyReleaseEvent);

View file

@ -124,6 +124,7 @@ a:hover {
overflow: hidden;
float: left;
position: relative;
word-wrap: break-word;
}
.col2 {

View file

@ -574,15 +574,30 @@ function checkNewContent() {
dialog.showMessageBox({
type: 'question',
buttons: ['Yes', 'No'],
defaultId: 1,
cancelId: 1,
title: 'New home content',
message: 'A newer version of the home content set is available.\nDo you wish to update?'
message: 'A newer version of the home content set is available.\nDo you wish to update?',
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());
}
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());
}
});
}
}