mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 04:37:23 +02:00
improving interstitial loading bar
This commit is contained in:
parent
2dc761a57a
commit
0279eef3a4
1 changed files with 43 additions and 40 deletions
|
@ -17,7 +17,8 @@
|
||||||
Script.include("/~/system/libraries/globals.js");
|
Script.include("/~/system/libraries/globals.js");
|
||||||
var DEBUG = false;
|
var DEBUG = false;
|
||||||
var MIN_LOADING_PROGRESS = 3.6;
|
var MIN_LOADING_PROGRESS = 3.6;
|
||||||
var TOTAL_LOADING_PROGRESS = 3.8;
|
var TOTAL_LOADING_PROGRESS = 3.7;
|
||||||
|
var FINAL_Y_DIMENSIONS = 2.8;
|
||||||
var EPSILON = 0.05;
|
var EPSILON = 0.05;
|
||||||
var TEXTURE_EPSILON = 0.01;
|
var TEXTURE_EPSILON = 0.01;
|
||||||
var isVisible = false;
|
var isVisible = false;
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
var MAX_LEFT_MARGIN = 1.9;
|
var MAX_LEFT_MARGIN = 1.9;
|
||||||
var INNER_CIRCLE_WIDTH = 4.7;
|
var INNER_CIRCLE_WIDTH = 4.7;
|
||||||
var DEFAULT_Z_OFFSET = 5.45;
|
var DEFAULT_Z_OFFSET = 5.45;
|
||||||
|
var LOADING_IMAGE_WIDTH_PIXELS = 1024;
|
||||||
var previousCameraMode = Camera.mode;
|
var previousCameraMode = Camera.mode;
|
||||||
|
|
||||||
var renderViewTask = Render.getConfig("RenderMainView");
|
var renderViewTask = Render.getConfig("RenderMainView");
|
||||||
|
@ -182,12 +184,13 @@
|
||||||
parentID: anchorOverlay
|
parentID: anchorOverlay
|
||||||
});
|
});
|
||||||
|
|
||||||
var loadingBarPlacard = Overlays.addOverlay("image3d", {
|
|
||||||
name: "Loading-Bar-Placard",
|
var loadingBarProgress = Overlays.addOverlay("image3d", {
|
||||||
localPosition: { x: 0.0, y: -0.99, z: 0.3 },
|
name: "Loading-Bar-Progress",
|
||||||
url: Script.resourcesPath() + "images/loadingBar_placard.png",
|
localPosition: { x: 0.0, y: -0.86, z: 0.0 },
|
||||||
|
url: Script.resourcesPath() + "images/loadingBar_progress.png",
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
dimensions: { x: 4, y: 2.8 },
|
dimensions: { x: 3.8, y: 2.8 },
|
||||||
visible: isVisible,
|
visible: isVisible,
|
||||||
emissive: true,
|
emissive: true,
|
||||||
ignoreRayIntersection: false,
|
ignoreRayIntersection: false,
|
||||||
|
@ -197,12 +200,12 @@
|
||||||
parentID: anchorOverlay
|
parentID: anchorOverlay
|
||||||
});
|
});
|
||||||
|
|
||||||
var loadingBarProgress = Overlays.addOverlay("image3d", {
|
var loadingBarPlacard = Overlays.addOverlay("image3d", {
|
||||||
name: "Loading-Bar-Progress",
|
name: "Loading-Bar-Placard",
|
||||||
localPosition: { x: 0.0, y: -0.90, z: 0.0 },
|
localPosition: { x: 0.0, y: -0.99, z: 0.4 },
|
||||||
url: Script.resourcesPath() + "images/loadingBar_progress.png",
|
url: Script.resourcesPath() + "images/loadingBar_placard.png",
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
dimensions: { x: 3.8, y: 2.8 },
|
dimensions: { x: 4, y: 2.8 },
|
||||||
visible: isVisible,
|
visible: isVisible,
|
||||||
emissive: true,
|
emissive: true,
|
||||||
ignoreRayIntersection: false,
|
ignoreRayIntersection: false,
|
||||||
|
@ -245,15 +248,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetValues() {
|
function resetValues() {
|
||||||
var properties = {
|
updateProgressBar(0.0);
|
||||||
localPosition: { x: 1.85, y: -0.935, z: 0.0 },
|
|
||||||
dimensions: {
|
|
||||||
x: 0.1,
|
|
||||||
y: 2.8
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Overlays.editOverlay(loadingBarProgress, properties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startInterstitialPage() {
|
function startInterstitialPage() {
|
||||||
|
@ -400,7 +395,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadingBarProperties = {
|
var loadingBarProperties = {
|
||||||
dimensions: { x: 0.0, y: 2.8 },
|
dimensions: { x: 2.0, y: 2.8 },
|
||||||
visible: !physicsEnabled
|
visible: !physicsEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -459,6 +454,27 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateProgressBar(progress) {
|
||||||
|
var progressPercentage = progress / TOTAL_LOADING_PROGRESS;
|
||||||
|
var subImageWidth = progressPercentage * LOADING_IMAGE_WIDTH_PIXELS;
|
||||||
|
|
||||||
|
var properties = {
|
||||||
|
localPosition: { x: (TOTAL_LOADING_PROGRESS / 2) - (currentProgress / 2), y: -0.86, z: 0.0 },
|
||||||
|
dimensions: {
|
||||||
|
x: currentProgress,
|
||||||
|
y: FINAL_Y_DIMENSIONS * (subImageWidth / LOADING_IMAGE_WIDTH_PIXELS)
|
||||||
|
},
|
||||||
|
subImage: {
|
||||||
|
x: 0.0,
|
||||||
|
y: 0.0,
|
||||||
|
width: subImageWidth,
|
||||||
|
height: 90
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Overlays.editOverlay(loadingBarProgress, properties);
|
||||||
|
}
|
||||||
|
|
||||||
var MAX_TEXTURE_STABILITY_COUNT = 30;
|
var MAX_TEXTURE_STABILITY_COUNT = 30;
|
||||||
var INTERVAL_PROGRESS = 0.04;
|
var INTERVAL_PROGRESS = 0.04;
|
||||||
function update() {
|
function update() {
|
||||||
|
@ -503,15 +519,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
currentProgress = lerp(currentProgress, target, INTERVAL_PROGRESS);
|
currentProgress = lerp(currentProgress, target, INTERVAL_PROGRESS);
|
||||||
var properties = {
|
|
||||||
localPosition: { x: (1.85 - (currentProgress / 2) - (-0.029 * (currentProgress / TOTAL_LOADING_PROGRESS))), y: -0.935, z: 0.0 },
|
|
||||||
dimensions: {
|
|
||||||
x: currentProgress,
|
|
||||||
y: 2.8
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Overlays.editOverlay(loadingBarProgress, properties);
|
updateProgressBar(currentProgress);
|
||||||
|
|
||||||
if (errorConnectingToDomain) {
|
if (errorConnectingToDomain) {
|
||||||
updateOverlays(errorConnectingToDomain);
|
updateOverlays(errorConnectingToDomain);
|
||||||
|
@ -542,17 +551,11 @@
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
|
||||||
Overlays.hoverLeaveOverlay.connect(onLeaveOverlay);
|
Overlays.hoverLeaveOverlay.connect(onLeaveOverlay);
|
||||||
|
|
||||||
location.hostChanged.connect(domainChanged);
|
location.hostChanged.connect(domainChanged);
|
||||||
location.lookupResultsFinished.connect(function() {
|
|
||||||
Script.setTimeout(function() {
|
|
||||||
connectionToDomainFailed = !location.isConnected;
|
|
||||||
}, 1200);
|
|
||||||
});
|
|
||||||
Window.redirectErrorStateChanged.connect(toggleInterstitialPage);
|
Window.redirectErrorStateChanged.connect(toggleInterstitialPage);
|
||||||
|
|
||||||
MyAvatar.sensorToWorldScaleChanged.connect(scaleInterstitialPage);
|
MyAvatar.sensorToWorldScaleChanged.connect(scaleInterstitialPage);
|
||||||
|
|
Loading…
Reference in a new issue