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 isVisible = false;
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 MAX_LEFT_MARGIN = 1.9;
var INNER_CIRCLE_WIDTH = 4.7;
@ -63,9 +63,9 @@
var loadingSphereID = Overlays.addOverlay("model", {
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})),
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",
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),
url: Script.resolvePath("/~/system/assets/models/black-sphere.fbx"),
dimensions: DEFAULT_DIMENSIONS,
alpha: 1,
visible: isVisible,
@ -76,12 +76,12 @@
});
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,
grabbable: false,
ignoreRayIntersection: true,
localPosition: {x: 0.0, y: getAnchorLocalYOffset(), z: DEFAULT_Z_OFFSET },
orientation: Quat.multiply(Quat.fromVec3Degrees({x: 0, y: 180, z: 0}), MyAvatar.orientation),
localPosition: { x: 0.0, y: getAnchorLocalYOffset(), z: DEFAULT_Z_OFFSET },
orientation: Quat.multiply(Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), MyAvatar.orientation),
solid: true,
drawInFront: true,
parentID: loadingSphereID
@ -113,7 +113,6 @@
backgroundAlpha: 1,
lineHeight: 0.13,
visible: isVisible,
backgroundAlpha: 0,
ignoreRayIntersection: true,
drawInFront: true,
grabbable: false,
@ -125,7 +124,7 @@
var domainToolTip = Overlays.addOverlay("text3d", {
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,
textAlpha: 1,
backgroundAlpha: 0.00393,
@ -140,14 +139,14 @@
var loadingToTheSpotText = Overlays.addOverlay("text3d", {
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",
textAlpha: 1,
backgroundAlpha: 0.00393,
lineHeight: 0.10,
visible: isVisible,
ignoreRayIntersection: true,
dimensions: {x: 1, y: 0.17},
dimensions: { x: 1, y: 0.17 },
drawInFront: true,
grabbable: false,
localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }),
@ -156,7 +155,7 @@
var loadingToTheSpotID = Overlays.addOverlay("image3d", {
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",
alpha: 1,
visible: isVisible,
@ -170,7 +169,7 @@
var loadingToTheSpotHoverID = Overlays.addOverlay("image3d", {
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",
alpha: 1,
visible: false,
@ -187,7 +186,7 @@
localPosition: { x: 0.0, y: -0.99, z: 0.3 },
url: Script.resourcesPath() + "images/loadingBar_placard.png",
alpha: 1,
dimensions: { x: 4, y: 2.8},
dimensions: { x: 4, y: 2.8 },
visible: isVisible,
emissive: true,
ignoreRayIntersection: false,
@ -202,7 +201,7 @@
localPosition: { x: 0.0, y: -0.90, z: 0.0 },
url: Script.resourcesPath() + "images/loadingBar_progress.png",
alpha: 1,
dimensions: {x: 3.8, y: 2.8},
dimensions: { x: 3.8, y: 2.8 },
visible: isVisible,
emissive: true,
ignoreRayIntersection: false,
@ -245,7 +244,7 @@
}
function resetValues() {
var properties = {
var properties = {
localPosition: { x: 1.85, y: -0.935, z: 0.0 },
dimensions: {
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) {
if (loadingToTheSpotHoverID === overlayID) {
location.handleLookupString(THE_PLACE);
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false});
Overlays.editOverlay(loadingToTheSpotID, {visible: true});
Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
Overlays.editOverlay(loadingToTheSpotID, { visible: true });
}
}
@ -362,8 +361,8 @@
return;
}
if (overlayID === loadingToTheSpotID) {
Overlays.editOverlay(loadingToTheSpotID, {visible: false});
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true});
Overlays.editOverlay(loadingToTheSpotID, { visible: false });
Overlays.editOverlay(loadingToTheSpotHoverID, { visible: true });
}
}
@ -372,8 +371,8 @@
return;
}
if (overlayID === loadingToTheSpotHoverID) {
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false});
Overlays.editOverlay(loadingToTheSpotID, {visible: true});
Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
Overlays.editOverlay(loadingToTheSpotID, { visible: true });
}
}
@ -453,7 +452,7 @@
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
@ -515,7 +514,7 @@
if (errorConnectingToDomain) {
updateOverlays(errorConnectingToDomain);
// setting hover id to invisible
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false});
Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
endAudio();
currentDomain = "no domain";
timer = null;
@ -531,7 +530,7 @@
} else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) {
updateOverlays((physicsEnabled || connectionToDomainFailed));
// setting hover id to invisible
Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false});
Overlays.editOverlay(loadingToTheSpotHoverID, { visible: false });
endAudio();
currentDomain = "no domain";
timer = null;
@ -539,8 +538,8 @@
}
timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS);
}
var whiteColor = {red: 255, green: 255, blue: 255};
var greyColor = {red: 125, green: 125, blue: 125};
var whiteColor = { red: 255, green: 255, blue: 255 };
var greyColor = { red: 125, green: 125, blue: 125 };
Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay);
Overlays.hoverEnterOverlay.connect(onEnterOverlay);