more fix for SH-4397: Object cache occlusion culling results are not always correct

master
Xiaohong Bao 2013-08-07 22:53:27 -06:00
parent f6a342438c
commit a2c7b04855
7 changed files with 15 additions and 15 deletions

View File

@ -1476,7 +1476,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result
return 0;
}
S32 LLSpatialPartition::cull(LLCamera &camera)
S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion)
{
#if LL_OCTREE_PARANOIA_CHECK
((LLSpatialGroup*)mOctree->getListener(0))->checkStates();

View File

@ -422,7 +422,7 @@ public:
virtual void rebuildMesh(LLSpatialGroup* group);
BOOL visibleObjectsInFrustum(LLCamera& camera);
/*virtual*/ S32 cull(LLCamera &camera); // Cull on arbitrary frustum
/*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum
S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select); // Cull on arbitrary frustum
BOOL isVisible(const LLVector3& v);

View File

@ -357,7 +357,7 @@ public:
virtual ~LLViewerOctreePartition();
// Cull on arbitrary frustum
virtual S32 cull(LLCamera &camera) = 0;
virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0;
BOOL isOcclusionEnabled();
public:

View File

@ -1204,13 +1204,8 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time)
{
throttle = -1; //cancel the throttling
S32 occlusion = LLPipeline::sUseOcclusion;
LLPipeline::sUseOcclusion = 0; //disable occlusion
//apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment
mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance());
LLPipeline::sUseOcclusion = occlusion;
mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance(), false);
}
else if(throttle < 0) //just recoved from the login/teleport screen
{

View File

@ -495,7 +495,7 @@ public:
mPartition(part)
{
mLocalShift = shift;
mUseObjectCacheOcclusion = (use_object_cache_occlusion && LLPipeline::sUseOcclusion);
mUseObjectCacheOcclusion = use_object_cache_occlusion;
}
virtual bool earlyFail(LLviewerOctreeGroup* base_group)
@ -586,10 +586,10 @@ private:
bool mUseObjectCacheOcclusion;
};
S32 LLVOCachePartition::cull(LLCamera &camera)
S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
{
static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
if(!LLViewerRegion::sVOCacheCullingEnabled)
{
return 0;
@ -601,7 +601,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera)
LLVector3 region_agent = mRegionp->getOriginAgent();
camera.calcRegionFrustumPlanes(region_agent);
LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, use_object_cache_occlusion, this);
LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, this);
culler.traverse(mOctree);
return 0;

View File

@ -159,7 +159,7 @@ public:
void addEntry(LLViewerOctreeEntry* entry);
void removeEntry(LLViewerOctreeEntry* entry);
/*virtual*/ S32 cull(LLCamera &camera);
/*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion);
void addOccluders(LLviewerOctreeGroup* gp);
void resetOccluders();

View File

@ -2408,6 +2408,11 @@ static LLFastTimer::DeclareTimer FTM_CULL("Object Culling");
void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep)
{
static LLCachedControl<bool> use_occlusion(gSavedSettings,"UseOcclusion");
static bool can_use_occlusion = LLGLSLShader::sNoFixedFunction
&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
&& gGLManager.mHasOcclusionQuery;
LLFastTimer t(FTM_CULL);
grabReferences(result);
@ -2530,7 +2535,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
LLVOCachePartition* vo_part = region->getVOCachePartition();
if(vo_part)
{
vo_part->cull(camera);
vo_part->cull(camera, can_use_occlusion && use_occlusion && !gUseWireframe);
}
}