mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 18:42:55 +02:00
fix redraw issue when logging in to or out of a domain
This commit is contained in:
parent
2ee5b45ca6
commit
47aed9c8bd
2 changed files with 28 additions and 8 deletions
|
@ -3462,11 +3462,9 @@ void Application::update(float deltaTime) {
|
||||||
const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND;
|
const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND;
|
||||||
bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY;
|
bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY;
|
||||||
bool viewIsDifferentEnough = !_lastQueriedViewFrustum.isVerySimilar(_viewFrustum);
|
bool viewIsDifferentEnough = !_lastQueriedViewFrustum.isVerySimilar(_viewFrustum);
|
||||||
|
|
||||||
// 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) {
|
if (queryIsDue || viewIsDifferentEnough) {
|
||||||
_lastQueriedTime = now;
|
_lastQueriedTime = now;
|
||||||
|
|
||||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
|
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
|
||||||
queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions);
|
queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions);
|
||||||
}
|
}
|
||||||
|
@ -3561,7 +3559,7 @@ int Application::sendNackPackets() {
|
||||||
return packetsSent;
|
return packetsSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
|
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions, bool forceResend) {
|
||||||
|
|
||||||
if (!_settingsLoaded) {
|
if (!_settingsLoaded) {
|
||||||
return; // bail early if settings are not loaded
|
return; // bail early if settings are not loaded
|
||||||
|
@ -3648,7 +3646,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
||||||
|
|
||||||
auto queryPacket = NLPacket::create(packetType);
|
auto queryPacket = NLPacket::create(packetType);
|
||||||
|
|
||||||
nodeList->eachNode([&](const SharedNodePointer& node){
|
nodeList->eachNode([&](const SharedNodePointer& node) {
|
||||||
// only send to the NodeTypes that are serverType
|
// only send to the NodeTypes that are serverType
|
||||||
if (node->getActiveSocket() && node->getType() == serverType) {
|
if (node->getActiveSocket() && node->getType() == serverType) {
|
||||||
|
|
||||||
|
@ -3717,6 +3715,16 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
||||||
_octreeQuery.setMaxQueryPacketsPerSecond(0);
|
_octreeQuery.setMaxQueryPacketsPerSecond(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if asked to forceResend, then set the query's position/orientation to be degenerate in a manner
|
||||||
|
// that will cause our next query to be guarenteed to be different and the server will resend to us
|
||||||
|
if (forceResend) {
|
||||||
|
_octreeQuery.setCameraPosition(glm::vec3(-0.1, -0.1, -0.1));
|
||||||
|
const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0);
|
||||||
|
_octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
|
||||||
|
_octreeQuery.setCameraNearClip(0.1f);
|
||||||
|
_octreeQuery.setCameraFarClip(0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
// encode the query data
|
// encode the query data
|
||||||
int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload()));
|
int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload()));
|
||||||
queryPacket->setPayloadSize(packetSize);
|
queryPacket->setPayloadSize(packetSize);
|
||||||
|
@ -4133,6 +4141,7 @@ void Application::clearDomainOctreeDetails() {
|
||||||
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||||
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME);
|
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME);
|
||||||
|
|
||||||
|
_recentlyClearedDomain = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::domainChanged(const QString& domainHostname) {
|
void Application::domainChanged(const QString& domainHostname) {
|
||||||
|
@ -4154,7 +4163,7 @@ void Application::nodeAdded(SharedNodePointer node) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::nodeActivated(SharedNodePointer node) const {
|
void Application::nodeActivated(SharedNodePointer node) {
|
||||||
if (node->getType() == NodeType::AssetServer) {
|
if (node->getType() == NodeType::AssetServer) {
|
||||||
// asset server just connected - check if we have the asset browser showing
|
// asset server just connected - check if we have the asset browser showing
|
||||||
|
|
||||||
|
@ -4173,10 +4182,19 @@ void Application::nodeActivated(SharedNodePointer node) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we get a new EntityServer activated, do a "forceRedraw" query. This will send a degenerate
|
||||||
|
// query so that if the server doesn't
|
||||||
|
if (_recentlyClearedDomain && node->getType() == NodeType::EntityServer) {
|
||||||
|
_recentlyClearedDomain = false;
|
||||||
|
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
|
||||||
|
queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::nodeKilled(SharedNodePointer node) {
|
void Application::nodeKilled(SharedNodePointer node) {
|
||||||
|
|
||||||
// These are here because connecting NodeList::nodeKilled to OctreePacketProcessor::nodeKilled doesn't work:
|
// These are here because connecting NodeList::nodeKilled to OctreePacketProcessor::nodeKilled doesn't work:
|
||||||
// OctreePacketProcessor::nodeKilled is not being called when NodeList::nodeKilled is emitted.
|
// OctreePacketProcessor::nodeKilled is not being called when NodeList::nodeKilled is emitted.
|
||||||
// This may have to do with GenericThread::threadRoutine() blocking the QThread event loop
|
// This may have to do with GenericThread::threadRoutine() blocking the QThread event loop
|
||||||
|
|
|
@ -312,7 +312,7 @@ private slots:
|
||||||
void domainChanged(const QString& domainHostname);
|
void domainChanged(const QString& domainHostname);
|
||||||
void updateWindowTitle() const;
|
void updateWindowTitle() const;
|
||||||
void nodeAdded(SharedNodePointer node) const;
|
void nodeAdded(SharedNodePointer node) const;
|
||||||
void nodeActivated(SharedNodePointer node) const;
|
void nodeActivated(SharedNodePointer node);
|
||||||
void nodeKilled(SharedNodePointer node);
|
void nodeKilled(SharedNodePointer node);
|
||||||
static void packetSent(quint64 length);
|
static void packetSent(quint64 length);
|
||||||
void updateDisplayMode();
|
void updateDisplayMode();
|
||||||
|
@ -331,7 +331,7 @@ private:
|
||||||
void updateThreads(float deltaTime);
|
void updateThreads(float deltaTime);
|
||||||
void updateDialogs(float deltaTime) const;
|
void updateDialogs(float deltaTime) const;
|
||||||
|
|
||||||
void queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions);
|
void queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions, bool forceResend = false);
|
||||||
static void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum);
|
static void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum);
|
||||||
|
|
||||||
glm::vec3 getSunDirection() const;
|
glm::vec3 getSunDirection() const;
|
||||||
|
@ -520,6 +520,8 @@ private:
|
||||||
std::atomic<uint32_t> _processOctreeStatsCounter { 0 };
|
std::atomic<uint32_t> _processOctreeStatsCounter { 0 };
|
||||||
|
|
||||||
bool _keyboardDeviceHasFocus { true };
|
bool _keyboardDeviceHasFocus { true };
|
||||||
|
|
||||||
|
bool _recentlyClearedDomain { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Application_h
|
#endif // hifi_Application_h
|
||||||
|
|
Loading…
Reference in a new issue