Make occlusion boundingbox 'fudge' settings adjustable via SHOcclusionFudge saved setting.

This commit is contained in:
Shyotl
2012-11-09 18:20:45 -06:00
parent 81c7445744
commit 9aca1f41f3
2 changed files with 21 additions and 8 deletions

View File

@@ -195,6 +195,17 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SHOcclusionFudge</key>
<map>
<key>Comment</key>
<string>Padding added to occlusion bounds. Larger = less aggressive occlusion/less pop-in.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<integer>.25</integer>
</map>
</map>
</llsd>

View File

@@ -1567,7 +1567,7 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
// Don't cull hole/edge water, unless RenderWaterVoidCulling is set and we have the GL_ARB_depth_clamp extension.
//if ((mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER && !gGLManager.mHasDepthClamp) ||
// earlyFail(camera, this))
if (earlyFail(camera, this))
if (earlyFail(camera, this)) //Returns true if camera is inside this spatial group.
{
LLFastTimer t(FTM_OCCLUSION_EARLY_FAIL);
setOcclusionState(LLSpatialGroup::DISCARD_QUERY);
@@ -1622,9 +1622,12 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
llassert(shader);
shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, mBounds[0].getF32ptr());
shader->uniform3f(LLShaderMgr::BOX_SIZE, mBounds[1][0]+SG_OCCLUSION_FUDGE,
mBounds[1][1]+SG_OCCLUSION_FUDGE,
mBounds[1][2]+SG_OCCLUSION_FUDGE);
//static LLVector4a fudge(SG_OCCLUSION_FUDGE);
static LLCachedControl<F32> vel("SHOcclusionFudge",SG_OCCLUSION_FUDGE);
LLVector4a fudge(SG_OCCLUSION_FUDGE);
static LLVector4a bounds;
bounds.setAdd(fudge,mBounds[1]);
shader->uniform3fv(LLShaderMgr::BOX_SIZE, 1, bounds.getF32ptr());
if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER)
{
@@ -2323,12 +2326,11 @@ BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group)
return FALSE;
}
const F32 vel = SG_OCCLUSION_FUDGE*2.f;
LLVector4a fudge;
fudge.splat(vel);
static LLCachedControl<F32> vel("SHOcclusionFudge",SG_OCCLUSION_FUDGE);
LLVector4a fudge(vel*2.f);
const LLVector4a& c = group->mBounds[0];
LLVector4a r;
static LLVector4a r;
r.setAdd(group->mBounds[1], fudge);
/*if (r.magVecSquared() > 1024.0*1024.0)