mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:29:13 +02:00
trying to fix loading bar
This commit is contained in:
parent
71e8ccd190
commit
26a30edec9
8 changed files with 37 additions and 29 deletions
|
@ -232,6 +232,8 @@ public:
|
||||||
bool getPreferAvatarFingerOverStylus() { return false; }
|
bool getPreferAvatarFingerOverStylus() { return false; }
|
||||||
void setPreferAvatarFingerOverStylus(bool value);
|
void setPreferAvatarFingerOverStylus(bool value);
|
||||||
|
|
||||||
|
float getDomainLoadProgress() { return _octreeProcessor.domainLoadProgress(); }
|
||||||
|
|
||||||
float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); }
|
float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); }
|
||||||
void setSettingConstrainToolbarPosition(bool setting);
|
void setSettingConstrainToolbarPosition(bool setting);
|
||||||
|
|
||||||
|
|
|
@ -137,3 +137,7 @@ void OctreePacketProcessor::startEntitySequence() {
|
||||||
bool OctreePacketProcessor::isLoadSequenceComplete() const {
|
bool OctreePacketProcessor::isLoadSequenceComplete() const {
|
||||||
return _safeLanding->isLoadSequenceComplete();
|
return _safeLanding->isLoadSequenceComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float OctreePacketProcessor::domainLoadProgress() {
|
||||||
|
return _safeLanding->loadingProgressPercentage();
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public:
|
||||||
|
|
||||||
void startEntitySequence();
|
void startEntitySequence();
|
||||||
bool isLoadSequenceComplete() const;
|
bool isLoadSequenceComplete() const;
|
||||||
|
float domainLoadProgress();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void packetVersionMismatch();
|
void packetVersionMismatch();
|
||||||
|
|
|
@ -53,6 +53,7 @@ void SafeLanding::startEntitySequence(QSharedPointer<EntityTreeRenderer> entityT
|
||||||
void SafeLanding::stopEntitySequence() {
|
void SafeLanding::stopEntitySequence() {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
_trackingEntities = false;
|
_trackingEntities = false;
|
||||||
|
_maxTrackedEntityCount = 0;
|
||||||
_initialStart = INVALID_SEQUENCE;
|
_initialStart = INVALID_SEQUENCE;
|
||||||
_initialEnd = INVALID_SEQUENCE;
|
_initialEnd = INVALID_SEQUENCE;
|
||||||
_trackedEntities.clear();
|
_trackedEntities.clear();
|
||||||
|
@ -75,6 +76,11 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) {
|
||||||
if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) {
|
if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) {
|
||||||
// Only track entities with downloaded collision bodies.
|
// Only track entities with downloaded collision bodies.
|
||||||
_trackedEntities.emplace(entityID, entity);
|
_trackedEntities.emplace(entityID, entity);
|
||||||
|
int currentTrackedEntityCount = _trackedEntities.size();
|
||||||
|
if (currentTrackedEntityCount > _maxTrackedEntityCount) {
|
||||||
|
_maxTrackedEntityCount = currentTrackedEntityCount;
|
||||||
|
}
|
||||||
|
|
||||||
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
|
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +122,18 @@ bool SafeLanding::isLoadSequenceComplete() {
|
||||||
return !_trackingEntities;
|
return !_trackingEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float SafeLanding::loadingProgressPercentage() {
|
||||||
|
float percentage = 0;
|
||||||
|
|
||||||
|
if (_maxTrackedEntityCount != 0) {
|
||||||
|
int trackedEntityCount = _trackedEntities.size();
|
||||||
|
percentage = (_maxTrackedEntityCount - trackedEntityCount) / _maxTrackedEntityCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "----------> percentage: " << percentage << " <--------";
|
||||||
|
return percentage;
|
||||||
|
}
|
||||||
|
|
||||||
bool SafeLanding::isSequenceNumbersComplete() {
|
bool SafeLanding::isSequenceNumbersComplete() {
|
||||||
if (_initialStart != INVALID_SEQUENCE) {
|
if (_initialStart != INVALID_SEQUENCE) {
|
||||||
Locker lock(_lock);
|
Locker lock(_lock);
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
void setCompletionSequenceNumbers(int first, int last);
|
void setCompletionSequenceNumbers(int first, int last);
|
||||||
void noteReceivedsequenceNumber(int sequenceNumber);
|
void noteReceivedsequenceNumber(int sequenceNumber);
|
||||||
bool isLoadSequenceComplete();
|
bool isLoadSequenceComplete();
|
||||||
|
float loadingProgressPercentage();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addTrackedEntity(const EntityItemID& entityID);
|
void addTrackedEntity(const EntityItemID& entityID);
|
||||||
|
@ -49,6 +50,7 @@ private:
|
||||||
static constexpr int INVALID_SEQUENCE = -1;
|
static constexpr int INVALID_SEQUENCE = -1;
|
||||||
int _initialStart { INVALID_SEQUENCE };
|
int _initialStart { INVALID_SEQUENCE };
|
||||||
int _initialEnd { INVALID_SEQUENCE };
|
int _initialEnd { INVALID_SEQUENCE };
|
||||||
|
int _maxTrackedEntityCount { 0 };
|
||||||
|
|
||||||
struct SequenceLessThan {
|
struct SequenceLessThan {
|
||||||
bool operator()(const int& a, const int& b) const;
|
bool operator()(const int& a, const int& b) const;
|
||||||
|
|
|
@ -589,14 +589,6 @@ void WindowScriptingInterface::onMessageBoxSelected(int button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WindowScriptingInterface::getPhysicsNearbyEntitiesReadyCount() {
|
float WindowScriptingInterface::domainLoadingProgress() {
|
||||||
return qApp->getNearbyEntitiesReadyCount();
|
return qApp->getDomainLoadProgress();
|
||||||
}
|
|
||||||
|
|
||||||
int WindowScriptingInterface::getPhysicsNearbyEntitiesStabilityCount() {
|
|
||||||
return qApp->getEntitiesStabilityCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
int WindowScriptingInterface::getPhysicsNearbyEntitiesCount() {
|
|
||||||
return qApp->getNearbyEntitiesCount();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,9 +561,7 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void closeMessageBox(int id);
|
void closeMessageBox(int id);
|
||||||
|
|
||||||
int getPhysicsNearbyEntitiesReadyCount();
|
float domainLoadingProgress();
|
||||||
int getPhysicsNearbyEntitiesStabilityCount();
|
|
||||||
int getPhysicsNearbyEntitiesCount();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onWindowGeometryChanged(const QRect& geometry);
|
void onWindowGeometryChanged(const QRect& geometry);
|
||||||
|
|
|
@ -344,26 +344,17 @@
|
||||||
var deltaTime = (thisInterval - lastInterval);
|
var deltaTime = (thisInterval - lastInterval);
|
||||||
lastInterval = thisInterval;
|
lastInterval = thisInterval;
|
||||||
|
|
||||||
var nearbyEntitiesReadyCount = Window.getPhysicsNearbyEntitiesReadyCount();
|
var domainLoadingProgressPercentage = Window.domainLoadingProgress();
|
||||||
var stabilityCount = Window.getPhysicsNearbyEntitiesStabilityCount();
|
|
||||||
var nearbyEntitiesCount = Window.getPhysicsNearbyEntitiesCount();
|
|
||||||
|
|
||||||
var stabilityPercentage = (stabilityCount / STABILITY);
|
var progress = MAX_X_SIZE * domainLoadingProgressPercentage;
|
||||||
if (stabilityPercentage > 1) {
|
print(progress);
|
||||||
stabilityPercentage = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var stabilityProgress = (MAX_X_SIZE * 0.75) * stabilityPercentage;
|
|
||||||
|
|
||||||
var entitiesLoadedPercentage = 1;
|
|
||||||
if (nearbyEntitiesCount > 0) {
|
|
||||||
entitiesLoadedPercentage = nearbyEntitiesReadyCount / nearbyEntitiesCount;
|
|
||||||
}
|
|
||||||
var entitiesLoadedProgress = (MAX_X_SIZE * 0.25) * entitiesLoadedPercentage;
|
|
||||||
var progress = stabilityProgress + entitiesLoadedProgress;
|
|
||||||
if (progress >= target) {
|
if (progress >= target) {
|
||||||
target = progress;
|
target = progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (physicsEnabled && target < MAX_X_SIZE) {
|
||||||
|
target = MAX_X_SIZE;
|
||||||
|
}
|
||||||
currentProgress = lerp(currentProgress, target, 0.2);
|
currentProgress = lerp(currentProgress, target, 0.2);
|
||||||
var properties = {
|
var properties = {
|
||||||
localPosition: { x: (1.85 - (currentProgress / 2) - (-0.029 * (currentProgress / MAX_X_SIZE))), y: -0.935, z: 0.0 },
|
localPosition: { x: (1.85 - (currentProgress / 2) - (-0.029 * (currentProgress / MAX_X_SIZE))), y: -0.935, z: 0.0 },
|
||||||
|
|
Loading…
Reference in a new issue