stop other cameras than the world camera to asscee object cache.

master
Xiaohong Bao 2013-10-18 16:14:40 -06:00
parent cf89975f16
commit 7bfacf8ca6
3 changed files with 20 additions and 16 deletions

View File

@ -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();
}

View File

@ -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;

View File

@ -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;