mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 08:37:19 +02:00
CR
This commit is contained in:
parent
487a63025f
commit
b04c5bd0db
3 changed files with 16 additions and 12 deletions
|
@ -967,7 +967,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_entitySimulation(new PhysicalEntitySimulation()),
|
_entitySimulation(new PhysicalEntitySimulation()),
|
||||||
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
||||||
_entityClipboard(new EntityTree()),
|
_entityClipboard(new EntityTree()),
|
||||||
_lastQueriedTime(usecTimestampNow()),
|
|
||||||
_previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
|
_previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
|
||||||
_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
|
_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
|
||||||
_hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT),
|
_hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT),
|
||||||
|
@ -5084,7 +5083,7 @@ void Application::reloadResourceCaches() {
|
||||||
resetPhysicsReadyInformation();
|
resetPhysicsReadyInformation();
|
||||||
|
|
||||||
// Query the octree to refresh everything in view
|
// Query the octree to refresh everything in view
|
||||||
_lastQueriedTime = 0;
|
_queryExpiry = SteadyClock::now();
|
||||||
_octreeQuery.incrementConnectionID();
|
_octreeQuery.incrementConnectionID();
|
||||||
|
|
||||||
queryOctree(NodeType::EntityServer, PacketType::EntityQuery);
|
queryOctree(NodeType::EntityServer, PacketType::EntityQuery);
|
||||||
|
@ -5660,9 +5659,6 @@ void Application::update(float deltaTime) {
|
||||||
PROFILE_RANGE_EX(app, "QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
PROFILE_RANGE_EX(app, "QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
PerformanceTimer perfTimer("queryOctree");
|
PerformanceTimer perfTimer("queryOctree");
|
||||||
QMutexLocker viewLocker(&_viewMutex);
|
QMutexLocker viewLocker(&_viewMutex);
|
||||||
quint64 sinceLastQuery = now - _lastQueriedTime;
|
|
||||||
const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND;
|
|
||||||
bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY;
|
|
||||||
|
|
||||||
bool viewIsDifferentEnough = false;
|
bool viewIsDifferentEnough = false;
|
||||||
if (_conicalViews.size() == _lastQueriedViews.size()) {
|
if (_conicalViews.size() == _lastQueriedViews.size()) {
|
||||||
|
@ -5678,14 +5674,16 @@ void Application::update(float deltaTime) {
|
||||||
|
|
||||||
|
|
||||||
// if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it
|
// if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it
|
||||||
if (queryIsDue || viewIsDifferentEnough) {
|
static const std::chrono::seconds MIN_PERIOD_BETWEEN_QUERIES { 3 };
|
||||||
|
auto now = SteadyClock::now();
|
||||||
|
if (now > _queryExpiry || viewIsDifferentEnough) {
|
||||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
|
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
|
||||||
queryOctree(NodeType::EntityServer, PacketType::EntityQuery);
|
queryOctree(NodeType::EntityServer, PacketType::EntityQuery);
|
||||||
}
|
}
|
||||||
queryAvatars();
|
queryAvatars();
|
||||||
|
|
||||||
_lastQueriedViews = _conicalViews;
|
_lastQueriedViews = _conicalViews;
|
||||||
_lastQueriedTime = now;
|
_queryExpiry = now + MIN_PERIOD_BETWEEN_QUERIES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6142,7 +6140,7 @@ void Application::nodeActivated(SharedNodePointer node) {
|
||||||
// If we get a new EntityServer activated, reset lastQueried time
|
// If we get a new EntityServer activated, reset lastQueried time
|
||||||
// so we will do a proper query during update
|
// so we will do a proper query during update
|
||||||
if (node->getType() == NodeType::EntityServer) {
|
if (node->getType() == NodeType::EntityServer) {
|
||||||
_lastQueriedTime = 0;
|
_queryExpiry = SteadyClock::now();
|
||||||
_octreeQuery.incrementConnectionID();
|
_octreeQuery.incrementConnectionID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6151,6 +6149,8 @@ void Application::nodeActivated(SharedNodePointer node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->getType() == NodeType::AvatarMixer) {
|
if (node->getType() == NodeType::AvatarMixer) {
|
||||||
|
_queryExpiry = SteadyClock::now();
|
||||||
|
|
||||||
// new avatar mixer, send off our identity packet on next update loop
|
// new avatar mixer, send off our identity packet on next update loop
|
||||||
// Reset skeletonModelUrl if the last server modified our choice.
|
// Reset skeletonModelUrl if the last server modified our choice.
|
||||||
// Override the avatar url (but not model name) here too.
|
// Override the avatar url (but not model name) here too.
|
||||||
|
|
|
@ -111,7 +111,8 @@ class Application : public QApplication,
|
||||||
public AbstractViewStateInterface,
|
public AbstractViewStateInterface,
|
||||||
public AbstractScriptingServicesInterface,
|
public AbstractScriptingServicesInterface,
|
||||||
public AbstractUriHandler,
|
public AbstractUriHandler,
|
||||||
public PluginContainer {
|
public PluginContainer
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// TODO? Get rid of those
|
// TODO? Get rid of those
|
||||||
|
@ -579,7 +580,10 @@ private:
|
||||||
|
|
||||||
ConicalViewFrustums _conicalViews;
|
ConicalViewFrustums _conicalViews;
|
||||||
ConicalViewFrustums _lastQueriedViews; // last views used to query servers
|
ConicalViewFrustums _lastQueriedViews; // last views used to query servers
|
||||||
quint64 _lastQueriedTime;
|
|
||||||
|
using SteadyClock = std::chrono::steady_clock;
|
||||||
|
using TimePoint = SteadyClock::time_point;
|
||||||
|
TimePoint _queryExpiry;
|
||||||
|
|
||||||
OctreeQuery _octreeQuery { true }; // NodeData derived class for querying octee cells from octree servers
|
OctreeQuery _octreeQuery { true }; // NodeData derived class for querying octee cells from octree servers
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// PrioritizedEntity is a placeholder in a sorted queue.
|
// PrioritizedEntity is a placeholder in a sorted queue.
|
||||||
class PrioritizedEntity {
|
class PrioritizedEntity {
|
||||||
public:
|
public:
|
||||||
static constexpr float DO_NOT_SEND { -1.0e-6f };
|
static constexpr float DO_NOT_SEND { -1.0e6f };
|
||||||
static constexpr float FORCE_REMOVE { -1.0e-5f };
|
static constexpr float FORCE_REMOVE { -1.0e5f };
|
||||||
static constexpr float WHEN_IN_DOUBT_PRIORITY { 1.0f };
|
static constexpr float WHEN_IN_DOUBT_PRIORITY { 1.0f };
|
||||||
|
|
||||||
PrioritizedEntity(EntityItemPointer entity, float priority, bool forceRemove = false) : _weakEntity(entity), _rawEntityPointer(entity.get()), _priority(priority), _forceRemove(forceRemove) {}
|
PrioritizedEntity(EntityItemPointer entity, float priority, bool forceRemove = false) : _weakEntity(entity), _rawEntityPointer(entity.get()), _priority(priority), _forceRemove(forceRemove) {}
|
||||||
|
|
Loading…
Reference in a new issue