diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-09-19 11:14:26 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-09-19 11:14:26 -0600 |
commit | e464b855abb85e03dfec59691b7eccac27a323c4 (patch) | |
tree | d7f01498ef97e72ea5cefe48399c13edc88b5eb9 /indra/newview | |
parent | 345421602c57b82487e8b809a2e5388baf5208c9 (diff) |
fix for SH-4501: Interesting: Occluded objects do not appear when Occluder object is deleted.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llvocache.cpp | 32 | ||||
-rwxr-xr-x | indra/newview/llvocache.h | 3 |
2 files changed, 20 insertions, 15 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 5932fb87c1..6d2a17882a 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -491,8 +491,7 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) mLODPeriod = 16; mRegionp = regionp; mPartitionType = LLViewerRegion::PARTITION_VO_CACHE; - mDirty = FALSE; - + for(S32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) { mCulledTime[i] = 0; @@ -501,17 +500,11 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) new LLOcclusionCullingGroup(mOctree, this); } -void LLVOCachePartition::setDirty() -{ - mDirty = TRUE; -} - void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry) { llassert(entry->hasVOCacheEntry()); mOctree->insert(entry); - setDirty(); } void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) @@ -643,12 +636,28 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame(); - if(!mDirty && !mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic()) + if(!mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic()) { - return 0; //nothing changed, skip culling + static U32 hash = 0; + + U32 seed = llmax(mLODPeriod >> 1, (U32)4); + if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) + { + if(!(LLViewerOctreeEntryData::getCurrentFrame() % seed)) + { + hash = (hash + 1) % seed; + } + } + if(LLViewerOctreeEntryData::getCurrentFrame() % seed != hash) + { + return 0; //nothing changed, reduce frequency of culling + } } - mCullHistory[LLViewerCamera::sCurCameraID] <<= 1; + if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) + { + mCullHistory[LLViewerCamera::sCurCameraID] <<= 1; + } //localize the camera LLVector3 region_agent = mRegionp->getOriginAgent(); @@ -709,7 +718,6 @@ void LLVOCachePartition::resetOccluders() group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); } mOccludedGroups.clear(); - mDirty = FALSE; sNeedsOcclusionCheck = FALSE; } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 1fa019cfa6..7c7b64ad5b 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -172,14 +172,11 @@ public: void resetOccluders(); void processOccluders(LLCamera* camera); - void setDirty(); - public: static BOOL sNeedsOcclusionCheck; //static LLTrace::MemStatHandle sMemStat; private: - BOOL mDirty; U32 mCullHistory[LLViewerCamera::NUM_CAMERAS]; U32 mCulledTime[LLViewerCamera::NUM_CAMERAS]; std::set<LLOcclusionCullingGroup*> mOccludedGroups; |