diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-10-18 16:14:40 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-10-18 16:14:40 -0600 |
commit | 7bfacf8ca6c7bfdd9b11a2036a914c8f47058a61 (patch) | |
tree | fdf041b848cfe9b5dde95e231ff5bb57dca6791d | |
parent | cf89975f166c1546c60dc51b25558ba74dee5cf5 (diff) |
stop other cameras than the world camera to asscee object cache.
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llvocache.cpp | 27 | ||||
-rwxr-xr-x | indra/newview/llvocache.h | 4 |
3 files changed, 20 insertions, 16 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 13a71b17cf..e73b4fb62c 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1165,6 +1165,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) } if(mImpl->mWaitingList.empty()) { + mImpl->mVOCachePartition->setCullHistory(FALSE); return max_time; } @@ -1174,6 +1175,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) projection_threshold *= projection_threshold; S32 throttle = sNewObjectCreationThrottle; + BOOL has_new_obj = FALSE; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) @@ -1188,6 +1190,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); + has_new_obj = TRUE; if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; @@ -1195,6 +1198,8 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) } } + mImpl->mVOCachePartition->setCullHistory(has_new_obj); + return max_time - update_timer.getElapsedTimeF32(); } diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 4d598c8845..3f2a39ba2b 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -524,9 +524,10 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) for(S32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) { - mCulledTime[i] = 0; - mCullHistory[i] = -1; + mCulledTime[i] = 0; } + mCullHistory = -1; + new LLVOCacheGroup(mOctree, this); } @@ -760,7 +761,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) ((LLViewerOctreeGroup*)mOctree->getListener(0))->rebound(); - if(LLViewerCamera::sCurCameraID >= LLViewerCamera::CAMERA_WATER0) + if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { return 0; //no need for those cameras. } @@ -776,7 +777,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; projection_threshold *= projection_threshold; - if(!mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic()) + if(!mCullHistory && LLViewerRegion::isViewerCameraStatic()) { U32 seed = llmax(mLODPeriod >> 1, (U32)4); if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) @@ -797,22 +798,12 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) mBackSlectionEnabled = -1; //reset it. } - if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) - { - mCullHistory[LLViewerCamera::sCurCameraID] <<= 1; - } - //localize the camera LLVector3 region_agent = mRegionp->getOriginAgent(); camera.calcRegionFrustumPlanes(region_agent); LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, projection_threshold, this); - culler.traverse(mOctree); - - if(mRegionp->getNumOfVisibleGroups() > 0) - { - mCullHistory[LLViewerCamera::sCurCameraID] |= 1; - } + culler.traverse(mOctree); if(!sNeedsOcclusionCheck) { @@ -821,6 +812,12 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) return 1; } +void LLVOCachePartition::setCullHistory(BOOL has_new_object) +{ + mCullHistory <<= 1; + mCullHistory |= has_new_object; +} + void LLVOCachePartition::addOccluders(LLViewerOctreeGroup* gp) { LLVOCacheGroup* group = (LLVOCacheGroup*)gp; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 764c06f813..3ee9dcaac8 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -185,6 +185,8 @@ public: void processOccluders(LLCamera* camera); void removeOccluder(LLVOCacheGroup* group); + void setCullHistory(BOOL has_new_object); + private: void selectBackObjects(LLCamera &camera, F32 back_sphere_radius, F32 projection_area_cutoff); //select objects behind camera. @@ -192,7 +194,7 @@ public: static BOOL sNeedsOcclusionCheck; private: - U32 mCullHistory[LLViewerCamera::NUM_CAMERAS]; + U32 mCullHistory; U32 mCulledTime[LLViewerCamera::NUM_CAMERAS]; std::set<LLVOCacheGroup*> mOccludedGroups; |