summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-10-06 06:21:53 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-10-06 06:21:53 -0700
commite612d70fad8c6ec9335c109223211d516ebdf6f4 (patch)
tree1b68a13859d6236226f8e0fc418d2958927cfa10
parent1d3d94a514a74b41f1fafaef45e105774d5d8505 (diff)
Fix for probe stealing, and also make sure we're not super sampling.
DRTVWR-583
-rw-r--r--indra/newview/llheroprobemanager.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 15b54ec6bc..91d5f9b800 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -108,6 +108,34 @@ void LLHeroProbeManager::update()
F32 near_clip = 0.1f;
if (mHeroVOList.size() > 0)
{
+ // Find our nearest hero candidate.
+
+ float last_distance = 99999.f;
+
+ for (auto vo : mHeroVOList)
+ {
+ if (vo)
+ {
+ if (vo->mDrawable.notNull())
+ {
+ if (vo->mDrawable->mDistanceWRTCamera < last_distance)
+ {
+ mNearestHero = vo;
+ last_distance = vo->mDrawable->mDistanceWRTCamera;
+ }
+ }
+ else
+ {
+ // Valid drawables only please. Unregister this one.
+ unregisterHeroDrawable(vo);
+ }
+ }
+ else
+ {
+ unregisterHeroDrawable(vo);
+ }
+ }
+
if (mNearestHero != nullptr && mNearestHero->mDrawable.notNull())
{
U8 mode = mNearestHero->mirrorPlacementMode();
@@ -226,7 +254,7 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
// perform a gaussian blur on the super sampled render before downsampling
{
gGaussianProgram.bind();
- gGaussianProgram.uniform1f(resScale, 1.f / (mProbeResolution * 2));
+ gGaussianProgram.uniform1f(resScale, 1.f / mProbeResolution);
S32 diffuseChannel = gGaussianProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_TEXTURE);
// horizontal
@@ -521,12 +549,11 @@ void LLHeroProbeManager::doOcclusion()
void LLHeroProbeManager::registerHeroDrawable(LLVOVolume* drawablep)
{
- mNearestHero = drawablep;
- if (mHeroVOList.find(drawablep) == mHeroVOList.end())
- {
- mHeroVOList.insert(drawablep);
- LL_INFOS() << "Mirror drawable registered." << LL_ENDL;
- }
+ if (mHeroVOList.find(drawablep) == mHeroVOList.end())
+ {
+ mHeroVOList.insert(drawablep);
+ LL_INFOS() << "Mirror drawable registered." << LL_ENDL;
+ }
}
void LLHeroProbeManager::unregisterHeroDrawable(LLVOVolume* drawablep)