summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-21 07:59:06 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-21 07:59:06 -0700
commit0eba1396dcc7ec5c32124dbfd48abb75c1a5b524 (patch)
treed71800d411b7c8b109cef085edcd1d5760ad51e3 /indra/newview
parent869bb7f16ae3e931f11840332ab00715a4ef27af (diff)
Experiment with placement a bit when there's no drawable.
DRTVWR-583
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl5
-rw-r--r--indra/newview/llheroprobemanager.cpp80
-rw-r--r--indra/newview/llheroprobemanager.h10
-rw-r--r--indra/newview/llvovolume.cpp7
-rw-r--r--indra/newview/pipeline.cpp22
-rw-r--r--indra/newview/pipeline.h5
6 files changed, 88 insertions, 41 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index e485c26e9b..742b52b074 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -213,13 +213,14 @@ void main()
vec3 v = -normalize(pos.xyz);
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
+ vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
+ color = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0 - gloss) * 11).xyz * specularColor;
+
if (do_atmospherics)
{
color = atmosFragLightingLinear(color, additive, atten);
}
- vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
- color = texture(heroProbes, vec4(env_mat * refnormpersp, 0), 0).xyz;
}
else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS))
{
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 33a54c797e..0d2e8da294 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -36,6 +36,11 @@
#include "llviewercontrol.h"
#include "llenvironment.h"
#include "llstartup.h"
+#include "llagent.h"
+#include "llagentcamera.h"
+#include "llviewerwindow.h"
+#include "llviewerjoystick.h"
+#include "llviewermediafocus.h"
extern BOOL gCubeSnapshot;
extern BOOL gTeleportDisplay;
@@ -98,16 +103,60 @@ void LLHeroProbeManager::update()
llassert(mProbes[0] == mDefaultProbe);
- LLVector4a camera_pos;
- camera_pos.load3(LLViewerCamera::instance().getOrigin().mV);
+ 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)
+ {
+ LLFace* face = obj->mDrawable->getFace(face_idx);
+ if (face)
+ {
+ focus_point = face->getPositionAgent();
+ }
+ }
+ }
+
+ if (focus_point.isExactlyZero())
+ {
+ 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 on alt-zoom target
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ }
+ }
+ }
+
+ probe_pos.load3(((focus_point + camera_pos) / 2).mV);
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1);
static LLCachedControl<S32> sLevel(gSavedSettings, "RenderHeroReflectionProbeLevel", 3);
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("rmmu - realtime");
- // Probe 0 is always our mirror probe. Probe N - 1 is our water probe.
- mProbes[0]->mOrigin.load3(LLViewerCamera::instance().mOrigin.mV);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("hpmu - realtime");
+ // Probe 0 is always our mirror probe.
+ mProbes[0]->mOrigin = probe_pos;
for (U32 j = 0; j < mProbes.size(); j++)
{
for (U32 i = 0; i < 6; ++i)
@@ -131,8 +180,6 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face)
// hacky hot-swap of camera specific render targets
gPipeline.mRT = &gPipeline.mAuxillaryRT;
- mLightScale = 1.f;
-
probe->update(mRenderTarget.getWidth(), face);
gPipeline.mRT = &gPipeline.mMainRT;
@@ -458,6 +505,9 @@ void LLHeroProbeManager::cleanup()
glDeleteBuffers(1, &mUBO);
mUBO = 0;
+
+ mHeroList.clear();
+ mNearestHero = nullptr;
}
void LLHeroProbeManager::doOcclusion()
@@ -473,3 +523,19 @@ void LLHeroProbeManager::doOcclusion()
}
}
}
+
+void LLHeroProbeManager::registerHeroDrawable(LLDrawable* drawablep)
+{
+ if (mHeroList.find(drawablep) == mHeroList.end())
+ {
+ mHeroList.insert(drawablep);
+ }
+}
+
+void LLHeroProbeManager::unregisterHeroDrawable(LLDrawable *drawablep)
+{
+ if (mHeroList.find(drawablep) != mHeroList.end())
+ {
+ mHeroList.erase(drawablep);
+ }
+}
diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h
index 95e3963d1a..c6df963cfd 100644
--- a/indra/newview/llheroprobemanager.h
+++ b/indra/newview/llheroprobemanager.h
@@ -30,6 +30,7 @@
#include "llrendertarget.h"
#include "llcubemaparray.h"
#include "llcubemap.h"
+#include "lldrawable.h"
class LLSpatialGroup;
class LLViewerObject;
@@ -67,6 +68,9 @@ public:
// perform occlusion culling on all active reflection probes
void doOcclusion();
+ void registerHeroDrawable(LLDrawable* drawablep);
+ void unregisterHeroDrawable(LLDrawable* drawablep);
+
private:
friend class LLPipeline;
@@ -118,10 +122,10 @@ private:
// maximum LoD of reflection probes (mip levels - 1)
F32 mMaxProbeLOD = 6.f;
- // amount to scale local lights during an irradiance map update (set during updateProbeFace and used by LLPipeline)
- F32 mLightScale = 1.f;
-
// if true, reset all probe render state on the next update (for teleports and sky changes)
bool mReset = false;
+
+ LLDrawable::ordered_drawable_set_t mHeroList;
+ LLDrawable* mNearestHero;
};
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 254e945243..2589beefe9 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1045,7 +1045,7 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
updateReflectionProbePtr();
}
- gPipeline.setMirror(mDrawable, isMirror());
+ gPipeline.mHeroProbeManager.registerHeroDrawable(mDrawable);
updateRadius();
bool force_update = true; // avoid non-alpha mDistance update being optimized away
@@ -4454,7 +4454,10 @@ void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_u
updateReflectionProbePtr();
- gPipeline.setMirror(mDrawable, isMirror());
+ if (isMirror())
+ gPipeline.mHeroProbeManager.registerHeroDrawable(mDrawable);
+ else
+ gPipeline.mHeroProbeManager.unregisterHeroDrawable(mDrawable);
}
void LLVOVolume::updateReflectionProbePtr()
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 4c951a9dea..792cad02bd 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2783,23 +2783,6 @@ void LLPipeline::markShift(LLDrawable *drawablep)
}
}
-void LLPipeline::setMirror(LLDrawable *drawablep, bool is_mirror)
-{
- if (drawablep && assertInitialized())
- {
- if (is_mirror)
- {
- drawablep->setState(LLDrawable::MIRROR);
- mMirrorList.insert(drawablep);
- }
- else
- {
- mMirrorList.erase(drawablep);
- drawablep->clearState(LLDrawable::MIRROR);
- }
- }
-}
-
void LLPipeline::shiftObjects(const LLVector3 &offset)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
@@ -5852,11 +5835,6 @@ void LLPipeline::findReferences(LLDrawable *drawablep)
{
LL_INFOS() << "In mRetexturedList" << LL_ENDL;
}
-
- if (std::find(mMirrorList.begin(), mMirrorList.end(), drawablep) != mMirrorList.end())
- {
- LL_INFOS() << "In mMirrorList" << LL_ENDL;
- }
if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end())
{
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index bfb9b95f4d..1361441844 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -358,7 +358,6 @@ public:
void shiftObjects(const LLVector3 &offset);
void setLight(LLDrawable *drawablep, bool is_light);
- void setMirror(LLDrawable *drawablep, bool is_mirror);
bool hasRenderBatches(const U32 type) const;
LLCullResult::drawinfo_iterator beginRenderMap(U32 type);
@@ -821,10 +820,6 @@ protected:
LLDrawable::ordered_drawable_set_t mLights;
light_set_t mNearbyLights; // lights near camera
LLColor4 mHWLightColors[8];
-
-
- LLDrawable::ordered_drawable_set_t mMirrorList;
- LLDrawable* mNearestMirror;
/////////////////////////////////////////////
//