Merge branch 'fix/loadingscreen-optimization' of https://github.com/FlameSoulis/hifi into mergedInterstitialBugFixes

This commit is contained in:
Wayne Chen 2018-10-22 10:05:55 -07:00
commit 27813d4948
3 changed files with 27 additions and 28 deletions

Binary file not shown.

Binary file not shown.

View file

@ -21,7 +21,7 @@
var EPSILON = 0.01; var EPSILON = 0.01;
var isVisible = false; var isVisible = false;
var VOLUME = 0.4; var VOLUME = 0.4;
var tune = SoundCache.getSound("http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/crystals_and_voices.wav"); var tune = SoundCache.getSound(Script.resolvePath("/~/system/assets/sounds/crystals_and_voices.mp3"));
var sample = null; var sample = null;
var MAX_LEFT_MARGIN = 1.9; var MAX_LEFT_MARGIN = 1.9;
var INNER_CIRCLE_WIDTH = 4.7; var INNER_CIRCLE_WIDTH = 4.7;
@ -63,9 +63,9 @@
var loadingSphereID = Overlays.addOverlay("model", { var loadingSphereID = Overlays.addOverlay("model", {
name: "Loading-Sphere", name: "Loading-Sphere",
position: Vec3.sum(Vec3.sum(MyAvatar.position, {x: 0.0, y: -1.0, z: 0.0}), Vec3.multiplyQbyV(MyAvatar.orientation, {x: 0, y: 0.95, z: 0})), position: Vec3.sum(Vec3.sum(MyAvatar.position, { x: 0.0, y: -1.0, z: 0.0 }), Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.95, z: 0 })),
orientation: Quat.multiply(Quat.fromVec3Degrees({x: 0, y: 180, z: 0}), MyAvatar.orientation), orientation: Quat.multiply(Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), MyAvatar.orientation),
url: "http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/black-sphere.fbx", url: Script.resolvePath("/~/system/assets/models/black-sphere.fbx"),
dimensions: DEFAULT_DIMENSIONS, dimensions: DEFAULT_DIMENSIONS,
alpha: 1, alpha: 1,
visible: isVisible, visible: isVisible,
@ -76,12 +76,12 @@
}); });
var anchorOverlay = Overlays.addOverlay("cube", { var anchorOverlay = Overlays.addOverlay("cube", {
dimensions: {x: 0.2, y: 0.2, z: 0.2}, dimensions: { x: 0.2, y: 0.2, z: 0.2 },
visible: false, visible: false,
grabbable: false, grabbable: false,
ignoreRayIntersection: true, ignoreRayIntersection: true,
localPosition: {x: 0.0, y: getAnchorLocalYOffset(), z: DEFAULT_Z_OFFSET }, localPosition: { x: 0.0, y: getAnchorLocalYOffset(), z: DEFAULT_Z_OFFSET },
orientation: Quat.multiply(Quat.fromVec3Degrees({x: 0, y: 180, z: 0}), MyAvatar.orientation), orientation: Quat.multiply(Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), MyAvatar.orientation),
solid: true, solid: true,
drawInFront: true, drawInFront: true,
parentID: loadingSphereID parentID: loadingSphereID
@ -113,7 +113,6 @@
backgroundAlpha: 1, backgroundAlpha: 1,
lineHeight: 0.13, lineHeight: 0.13,
visible: isVisible, visible: isVisible,
backgroundAlpha: 0,
ignoreRayIntersection: true, ignoreRayIntersection: true,
drawInFront: true, drawInFront: true,
grabbable: false, grabbable: false,
@ -125,7 +124,7 @@
var domainToolTip = Overlays.addOverlay("text3d", { var domainToolTip = Overlays.addOverlay("text3d", {
name: "Loading-Tooltip", name: "Loading-Tooltip",
localPosition: { x: 0.0 , y: -1.6, z: 0.0 }, localPosition: { x: 0.0, y: -1.6, z: 0.0 },
text: toolTip, text: toolTip,
textAlpha: 1, textAlpha: 1,
backgroundAlpha: 0.00393, backgroundAlpha: 0.00393,
@ -140,14 +139,14 @@
var loadingToTheSpotText = Overlays.addOverlay("text3d", { var loadingToTheSpotText = Overlays.addOverlay("text3d", {
name: "Loading-Destination-Card-Text", name: "Loading-Destination-Card-Text",
localPosition: { x: 0.0 , y: -1.687, z: -0.3 }, localPosition: { x: 0.0, y: -1.687, z: -0.3 },
text: "Go To TheSpot", text: "Go To TheSpot",
textAlpha: 1, textAlpha: 1,
backgroundAlpha: 0.00393, backgroundAlpha: 0.00393,
lineHeight: 0.10, lineHeight: 0.10,
visible: isVisible, visible: isVisible,
ignoreRayIntersection: true, ignoreRayIntersection: true,
dimensions: {x: 1, y: 0.17}, dimensions: { x: 1, y: 0.17 },
drawInFront: true, drawInFront: true,
grabbable: false, grabbable: false,
localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }),
@ -156,7 +155,7 @@
var loadingToTheSpotID = Overlays.addOverlay("image3d", { var loadingToTheSpotID = Overlays.addOverlay("image3d", {
name: "Loading-Destination-Card-GoTo-Image", name: "Loading-Destination-Card-GoTo-Image",
localPosition: { x: 0.0 , y: -1.75, z: -0.3 }, localPosition: { x: 0.0, y: -1.75, z: -0.3 },
url: Script.resourcesPath() + "images/interstitialPage/button.png", url: Script.resourcesPath() + "images/interstitialPage/button.png",
alpha: 1, alpha: 1,
visible: isVisible, visible: isVisible,
@ -170,7 +169,7 @@
var loadingToTheSpotHoverID = Overlays.addOverlay("image3d", { var loadingToTheSpotHoverID = Overlays.addOverlay("image3d", {
name: "Loading-Destination-Card-GoTo-Image-Hover", name: "Loading-Destination-Card-GoTo-Image-Hover",
localPosition: { x: 0.0 , y: -1.75, z: -0.3 }, localPosition: { x: 0.0, y: -1.75, z: -0.3 },
url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", url: Script.resourcesPath() + "images/interstitialPage/button_hover.png",
alpha: 1, alpha: 1,
visible: false, visible: false,
@ -187,7 +186,7 @@
localPosition: { x: 0.0, y: -0.99, z: 0.3 }, localPosition: { x: 0.0, y: -0.99, z: 0.3 },
url: Script.resourcesPath() + "images/loadingBar_placard.png", url: Script.resourcesPath() + "images/loadingBar_placard.png",
alpha: 1, alpha: 1,
dimensions: { x: 4, y: 2.8}, dimensions: { x: 4, y: 2.8 },
visible: isVisible, visible: isVisible,
emissive: true, emissive: true,
ignoreRayIntersection: false, ignoreRayIntersection: false,
@ -202,7 +201,7 @@
localPosition: { x: 0.0, y: -0.90, z: 0.0 }, localPosition: { x: 0.0, y: -0.90, z: 0.0 },
url: Script.resourcesPath() + "images/loadingBar_progress.png", url: Script.resourcesPath() + "images/loadingBar_progress.png",
alpha: 1, alpha: 1,
dimensions: {x: 3.8, y: 2.8}, dimensions: { x: 3.8, y: 2.8 },
visible: isVisible, visible: isVisible,
emissive: true, emissive: true,
ignoreRayIntersection: false, ignoreRayIntersection: false,
@ -245,7 +244,7 @@
} }
function resetValues() { function resetValues() {
var properties = { var properties = {
localPosition: { x: 1.85, y: -0.935, z: 0.0 }, localPosition: { x: 1.85, y: -0.935, z: 0.0 },
dimensions: { dimensions: {
x: 0.1, x: 0.1,
@ -348,12 +347,12 @@
} }
} }
var THE_PLACE = (HifiAbout.buildVersion === "dev") ? "hifi://TheSpot-dev": "hifi://TheSpot"; var THE_PLACE = (HifiAbout.buildVersion === "dev") ? "hifi://TheSpot-dev" : "hifi://TheSpot";
function clickedOnOverlay(overlayID, event) { function clickedOnOverlay(overlayID, event) {
if (loadingToTheSpotHoverID === overlayID) { if (loadingToTheSpotHoverID === overlayID) {
location.handleLookupString(THE_PLACE); location.handleLookupString(THE_PLACE);
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
Overlays.editOverlay(loadingToTheSpotID, {visible: true}); Overlays.editOverlay(loadingToTheSpotID, { visible: true });
} }
} }
@ -362,8 +361,8 @@
return; return;
} }
if (overlayID === loadingToTheSpotID) { if (overlayID === loadingToTheSpotID) {
Overlays.editOverlay(loadingToTheSpotID, {visible: false}); Overlays.editOverlay(loadingToTheSpotID, { visible: false });
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); Overlays.editOverlay(loadingToTheSpotHoverID, { visible: true });
} }
} }
@ -372,8 +371,8 @@
return; return;
} }
if (overlayID === loadingToTheSpotHoverID) { if (overlayID === loadingToTheSpotHoverID) {
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
Overlays.editOverlay(loadingToTheSpotID, {visible: true}); Overlays.editOverlay(loadingToTheSpotID, { visible: true });
} }
} }
@ -453,7 +452,7 @@
function sleep(milliseconds) { function sleep(milliseconds) {
var start = new Date().getTime(); var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) { for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){ if ((new Date().getTime() - start) > milliseconds) {
break; break;
} }
} }
@ -515,7 +514,7 @@
if (errorConnectingToDomain) { if (errorConnectingToDomain) {
updateOverlays(errorConnectingToDomain); updateOverlays(errorConnectingToDomain);
// setting hover id to invisible // setting hover id to invisible
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
endAudio(); endAudio();
currentDomain = "no domain"; currentDomain = "no domain";
timer = null; timer = null;
@ -531,7 +530,7 @@
} else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) {
updateOverlays((physicsEnabled || connectionToDomainFailed)); updateOverlays((physicsEnabled || connectionToDomainFailed));
// setting hover id to invisible // setting hover id to invisible
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
endAudio(); endAudio();
currentDomain = "no domain"; currentDomain = "no domain";
timer = null; timer = null;
@ -539,8 +538,8 @@
} }
timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS);
} }
var whiteColor = {red: 255, green: 255, blue: 255}; var whiteColor = { red: 255, green: 255, blue: 255 };
var greyColor = {red: 125, green: 125, blue: 125}; var greyColor = { red: 125, green: 125, blue: 125 };
Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay);
Overlays.hoverEnterOverlay.connect(onEnterOverlay); Overlays.hoverEnterOverlay.connect(onEnterOverlay);