summaryrefslogtreecommitdiff
path: root/indra/newview/llheroprobemanager.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-29 03:04:04 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-29 03:04:04 -0700
commitfbecd348f897ee91a5639e7e9fe4f0578d72b8e2 (patch)
tree23fb72ddb17416e1b5750e92383bac2a8b893305 /indra/newview/llheroprobemanager.cpp
parent316052024958dde817a8d0809c77e29ec4cef64c (diff)
Add protocol level mirror support, and UI.
Diffstat (limited to 'indra/newview/llheroprobemanager.cpp')
-rw-r--r--indra/newview/llheroprobemanager.cpp87
1 files changed, 53 insertions, 34 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 729603e960..6374b10823 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -103,53 +103,71 @@ void LLHeroProbeManager::update()
llassert(mProbes[0] == mDefaultProbe);
- LLVector3 camera_pos = LLViewerCamera::instance().getOrigin();
-
LLVector4a probe_pos;
- LLVector3 focus_point;
-
- 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)
+ if (mHeroList.empty())
+ {
+ LLVector3 focus_point;
+
+ 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 (focus_point.isExactlyZero())
{
- LLFace* face = obj->mDrawable->getFace(face_idx);
- if (face)
+ 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
{
- focus_point = face->getPositionAgent();
+ // focus on alt-zoom target
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ }
}
}
+
+ probe_pos.load3(((focus_point)).mV);
}
-
- if (focus_point.isExactlyZero())
+ else
{
- 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
+ // Get the nearest hero.
+ float distance = F32_MAX;
+
+ for (auto drawable : mHeroList)
{
- // focus on alt-zoom target
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
+ if (drawable.notNull())
{
- focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ if (drawable->mDistanceWRTCamera < distance)
+ {
+ probe_pos.load3(drawable->mXform.getPosition().mV);
+ }
}
}
}
- probe_pos.load3(((focus_point + camera_pos) / 2).mV);
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1);
static LLCachedControl<S32> sLevel(gSavedSettings, "RenderHeroReflectionProbeLevel", 3);
@@ -464,7 +482,7 @@ void LLHeroProbeManager::initReflectionMaps()
mDefaultProbe->mCubeIndex = 0;
mDefaultProbe->mCubeArray = mTexture;
- mDefaultProbe->mDistance = 64.f;
+ mDefaultProbe->mDistance = 12.f;
mDefaultProbe->mRadius = 4096.f;
mDefaultProbe->mProbeIndex = 0;
touch_default_probe(mDefaultProbe);
@@ -536,6 +554,7 @@ void LLHeroProbeManager::registerHeroDrawable(LLDrawable* drawablep)
if (mHeroList.find(drawablep) == mHeroList.end())
{
mHeroList.insert(drawablep);
+ LL_INFOS() << "Added hero drawable." << LL_ENDL;
}
}