summaryrefslogtreecommitdiff
path: root/indra/newview/llheroprobemanager.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-29 05:08:47 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-29 05:08:47 -0700
commit348d427db6537746c5c8c9a0d1aa021f074afbb5 (patch)
treee2782a5638bd489d30dcd0bb1fd507e575cc1fe2 /indra/newview/llheroprobemanager.cpp
parentc5bfe869154cd4708c9bca63f08cb4c958198638 (diff)
Add a probe strength uniform for hero probes.
On standard reflection probes this doesn't really do anything. DRTVWR-583
Diffstat (limited to 'indra/newview/llheroprobemanager.cpp')
-rw-r--r--indra/newview/llheroprobemanager.cpp73
1 files changed, 23 insertions, 50 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 6374b10823..c385c9a99f 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -104,68 +104,41 @@ void LLHeroProbeManager::update()
llassert(mProbes[0] == mDefaultProbe);
LLVector4a probe_pos;
-
- if (mHeroList.empty())
+ LLVector3 camera_pos = LLViewerCamera::instance().mOrigin;
{
- LLVector3 focus_point;
+ // Get the nearest hero.
+ float distance = F32_MAX;
- LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
- if (obj && obj->mDrawable && obj->isSelected())
- { // focus on selected media object
- S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
- if (obj && obj->mDrawable)
- {
- LLFace* face = obj->mDrawable->getFace(face_idx);
- if (face)
- {
- focus_point = face->getPositionAgent();
- }
- }
+ if (mNearestHero.notNull())
+ {
+ distance = mNearestHero->mDistanceWRTCamera;
}
- if (focus_point.isExactlyZero())
+ for (auto drawable : mHeroList)
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- { // focus on point under cursor
- focus_point.set(gDebugRaycastIntersection.getF32ptr());
- }
- else if (gAgentCamera.cameraMouselook())
- { // focus on point under mouselook crosshairs
- LLVector4a result;
- result.clear();
-
- gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, NULL, &result);
-
- focus_point.set(result.getF32ptr());
- }
- else
+ if (drawable.notNull() && drawable != mNearestHero)
{
- // focus on alt-zoom target
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
+ if (drawable->mDistanceWRTCamera < distance)
{
- focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ mIsInTransition = true;
+ mNearestHero = drawable;
}
}
}
-
- probe_pos.load3(((focus_point)).mV);
+ }
+
+ if (mIsInTransition && mHeroProbeStrength > 0.f)
+ {
+ mHeroProbeStrength -= 0.05f;
}
else
{
- // Get the nearest hero.
- float distance = F32_MAX;
+ if (mNearestHero.notNull())
+ probe_pos.set(mNearestHero->mXform.getPosition().mV[0], mNearestHero->mXform.getPosition().mV[1], camera_pos.mV[2]);
- for (auto drawable : mHeroList)
- {
- if (drawable.notNull())
- {
- if (drawable->mDistanceWRTCamera < distance)
- {
- probe_pos.load3(drawable->mXform.getPosition().mV);
- }
- }
- }
+
+ if (mHeroProbeStrength < 1.f)
+ mHeroProbeStrength += 0.05f;
}
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1);
@@ -328,7 +301,8 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face)
mTexture->bind(channel);
gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
-
+ gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, mHeroProbeStrength);
+
U32 res = mMipChain[0].getWidth();
for (int i = 0; i < mMipChain.size(); ++i)
@@ -554,7 +528,6 @@ void LLHeroProbeManager::registerHeroDrawable(LLDrawable* drawablep)
if (mHeroList.find(drawablep) == mHeroList.end())
{
mHeroList.insert(drawablep);
- LL_INFOS() << "Added hero drawable." << LL_ENDL;
}
}