mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:57:59 +02:00
update interstitial page stability count and loading bar
This commit is contained in:
parent
5a8ab61426
commit
57ae8ff8a1
7 changed files with 45 additions and 17 deletions
|
@ -6570,8 +6570,7 @@ bool Application::gpuTextureMemSizeStable() {
|
||||||
}
|
}
|
||||||
_gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize;
|
_gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize;
|
||||||
|
|
||||||
const uint32_t MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT = 10;
|
if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) {
|
||||||
if (_gpuTextureMemSizeStabilityCount >= MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT) {
|
|
||||||
return (textureResourceGPUMemSize == texturePopulatedGPUMemSize);
|
return (textureResourceGPUMemSize == texturePopulatedGPUMemSize);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -233,6 +233,8 @@ public:
|
||||||
float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); }
|
float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); }
|
||||||
void setSettingConstrainToolbarPosition(bool setting);
|
void setSettingConstrainToolbarPosition(bool setting);
|
||||||
|
|
||||||
|
Q_INVOKABLE void setMinimumGPUTextureMemStabilityCount(int stabilityCount) { _minimumGPUTextureMemSizeStabilityCount = stabilityCount; }
|
||||||
|
|
||||||
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
||||||
|
|
||||||
virtual controller::ScriptingInterface* getControllerScriptingInterface() { return _controllerScriptingInterface; }
|
virtual controller::ScriptingInterface* getControllerScriptingInterface() { return _controllerScriptingInterface; }
|
||||||
|
@ -585,6 +587,8 @@ private:
|
||||||
QElapsedTimer _lastTimeUpdated;
|
QElapsedTimer _lastTimeUpdated;
|
||||||
QElapsedTimer _lastTimeRendered;
|
QElapsedTimer _lastTimeRendered;
|
||||||
|
|
||||||
|
int _minimumGPUTextureMemSizeStabilityCount { 15 };
|
||||||
|
|
||||||
ShapeManager _shapeManager;
|
ShapeManager _shapeManager;
|
||||||
PhysicalEntitySimulationPointer _entitySimulation;
|
PhysicalEntitySimulationPointer _entitySimulation;
|
||||||
PhysicsEnginePointer _physicsEngine;
|
PhysicsEnginePointer _physicsEngine;
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "SafeLanding.h"
|
#include "SafeLanding.h"
|
||||||
|
|
||||||
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "EntityTreeRenderer.h"
|
#include "EntityTreeRenderer.h"
|
||||||
#include "ModelEntityItem.h"
|
#include "ModelEntityItem.h"
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
|
@ -39,6 +42,7 @@ void SafeLanding::startEntitySequence(QSharedPointer<EntityTreeRenderer> entityT
|
||||||
_entityTree = entityTree;
|
_entityTree = entityTree;
|
||||||
_trackedEntities.clear();
|
_trackedEntities.clear();
|
||||||
_trackingEntities = true;
|
_trackingEntities = true;
|
||||||
|
_maxTrackedEntityCount = 0;
|
||||||
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
||||||
&EntityTree::addingEntity, this, &SafeLanding::addTrackedEntity);
|
&EntityTree::addingEntity, this, &SafeLanding::addTrackedEntity);
|
||||||
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
connect(std::const_pointer_cast<EntityTree>(_entityTree).get(),
|
||||||
|
@ -47,6 +51,7 @@ void SafeLanding::startEntitySequence(QSharedPointer<EntityTreeRenderer> entityT
|
||||||
_sequenceNumbers.clear();
|
_sequenceNumbers.clear();
|
||||||
_initialStart = INVALID_SEQUENCE;
|
_initialStart = INVALID_SEQUENCE;
|
||||||
_initialEnd = INVALID_SEQUENCE;
|
_initialEnd = INVALID_SEQUENCE;
|
||||||
|
_startTime = usecTimestampNow();
|
||||||
EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority);
|
EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +60,7 @@ void SafeLanding::stopEntitySequence() {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
_trackingEntities = false;
|
_trackingEntities = false;
|
||||||
_maxTrackedEntityCount = 0;
|
_maxTrackedEntityCount = 0;
|
||||||
|
_trackedEntityStabilityCount = 0;
|
||||||
_initialStart = INVALID_SEQUENCE;
|
_initialStart = INVALID_SEQUENCE;
|
||||||
_initialEnd = INVALID_SEQUENCE;
|
_initialEnd = INVALID_SEQUENCE;
|
||||||
_trackedEntities.clear();
|
_trackedEntities.clear();
|
||||||
|
@ -66,13 +72,14 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
EntityItemPointer entity = _entityTree->findEntityByID(entityID);
|
EntityItemPointer entity = _entityTree->findEntityByID(entityID);
|
||||||
|
|
||||||
if (entity) {
|
if (entity && entity->getCreated() < _startTime) {
|
||||||
|
|
||||||
_trackedEntities.emplace(entityID, entity);
|
_trackedEntities.emplace(entityID, entity);
|
||||||
int trackedEntityCount = (int)_trackedEntities.size();
|
int trackedEntityCount = (int)_trackedEntities.size();
|
||||||
|
|
||||||
if (trackedEntityCount > _maxTrackedEntityCount) {
|
if (trackedEntityCount > _maxTrackedEntityCount) {
|
||||||
_maxTrackedEntityCount = trackedEntityCount;
|
_maxTrackedEntityCount = trackedEntityCount;
|
||||||
|
_trackedEntityStabilityCount = 0;
|
||||||
}
|
}
|
||||||
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
|
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
|
||||||
}
|
}
|
||||||
|
@ -116,11 +123,19 @@ bool SafeLanding::isLoadSequenceComplete() {
|
||||||
|
|
||||||
float SafeLanding::loadingProgressPercentage() {
|
float SafeLanding::loadingProgressPercentage() {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
|
|
||||||
|
static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15;
|
||||||
|
|
||||||
|
float percentage = 0.0f;
|
||||||
if (_maxTrackedEntityCount > 0) {
|
if (_maxTrackedEntityCount > 0) {
|
||||||
return ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount);
|
percentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0f;
|
if (_trackedEntityStabilityCount < MINIMUM_TRACKED_ENTITY_STABILITY_COUNT) {
|
||||||
|
percentage *= 0.20f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return percentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SafeLanding::isSequenceNumbersComplete() {
|
bool SafeLanding::isSequenceNumbersComplete() {
|
||||||
|
@ -166,19 +181,18 @@ bool SafeLanding::isEntityLoadingComplete() {
|
||||||
auto entityTree = qApp->getEntities();
|
auto entityTree = qApp->getEntities();
|
||||||
auto entityMapIter = _trackedEntities.begin();
|
auto entityMapIter = _trackedEntities.begin();
|
||||||
|
|
||||||
|
Settings settings;
|
||||||
|
bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool();
|
||||||
|
|
||||||
while (entityMapIter != _trackedEntities.end()) {
|
while (entityMapIter != _trackedEntities.end()) {
|
||||||
auto entity = entityMapIter->second;
|
auto entity = entityMapIter->second;
|
||||||
|
|
||||||
bool isVisuallyReady = true;
|
bool isVisuallyReady = true;
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID();
|
|
||||||
|
|
||||||
Settings settings;
|
|
||||||
bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool();
|
|
||||||
|
|
||||||
if (enableInterstitial) {
|
if (enableInterstitial) {
|
||||||
isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first));
|
isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first));
|
||||||
|
|
||||||
|
qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEntityPhysicsReady(entity) && isVisuallyReady) {
|
if (isEntityPhysicsReady(entity) && isVisuallyReady) {
|
||||||
|
@ -191,7 +205,13 @@ bool SafeLanding::isEntityLoadingComplete() {
|
||||||
entityMapIter++;
|
entityMapIter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << "EntityList size" << _trackedEntities.size() << "\n";
|
|
||||||
|
if (enableInterstitial) {
|
||||||
|
_trackedEntityStabilityCount++;
|
||||||
|
qDebug() << "EntityList size" << _trackedEntities.size() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return _trackedEntities.empty();
|
return _trackedEntities.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@ private:
|
||||||
int _initialStart { INVALID_SEQUENCE };
|
int _initialStart { INVALID_SEQUENCE };
|
||||||
int _initialEnd { INVALID_SEQUENCE };
|
int _initialEnd { INVALID_SEQUENCE };
|
||||||
int _maxTrackedEntityCount { 0 };
|
int _maxTrackedEntityCount { 0 };
|
||||||
|
int _trackedEntityStabilityCount { 0 };
|
||||||
|
|
||||||
|
quint64 _startTime { 0 };
|
||||||
|
|
||||||
struct SequenceLessThan {
|
struct SequenceLessThan {
|
||||||
bool operator()(const int& a, const int& b) const;
|
bool operator()(const int& a, const int& b) const;
|
||||||
|
|
|
@ -389,6 +389,10 @@ void WindowScriptingInterface::showAssetServer(const QString& upload) {
|
||||||
QMetaObject::invokeMethod(qApp, "showAssetServerWidget", Qt::QueuedConnection, Q_ARG(QString, upload));
|
QMetaObject::invokeMethod(qApp, "showAssetServerWidget", Qt::QueuedConnection, Q_ARG(QString, upload));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowScriptingInterface::setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount) {
|
||||||
|
QMetaObject::invokeMethod(qApp, " setMinimumGPUTextureMemStabilityCount", Qt::QueuedConnection, Q_ARG(int, stabilityCount));
|
||||||
|
}
|
||||||
|
|
||||||
QString WindowScriptingInterface::checkVersion() {
|
QString WindowScriptingInterface::checkVersion() {
|
||||||
return QCoreApplication::applicationVersion();
|
return QCoreApplication::applicationVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -570,6 +570,8 @@ public slots:
|
||||||
|
|
||||||
float domainLoadingProgress();
|
float domainLoadingProgress();
|
||||||
|
|
||||||
|
void setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onWindowGeometryChanged(const QRect& geometry);
|
void onWindowGeometryChanged(const QRect& geometry);
|
||||||
void onMessageBoxSelected(int button);
|
void onMessageBoxSelected(int button);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
Script.include("/~/system/libraries/Xform.js");
|
Script.include("/~/system/libraries/Xform.js");
|
||||||
var DEBUG = true;
|
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.01;
|
||||||
|
@ -385,7 +385,6 @@
|
||||||
lastInterval = thisInterval;
|
lastInterval = thisInterval;
|
||||||
|
|
||||||
var domainLoadingProgressPercentage = Window.domainLoadingProgress();
|
var domainLoadingProgressPercentage = Window.domainLoadingProgress();
|
||||||
|
|
||||||
var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage);
|
var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage);
|
||||||
if (progress >= target) {
|
if (progress >= target) {
|
||||||
target = progress;
|
target = progress;
|
||||||
|
@ -408,10 +407,7 @@
|
||||||
if (textureResourceGPUMemSize > 0) {
|
if (textureResourceGPUMemSize > 0) {
|
||||||
print((texturePopulatedGPUMemSize / textureResourceGPUMemSize));
|
print((texturePopulatedGPUMemSize / textureResourceGPUMemSize));
|
||||||
var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize);
|
var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize);
|
||||||
print("---> gpu: " + gpuPercantage);
|
|
||||||
print("----> current: " + progress);
|
|
||||||
var totalProgress = progress + gpuPercantage;
|
var totalProgress = progress + gpuPercantage;
|
||||||
print("------> totalProgress: " + totalProgress + "\n");
|
|
||||||
if (totalProgress >= target) {
|
if (totalProgress >= target) {
|
||||||
target = totalProgress;
|
target = totalProgress;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue