summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml2
-rw-r--r--indra/newview/llheroprobemanager.cpp65
-rw-r--r--indra/newview/llheroprobemanager.h7
-rw-r--r--indra/newview/llpanelvolume.cpp29
-rw-r--r--indra/newview/llpanelvolume.h4
-rw-r--r--indra/newview/llviewerobject.cpp46
-rw-r--r--indra/newview/llviewerobject.h5
-rw-r--r--indra/newview/llvovolume.cpp91
-rw-r--r--indra/newview/llvovolume.h9
9 files changed, 57 insertions, 201 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f2ba4ba29e..ef51c7f0dc 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10421,7 +10421,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <integer>2048</integer>
+ <integer>1024</integer>
</map>
<key>RenderHeroProbeDistance</key>
<map>
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 39f5bdec5a..c9728b8d93 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -127,38 +127,22 @@ void LLHeroProbeManager::update()
else
{
// Valid drawables only please. Unregister this one.
- unregisterHeroDrawable(vo);
+ unregisterViewerObject(vo);
}
}
else
{
- unregisterHeroDrawable(vo);
+ unregisterViewerObject(vo);
}
}
if (mNearestHero != nullptr && mNearestHero->mDrawable.notNull())
{
- U8 mode = mNearestHero->mirrorFace();
- mode = llmin(mNearestHero->mDrawable->getNumFaces() - 1, mode);
-
- mCurrentFace = mNearestHero->mDrawable->getFace(mode);
- LLVector3 hero_pos = mCurrentFace->getPositionAgent();
-
-
- // Calculate the average normal.
- LLVector4a *posp = mCurrentFace->getViewerObject()->getVolume()->getVolumeFace(mCurrentFace->getTEOffset()).mPositions;
- U16 *indp = mCurrentFace->getViewerObject()->getVolume()->getVolumeFace(mCurrentFace->getTEOffset()).mIndices;
- // get first three vertices (first triangle)
- LLVector4a v0 = posp[indp[0]];
- LLVector4a v1 = posp[indp[1]];
- LLVector4a v2 = posp[indp[2]];
-
- v1.sub(v0);
- v2.sub(v0);
- LLVector3 face_normal = LLVector3(v1[0], v1[1], v1[2]) % LLVector3(v2[0], v2[1], v2[2]);
+ LLVector3 hero_pos = mNearestHero->getPositionAgent();
+ LLVector3 face_normal = LLVector3(0, 0, 1);
+ face_normal *= mNearestHero->mDrawable->getXform()->getWorldRotation();
face_normal.normalize();
- face_normal *= mCurrentFace->getXform()->getWorldRotation();
LLVector3 offset = camera_pos - hero_pos;
LLVector3 project = face_normal * (offset * face_normal);
@@ -166,7 +150,7 @@ void LLHeroProbeManager::update()
LLVector3 point = (reject - project) + hero_pos;
mCurrentClipPlane.setVec(hero_pos, face_normal);
- mMirrorPosition = mNearestHero->getPositionAgent();
+ mMirrorPosition = hero_pos;
mMirrorNormal = face_normal;
@@ -254,6 +238,30 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
LLRenderTarget *screen_rt = &gPipeline.mHeroProbeRT.screen;
LLRenderTarget *depth_rt = &gPipeline.mHeroProbeRT.deferredScreen;
+
+ // perform a gaussian blur on the super sampled render before downsampling
+ {
+ gGaussianProgram.bind();
+ gGaussianProgram.uniform1f(resScale, 1.f / (mProbeResolution * 2));
+ S32 diffuseChannel = gGaussianProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_TEXTURE);
+
+ // horizontal
+ gGaussianProgram.uniform2f(direction, 1.f, 0.f);
+ gGL.getTexUnit(diffuseChannel)->bind(screen_rt);
+ mRenderTarget.bindTarget();
+ gPipeline.mScreenTriangleVB->setBuffer();
+ gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ mRenderTarget.flush();
+
+ // vertical
+ gGaussianProgram.uniform2f(direction, 0.f, 1.f);
+ gGL.getTexUnit(diffuseChannel)->bind(&mRenderTarget);
+ screen_rt->bindTarget();
+ gPipeline.mScreenTriangleVB->setBuffer();
+ gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ screen_rt->flush();
+ gGaussianProgram.unbind();
+ }
S32 mips = log2((F32)mProbeResolution) + 0.5f;
@@ -527,24 +535,21 @@ void LLHeroProbeManager::doOcclusion()
}
}
-void LLHeroProbeManager::registerHeroDrawable(LLVOVolume* drawablep)
+void LLHeroProbeManager::registerViewerObject(LLVOVolume* drawablep)
{
+ llassert(drawablep != nullptr);
+
if (mHeroVOList.find(drawablep) == mHeroVOList.end())
{
+ // Probe isn't in our list for consideration. Add it.
mHeroVOList.insert(drawablep);
- LL_INFOS() << "Mirror drawable registered." << LL_ENDL;
}
}
-void LLHeroProbeManager::unregisterHeroDrawable(LLVOVolume* drawablep)
+void LLHeroProbeManager::unregisterViewerObject(LLVOVolume* drawablep)
{
if (mHeroVOList.find(drawablep) != mHeroVOList.end())
{
mHeroVOList.erase(drawablep);
}
}
-
-bool LLHeroProbeManager::isViableMirror(LLFace* face) const
-{
- return face == mCurrentFace;
-}
diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h
index 0b32768bb1..7485a8cd72 100644
--- a/indra/newview/llheroprobemanager.h
+++ b/indra/newview/llheroprobemanager.h
@@ -68,10 +68,8 @@ public:
// perform occlusion culling on all active reflection probes
void doOcclusion();
- void registerHeroDrawable(LLVOVolume* drawablep);
- void unregisterHeroDrawable(LLVOVolume* drawablep);
-
- bool isViableMirror(LLFace* face) const;
+ void registerViewerObject(LLVOVolume *drawablep);
+ void unregisterViewerObject(LLVOVolume* drawablep);
bool isMirrorPass() const { return mRenderingMirror; }
@@ -140,6 +138,5 @@ private:
std::set<LLVOVolume*> mHeroVOList;
LLVOVolume* mNearestHero;
- LLFace* mCurrentFace;
};
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index c03f52d23f..e0d95c5386 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -114,11 +114,6 @@ BOOL LLPanelVolume::postBuild()
getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate);
}
- // Mirror Parameters
- {
- childSetCommitCallback("Mirror Checkbox Ctrl", onCommitIsMirror, this);
- }
-
// LIGHT Parameters
{
childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this);
@@ -309,10 +304,6 @@ void LLPanelVolume::getState( )
getChildView("select_single")->setVisible(true);
getChildView("select_single")->setEnabled(true);
}
-
- BOOL is_mirror = volobjp && volobjp->isMirror();
- getChild<LLUICtrl>("Mirror Checkbox Ctrl")->setValue(is_mirror);
- getChildView("Mirror Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp);
// Light properties
BOOL is_light = volobjp && volobjp->getIsLight();
@@ -774,20 +765,6 @@ void LLPanelVolume::sendIsLight()
LL_INFOS() << "update light sent" << LL_ENDL;
}
-void LLPanelVolume::sendIsMirror()
-{
- LLViewerObject* objectp = mObject;
- if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
- {
- return;
- }
- LLVOVolume *volobjp = (LLVOVolume *)objectp;
-
- BOOL value = getChild<LLUICtrl>("Mirror Checkbox Ctrl")->getValue();
- volobjp->setIsMirror(value);
- LL_INFOS() << "update mirror sent" << LL_ENDL;
-}
-
void notify_cant_select_reflection_probe()
{
if (!gSavedSettings.getBOOL("SelectReflectionProbes"))
@@ -1495,12 +1472,6 @@ void LLPanelVolume::onCommitIsLight( LLUICtrl* ctrl, void* userdata )
self->sendIsLight();
}
-void LLPanelVolume::onCommitIsMirror( LLUICtrl* ctrl, void* userdata )
-{
- LLPanelVolume* self = (LLPanelVolume*) userdata;
- self->sendIsMirror();
-}
-
// static
void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp)
{
diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h
index a658351624..aafefa918f 100644
--- a/indra/newview/llpanelvolume.h
+++ b/indra/newview/llpanelvolume.h
@@ -57,8 +57,7 @@ public:
void refresh();
void sendIsLight();
-
- void sendIsMirror();
+
// when an object is becoming a refleciton probe, present a dialog asking for confirmation
// otherwise, send the reflection probe update immediately
void sendIsReflectionProbe();
@@ -72,7 +71,6 @@ public:
static void onCommitIsLight( LLUICtrl* ctrl, void* userdata);
static void onCommitLight( LLUICtrl* ctrl, void* userdata);
- static void onCommitIsMirror( LLUICtrl* ctrl, void* userdata);
static void onCommitIsReflectionProbe(LLUICtrl* ctrl, void* userdata);
static void onCommitProbe(LLUICtrl* ctrl, void* userdata);
void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata);
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 691a2e14d3..d71814bd3f 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -313,9 +313,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mLastUpdateCached(FALSE),
mCachedMuteListUpdateTime(0),
mCachedOwnerInMuteList(false),
- mRiggedAttachedWarned(false),
- mIsMirror(false),
- mMirrorFace(3)
+ mRiggedAttachedWarned(false)
{
if (!is_global)
{
@@ -1149,39 +1147,6 @@ U32 LLViewerObject::extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector
return parent_id;
}
-void detectMirror(const std::string &str, bool &mirror, U8 &mode)
-{
-
- std::stringstream ss(str);
- std::string word;
- while (ss >> word)
- {
- if (word == "IsMirror")
- {
- mirror = true;
- }
-
- if (mirror)
- {
- bool num = false;
- std::string::const_iterator it = word.begin();
- while (it != word.end())
- {
- num = std::isdigit(*it);
- ++it;
-
- if (!num)
- break;
- }
-
- if (num)
- {
- mode = atoi(word.c_str());
- }
- }
- }
-}
-
U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
void **user_data,
U32 block_num,
@@ -1557,8 +1522,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
std::string temp_string;
mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, temp_string, block_num );
-
- detectMirror(temp_string, mIsMirror, mMirrorFace);
LLColor4U coloru;
mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextColor, coloru.mV, 4, block_num);
@@ -1946,8 +1909,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
std::string temp_string;
dp->unpackString(temp_string, "Text");
- detectMirror(temp_string, mIsMirror, mMirrorFace);
-
LLColor4U coloru;
dp->unpackBinaryDataFixed(coloru.mV, 4, "Color");
coloru.mV[3] = 255 - coloru.mV[3];
@@ -6328,11 +6289,6 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para
new_block = new LLReflectionProbeParams();
break;
}
- case LLNetworkData::PARAMS_MIRROR:
- {
- new_block = new LLMirrorParams();
- break;
- }
default:
{
LL_INFOS_ONCE() << "Unknown param type: " << param_type << LL_ENDL;
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index f3c00e83dc..80da7b2f73 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -257,8 +257,6 @@ public:
virtual BOOL isRiggedMesh() const { return FALSE; }
virtual BOOL hasLightTexture() const { return FALSE; }
virtual BOOL isReflectionProbe() const { return FALSE; }
- virtual BOOL isMirror() const { return FALSE; }
- virtual U8 mirrorFace() const { return 0; }
// This method returns true if the object is over land owned by
// the agent, one of its groups, or it encroaches and
@@ -880,9 +878,6 @@ protected:
F32 mPhysicsCost;
F32 mLinksetPhysicsCost;
- bool mIsMirror;
- U8 mMirrorFace;
-
// If true, "shrink wrap" this volume in its spatial partition. See "shrinkWrap"
bool mShouldShrinkWrap = false;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 77f654be23..54e0a0113d 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -249,9 +249,6 @@ LLVOVolume::~LLVOVolume()
mTextureAnimp = NULL;
delete mVolumeImpl;
mVolumeImpl = NULL;
-
- if (mIsMirror)
- gPipeline.mHeroProbeManager.unregisterHeroDrawable(this);
gMeshRepo.unregisterMesh(this);
@@ -1000,11 +997,6 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
updateReflectionProbePtr();
}
- if (isMirror())
- {
- gPipeline.mHeroProbeManager.registerHeroDrawable(this);
- }
-
updateRadius();
bool force_update = true; // avoid non-alpha mDistance update being optimized away
mDrawable->updateDistance(*LLViewerCamera::getInstance(), force_update);
@@ -3327,48 +3319,6 @@ F32 LLVOVolume::getLightCutoff() const
}
}
-bool LLVOVolume::setIsMirror(BOOL is_mirror)
-{
- BOOL was_mirror = isMirror();
- if (is_mirror != was_mirror)
- {
- if (is_mirror)
- {
- setParameterEntryInUse(LLNetworkData::PARAMS_MIRROR, TRUE, true);
- }
- else
- {
- setParameterEntryInUse(LLNetworkData::PARAMS_MIRROR, FALSE, true);
- }
- }
-
- updateMirrorDrawable();
-
- return was_mirror != is_mirror;
-}
-
-void LLVOVolume::updateMirrorDrawable()
-{
- if (isMirror())
- {
- gPipeline.mHeroProbeManager.registerHeroDrawable(this);
- }
- else
- {
- gPipeline.mHeroProbeManager.unregisterHeroDrawable(this);
- }
-}
-
-BOOL LLVOVolume::isMirror() const
-{
- return mIsMirror;
-}
-
-U8 LLVOVolume::mirrorFace() const
-{
- return mMirrorFace;
-}
-
BOOL LLVOVolume::isReflectionProbe() const
{
return getParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE);
@@ -3442,22 +3392,6 @@ bool LLVOVolume::setReflectionProbeIsBox(bool is_box)
return false;
}
-bool LLVOVolume::setReflectionProbeIsPlane(bool is_plane)
-{
- LLReflectionProbeParams *param_block = (LLReflectionProbeParams *) getParameterEntry(LLNetworkData::PARAMS_REFLECTION_PROBE);
- if (param_block)
- {
- if (param_block->getIsBox() != is_plane)
- {
- param_block->setIsBox(is_plane);
- parameterChanged(LLNetworkData::PARAMS_REFLECTION_PROBE, true);
- return true;
- }
- }
-
- return false;
-}
-
bool LLVOVolume::setReflectionProbeIsDynamic(bool is_dynamic)
{
LLReflectionProbeParams* param_block = (LLReflectionProbeParams*)getParameterEntry(LLNetworkData::PARAMS_REFLECTION_PROBE);
@@ -4463,25 +4397,34 @@ void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_u
}
updateReflectionProbePtr();
-
- if (isMirror())
- gPipeline.mHeroProbeManager.registerHeroDrawable(this);
- else
- gPipeline.mHeroProbeManager.unregisterHeroDrawable(this);
}
void LLVOVolume::updateReflectionProbePtr()
{
if (isReflectionProbe())
{
- if (mReflectionProbe.isNull())
+ if (mReflectionProbe.isNull() && !getReflectionProbeIsMirror())
{
mReflectionProbe = gPipeline.mReflectionMapManager.registerViewerObject(this);
}
+ else if (mReflectionProbe.isNull() && getReflectionProbeIsMirror())
+ {
+ // Geenz: This is a special case - what we want here is a hero probe.
+ // What we want to do here is instantiate a hero probe from the hero probe manager.
+ gPipeline.mHeroProbeManager.registerViewerObject(this);
+ }
}
- else if (mReflectionProbe.notNull())
+ else if (mReflectionProbe.notNull() || getReflectionProbeIsMirror())
{
- mReflectionProbe = nullptr;
+ if (mReflectionProbe.notNull())
+ {
+ mReflectionProbe = nullptr;
+ }
+
+ if (getReflectionProbeIsMirror())
+ {
+ gPipeline.mHeroProbeManager.unregisterViewerObject(this);
+ }
}
}
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 89ef1d7d7a..cac09609b3 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -294,18 +294,12 @@ public:
F32 getLightRadius() const;
F32 getLightFalloff(const F32 fudge_factor = 1.f) const;
F32 getLightCutoff() const;
-
- // Mirrors
- bool setIsMirror(BOOL is_mirror);
- void updateMirrorDrawable();
- U8 mirrorFace() const override;
// Reflection Probes
bool setIsReflectionProbe(BOOL is_probe);
bool setReflectionProbeAmbiance(F32 ambiance);
bool setReflectionProbeNearClip(F32 near_clip);
bool setReflectionProbeIsBox(bool is_box);
- bool setReflectionProbeIsPlane(bool is_plane);
bool setReflectionProbeIsDynamic(bool is_dynamic);
bool setReflectionProbeIsMirror(bool is_mirror);
@@ -313,11 +307,8 @@ public:
F32 getReflectionProbeAmbiance() const;
F32 getReflectionProbeNearClip() const;
bool getReflectionProbeIsBox() const;
- bool getReflectionProbeIsPlane() const;
bool getReflectionProbeIsDynamic() const;
bool getReflectionProbeIsMirror() const;
-
- BOOL isMirror() const override;
// Flexible Objects
U32 getVolumeInterfaceID() const;