From c14d46074cdfb04f6a183fe8619645217443fd2f Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Thu, 12 Sep 2013 09:42:55 +0200 Subject: [PATCH] Re initiate spatial partitions in the main region after a long teleport jump. Also kill objects in the regions we left behind. Restore max octree range to 1024 * 1024 --- indra/llmath/lloctree.h | 2 +- indra/newview/llviewermessage.cpp | 15 +++++++++++++++ indra/newview/llviewerregion.cpp | 10 ++++++++++ indra/newview/llviewerregion.h | 2 ++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 3c8e89694..981e2176f 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -1014,7 +1014,7 @@ public: } LLVector4a MAX_MAG; - MAX_MAG.splat(2048.f * 2048.f); // Singu note: SVC-2941 FIRE-11593 (original range was 1024 * 1024) + MAX_MAG.splat(1024.f * 1024.f); const LLVector4a& v = data->getPositionGroup(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index cb2c5e8ec..2072fa044 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4563,6 +4563,21 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) gAgent.getRegion()->getOriginGlobal()); gAgent.setRegion(regionp); gObjectList.shiftObjects(shift_vector); + // Is this a really long jump? + if (shift_vector.length() > 2048.f * 256.f) + { + regionp->reInitPartitions(); + gAgent.setRegion(regionp); + // Kill objects in the regions we left behind + for (LLWorld::region_list_t::const_iterator r = LLWorld::getInstance()->getRegionList().begin(); + r != LLWorld::getInstance()->getRegionList().end(); ++r) + { + if (*r != regionp) + { + gObjectList.killObjects(*r); + } + } + } gAssetStorage->setUpstream(msg->getSender()); gCacheName->setUpstream(msg->getSender()); gViewerThrottle.sendToSim(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 9571837c7..50865c610 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -338,7 +338,11 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, // Create the object lists initStats(); + initPartitions(); +} +void LLViewerRegion::initPartitions() +{ //create object partitions //MUST MATCH declaration of eObjectPartitions mImpl->mObjectPartition.push_back(new LLHUDPartition()); //PARTITION_HUD @@ -357,6 +361,12 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE } +void LLViewerRegion::reInitPartitions() +{ + std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer()); + mImpl->mObjectPartition.clear(); + initPartitions(); +} void LLViewerRegion::initStats() { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index e22fc3907..6b0e73b49 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -369,10 +369,12 @@ public: }; void showReleaseNotes(); + void reInitPartitions(); protected: void disconnectAllNeighbors(); void initStats(); + void initPartitions(); public: LLWind mWind;