exposing physics progress

This commit is contained in:
Dante Ruiz 2018-05-29 13:22:20 -07:00
parent a2717e2efa
commit 2377626203
4 changed files with 27 additions and 0 deletions

View file

@ -5301,6 +5301,7 @@ void Application::resetPhysicsReadyInformation() {
_fullSceneCounterAtLastPhysicsCheck = 0;
_nearbyEntitiesCountAtLastPhysicsCheck = 0;
_nearbyEntitiesStabilityCount = 0;
_nearbyEntitiesReadyCount = 0;
_physicsEnabled = false;
}
@ -6546,6 +6547,7 @@ bool Application::nearbyEntitiesAreReadyForPhysics() {
_nearbyEntitiesCountAtLastPhysicsCheck = nearbyCount;
const uint32_t MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT = 3;
uint32_t readyNearbyEntities = 0;
if (_nearbyEntitiesStabilityCount >= MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT) {
// We've seen the same number of nearby entities for several stats packets in a row. assume we've got all
// the local entities.
@ -6555,8 +6557,11 @@ bool Application::nearbyEntitiesAreReadyForPhysics() {
HIFI_FCDEBUG(interfaceapp(), "Physics disabled until entity loads: " << entity->getID() << entity->getName());
// don't break here because we want all the relevant entities to start their downloads
result = false;
} else {
readyNearbyEntities++;
}
}
_nearbyEntitiesReadyCount = readyNearbyEntities;
return result;
}
return false;

View file

@ -224,6 +224,10 @@ public:
void setHmdTabletBecomesToolbarSetting(bool value);
bool getPreferStylusOverLaser() { return _preferStylusOverLaserSetting.get(); }
void setPreferStylusOverLaser(bool value);
uint32_t getEntitiesStabilityCount() { return _nearbyEntitiesStabilityCount; }
uint32_t getNearbyEntitiesReadyCount() { return _nearbyEntitiesReadyCount; }
uint32_t getNearbyEntitiesCount() { return _nearbyEntitiesCountAtLastPhysicsCheck; }
// FIXME: Remove setting completely or make available through JavaScript API?
//bool getPreferAvatarFingerOverStylus() { return _preferAvatarFingerOverStylusSetting.get(); }
bool getPreferAvatarFingerOverStylus() { return false; }
@ -723,6 +727,7 @@ private:
uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 }; // _fullSceneReceivedCounter last time we checked physics ready
uint32_t _nearbyEntitiesCountAtLastPhysicsCheck { 0 }; // how many in-range entities last time we checked physics ready
uint32_t _nearbyEntitiesStabilityCount { 0 }; // how many times has _nearbyEntitiesCountAtLastPhysicsCheck been the same
uint32_t _nearbyEntitiesReadyCount { 0 };
quint64 _lastPhysicsCheckTime { usecTimestampNow() }; // when did we last check to see if physics was ready
bool _keyboardDeviceHasFocus { true };

View file

@ -584,3 +584,16 @@ void WindowScriptingInterface::onMessageBoxSelected(int button) {
_messageBoxes.remove(id);
}
}
int WindowScriptingInterface::getPhysicsNearbyEntitiesReadyCount() {
return qApp->getNearbyEntitiesReadyCount();
}
int WindowScriptingInterface::getPhysicsNearbyEntitiesStabilityCount() {
return qApp->getEntitiesStabilityCount();
}
int WindowScriptingInterface::getPhysicsNearbyEntitiesCount() {
return qApp->getNearbyEntitiesCount();
}

View file

@ -561,6 +561,10 @@ public slots:
*/
void closeMessageBox(int id);
int getPhysicsNearbyEntitiesReadyCount();
int getPhysicsNearbyEntitiesStabilityCount();
int getPhysicsNearbyEntitiesCount();
private slots:
void onWindowGeometryChanged(const QRect& geometry);
void onMessageBoxSelected(int button);