diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2024-02-26 00:30:44 -0800 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2024-02-26 00:30:44 -0800 |
commit | 1b8523a7b6293db89b16ca8e08330969cf1d9166 (patch) | |
tree | 0e74924701e16afaf4be79dbde50dedce4e9e9bb /indra/newview | |
parent | 2ba5449b8b888b64ed87ef801426f7eab6e0be95 (diff) |
#890 Make sure we're doing the correct distance check.
#682 Improve the conservative update functionality for mirror faces. Make it attenuate depending on how much the camera is facing that specific cubemap face.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llheroprobemanager.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llheroprobemanager.h | 2 |
2 files changed, 13 insertions, 18 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index feb81394cf..3adf460432 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -114,7 +114,7 @@ void LLHeroProbeManager::update() for (auto vo : mHeroVOList) { - if (vo && (!vo->isDead() || vo != nullptr)) + if (vo && !vo->isDead() && vo->mDrawable.notNull()) { float distance = (LLViewerCamera::instance().getOrigin() - vo->getPositionAgent()).magVec(); if (distance < last_distance) @@ -129,12 +129,12 @@ void LLHeroProbeManager::update() } } - if (mNearestHero != nullptr && !mNearestHero->isDead()) + if (mNearestHero != nullptr && !mNearestHero->isDead() && mNearestHero->mDrawable.notNull()) { LLVector3 hero_pos = mNearestHero->getPositionAgent(); LLVector3 face_normal = LLVector3(0, 0, 1); - - face_normal *= mNearestHero->getWorldRotation(); + + face_normal *= mNearestHero->mDrawable->getWorldRotation(); face_normal.normalize(); LLVector3 offset = camera_pos - hero_pos; @@ -150,7 +150,7 @@ void LLHeroProbeManager::update() probe_pos.load3(point.mV); // Collect the list of faces that need updating based upon the camera's rotation. - LLVector3 cam_direction = LLVector3(-1, -1, -1) * LLViewerCamera::instance().getQuaternion(); + LLVector3 cam_direction = LLVector3(0, 0, 1) * LLViewerCamera::instance().getQuaternion(); static LLVector3 cubeFaces[6] = { LLVector3(1, 0, 0), @@ -163,9 +163,11 @@ void LLHeroProbeManager::update() for (int i = 0; i < 6; i++) { - bool shouldUpdate = (cam_direction * cubeFaces[i]) > 0; - - mFaceUpdateList[i] = shouldUpdate; + float shouldUpdate = cam_direction * cubeFaces[i] * 0.5 + 0.5; + + int updateRate = fmaxf(1, (1 - shouldUpdate) * 8); + + mFaceUpdateList[i] = updateRate; } } else @@ -197,17 +199,10 @@ void LLHeroProbeManager::update() { for (U32 i = 0; i < 6; ++i) { - if (mFaceUpdateList[i]) + if (mFaceUpdateList[i] > 0 && mCurrentProbeUpdateFrame % mFaceUpdateList[i] == 0) { updateProbeFace(mProbes[j], i, near_clip); - } - else - { - if (mLowPriorityFaceThrottle > 0 && mCurrentProbeUpdateFrame % mLowPriorityFaceThrottle == 0) - { - updateProbeFace(mProbes[j], i, near_clip); - mCurrentProbeUpdateFrame = 0; - } + mCurrentProbeUpdateFrame = 0; } } generateRadiance(mProbes[j]); diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h index b1907ef185..038a8fd45a 100644 --- a/indra/newview/llheroprobemanager.h +++ b/indra/newview/llheroprobemanager.h @@ -135,7 +135,7 @@ private: bool mReset = false; bool mRenderingMirror = false; - std::map<int, bool> mFaceUpdateList; + std::map<int, int> mFaceUpdateList; U32 mCurrentProbeUpdateFrame = 0; U32 mLowPriorityFaceThrottle = 2; |