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