mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
Merge branch 'interstitial-loading-imporvements' of https://github.com/danteruiz/hifi into mergedInterstitialBugFixes
This commit is contained in:
commit
4a8348e0d1
1 changed files with 13 additions and 8 deletions
|
@ -18,7 +18,8 @@
|
||||||
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.8;
|
||||||
var EPSILON = 0.01;
|
var EPSILON = 0.05;
|
||||||
|
var TEXTURE_EPSILON = 0.01;
|
||||||
var isVisible = false;
|
var isVisible = false;
|
||||||
var VOLUME = 0.4;
|
var VOLUME = 0.4;
|
||||||
var tune = SoundCache.getSound(Script.resolvePath("/~/system/assets/sounds/crystals_and_voices.mp3"));
|
var tune = SoundCache.getSound(Script.resolvePath("/~/system/assets/sounds/crystals_and_voices.mp3"));
|
||||||
|
@ -211,7 +212,7 @@
|
||||||
parentID: anchorOverlay
|
parentID: anchorOverlay
|
||||||
});
|
});
|
||||||
|
|
||||||
var TARGET_UPDATE_HZ = 60; // 50hz good enough, but we're using update
|
var TARGET_UPDATE_HZ = 30;
|
||||||
var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ;
|
var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ;
|
||||||
var lastInterval = Date.now();
|
var lastInterval = Date.now();
|
||||||
var currentDomain = "no domain";
|
var currentDomain = "no domain";
|
||||||
|
@ -240,7 +241,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function lerp(a, b, t) {
|
function lerp(a, b, t) {
|
||||||
return ((1 - t) * a + t * b);
|
return (((1 - t) * a) + (t * b));
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetValues() {
|
function resetValues() {
|
||||||
|
@ -266,7 +267,7 @@
|
||||||
connectionToDomainFailed = false;
|
connectionToDomainFailed = false;
|
||||||
previousCameraMode = Camera.mode;
|
previousCameraMode = Camera.mode;
|
||||||
Camera.mode = "first person";
|
Camera.mode = "first person";
|
||||||
timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS);
|
timer = Script.setTimeout(update, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +465,7 @@
|
||||||
var thisInterval = Date.now();
|
var thisInterval = Date.now();
|
||||||
var deltaTime = (thisInterval - lastInterval);
|
var deltaTime = (thisInterval - lastInterval);
|
||||||
lastInterval = thisInterval;
|
lastInterval = thisInterval;
|
||||||
|
var deltaTimeMS = deltaTime / 1000;
|
||||||
|
|
||||||
var domainLoadingProgressPercentage = Window.domainLoadingProgress();
|
var domainLoadingProgressPercentage = Window.domainLoadingProgress();
|
||||||
var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage);
|
var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage);
|
||||||
|
@ -471,7 +473,7 @@
|
||||||
target = progress;
|
target = progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentProgress >= (TOTAL_LOADING_PROGRESS * 0.4)) {
|
if (currentProgress >= ((TOTAL_LOADING_PROGRESS * 0.4) - TEXTURE_EPSILON)) {
|
||||||
var textureResourceGPUMemSize = renderStats.textureResourceGPUMemSize;
|
var textureResourceGPUMemSize = renderStats.textureResourceGPUMemSize;
|
||||||
var texturePopulatedGPUMemSize = renderStats.textureResourcePopulatedGPUMemSize;
|
var texturePopulatedGPUMemSize = renderStats.textureResourcePopulatedGPUMemSize;
|
||||||
|
|
||||||
|
@ -483,10 +485,9 @@
|
||||||
|
|
||||||
textureMemSizeAtLastCheck = textureResourceGPUMemSize;
|
textureMemSizeAtLastCheck = textureResourceGPUMemSize;
|
||||||
|
|
||||||
if (textureMemSizeStabilityCount >= 20) {
|
if (textureMemSizeStabilityCount >= 30) {
|
||||||
|
|
||||||
if (textureResourceGPUMemSize > 0) {
|
if (textureResourceGPUMemSize > 0) {
|
||||||
// print((texturePopulatedGPUMemSize / textureResourceGPUMemSize));
|
|
||||||
var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize);
|
var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize);
|
||||||
var totalProgress = progress + gpuPercantage;
|
var totalProgress = progress + gpuPercantage;
|
||||||
if (totalProgress >= target) {
|
if (totalProgress >= target) {
|
||||||
|
@ -500,7 +501,11 @@
|
||||||
target = TOTAL_LOADING_PROGRESS;
|
target = TOTAL_LOADING_PROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentProgress = lerp(currentProgress, target, 0.2);
|
if (deltaTime > 1.0) {
|
||||||
|
deltaTimeMS = 0.02;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentProgress = lerp(currentProgress, target, (deltaTimeMS * 2.0));
|
||||||
var properties = {
|
var properties = {
|
||||||
localPosition: { x: (1.85 - (currentProgress / 2) - (-0.029 * (currentProgress / TOTAL_LOADING_PROGRESS))), y: -0.935, z: 0.0 },
|
localPosition: { x: (1.85 - (currentProgress / 2) - (-0.029 * (currentProgress / TOTAL_LOADING_PROGRESS))), y: -0.935, z: 0.0 },
|
||||||
dimensions: {
|
dimensions: {
|
||||||
|
|
Loading…
Reference in a new issue