From 456ff3949a28542ecd89ec23b0287b55a166529f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Sep 2013 16:40:05 -0600 Subject: fix for SH-4295: Interesting: Teleporting to previous location leave some objects invisible. --- indra/newview/llviewerregion.cpp | 55 ++++++++++++++++++++++++++++++++++++++++ indra/newview/llviewerregion.h | 2 +- indra/newview/llworld.cpp | 10 ++++++++ indra/newview/llworld.h | 1 + indra/newview/pipeline.cpp | 1 + 5 files changed, 68 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 985f5a0a1f..24f419b4b1 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1178,6 +1178,61 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time - update_timer.getElapsedTimeF32(); } +void LLViewerRegion::clearCachedVisibleObjects() +{ + mImpl->mWaitingList.clear(); + mImpl->mVisibleGroups.clear(); + + //clean visible entries + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) + { + LLVOCacheEntry* entry = *iter; + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + + if(!entry->getParentID() || parent) //no child or parent is cache-able + { + if(parent) //has a cache-able parent + { + parent->addChild(entry); + } + + LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; + ++next_iter; + mImpl->mVisibleEntries.erase(iter); + iter = next_iter; + } + else //parent is not cache-able, leave it. + { + ++iter; + } + } + + //remove all visible entries. + mLastVisitedEntry = NULL; + std::vector delete_list; + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); + iter != mImpl->mActiveSet.end(); ++iter) + { + LLDrawable* drawablep = (LLDrawable*)(*iter)->getEntry()->getDrawable(); + + if(drawablep && !drawablep->getParent()) + { + delete_list.push_back(drawablep); + } + } + + if(!delete_list.empty()) + { + for(S32 i = 0; i < delete_list.size(); i++) + { + gObjectList.killObject(delete_list[i]->getVObj()); + } + delete_list.clear(); + } + + return; +} + BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { LLTimer update_timer; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index b2df8d5325..8a375610d9 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -336,7 +336,7 @@ public: //remove from object cache if the object receives a full-update or terse update LLViewerObject* forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp); void findOrphans(U32 parent_id); - + void clearCachedVisibleObjects(); void dumpCache(); void unpackRegionHandshake(); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 9009626a03..d600abeb0a 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -684,6 +684,16 @@ void LLWorld::updateRegions(F32 max_update_time) } } +void LLWorld::clearAllVisibleObjects() +{ + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) + { + //clear all cached visible objects. + (*iter)->clearCachedVisibleObjects(); + } +} + void LLWorld::updateParticles() { LLViewerPartSim::getInstance()->updateSimulation(); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 287e41d323..b2d8418064 100755 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -147,6 +147,7 @@ public: void getInfo(LLSD& info); U32 getNumOfActiveCachedObjects() const {return mNumOfActiveCachedObjects;} + void clearAllVisibleObjects(); public: typedef std::list region_list_t; const region_list_t& getRegionList() const { return mActiveRegionList; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 38bef1f4f5..9d8aa849ba 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7371,6 +7371,7 @@ void LLPipeline::doResetVertexBuffers() { LLSpatialPartition::sTeleportRequested = FALSE; + LLWorld::getInstance()->clearAllVisibleObjects(); clearRebuildGroups(); clearRebuildDrawables(); } -- cgit v1.2.3