Merge branch 'rlva/development'

master
Kitty Barnett 2021-06-08 20:10:50 +02:00
commit 4b3ddda5b0
14 changed files with 338 additions and 164 deletions

View File

@ -79,6 +79,7 @@
#include "llslurl.h"
#include "llstartup.h"
// [RLVa:KB] - Checked: 2015-12-27 (RLVa-1.5.0)
#include "llvisualeffect.h"
#include "rlvactions.h"
#include "rlvcommon.h"
// [/RLVa:KB]
@ -216,15 +217,15 @@ static bool handleAvatarHoverOffsetChanged(const LLSD& newvalue)
bool handleSetShaderChanged(const LLSD& newvalue)
// </FS:Ansariel>
{
// [RLVa:KB] - @setenv
if ( (!RlvActions::canChangeEnvironment()) && (LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) && (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")) )
// [RLVa:KB] - @setenv and @setsphere
if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canChangeEnvironment() || (LLVfxManager::instance().hasEffect(EVisualEffect::RlvSphere))) &&
(LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"))&& (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")) )
{
gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE);
return true;
}
// [/RLVa:KB]
// changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache
gBumpImageList.destroyGL();
gBumpImageList.restoreGL();
@ -521,21 +522,9 @@ static bool handleRenderLocalLightsChanged(const LLSD& newvalue)
return true;
}
// [RLVa:KB] - @setsphere
static bool handleWindLightAtmosShadersChanged(const LLSD& newvalue)
{
LLRenderTarget::sUseFBO = newvalue.asBoolean() && LLPipeline::sUseDepthTexture;
handleSetShaderChanged(LLSD());
return true;
}
// [/RLVa:KB]
static bool handleRenderDeferredChanged(const LLSD& newvalue)
{
// LLRenderTarget::sUseFBO = newvalue.asBoolean();
// [RLVa:KB] - @setsphere
LLRenderTarget::sUseFBO = newvalue.asBoolean() || (gSavedSettings.getBOOL("WindLightUseAtmosShaders") && LLPipeline::sUseDepthTexture);
// [/RLVa:KB]
LLRenderTarget::sUseFBO = newvalue.asBoolean();
if (gPipeline.isInit())
{
LLPipeline::refreshCachedSettings();
@ -557,10 +546,7 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue)
//
static bool handleRenderBumpChanged(const LLSD& newval)
{
// LLRenderTarget::sUseFBO = newval.asBoolean();
// [RLVa:KB] - @setsphere
LLRenderTarget::sUseFBO = newval.asBoolean() || (gSavedSettings.getBOOL("WindLightUseAtmosShaders") && LLPipeline::sUseDepthTexture);
// [/RLVa:KB]
LLRenderTarget::sUseFBO = newval.asBoolean();
if (gPipeline.isInit())
{
gPipeline.updateRenderBump();
@ -1099,10 +1085,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
// gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
// [RLVa:KB] - @setsphere
gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleWindLightAtmosShadersChanged, _2));
// [/RLVa:KB]
gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2));
gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2));

View File

@ -7199,10 +7199,15 @@ void LLPickInfo::fetchResults()
// [RLVa:KB] - Checked: RLVa-2.2 (@setoverlay)
if ( (RlvActions::hasBehaviour(RLV_BHVR_SETOVERLAY)) && (hit_object) && (!hit_object->isHUDAttachment()) )
{
if (auto* pOverlayEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(EVisualEffect::RlvOverlay))
std::list<LLVisualEffect*> effects;
LLVfxManager::instance().getEffects<RlvOverlayEffect>(effects);
for (const LLVisualEffect* pEffect : effects)
{
if (pOverlayEffect->hitTest(mMousePt))
if (pEffect->getEnabled() && static_cast<const RlvOverlayEffect*>(pEffect)->hitTest(mMousePt))
{
hit_object = nullptr;
break;
}
}
}
// [/RLVa:KB]

View File

@ -70,35 +70,43 @@ LLVector4 LLTweenableValueLerp<LLVector4>::get()
LLVfxManager::LLVfxManager()
{
}
bool LLVfxManager::addEffect(LLVisualEffect* pEffectInst)
{
if (m_Effects.end() != m_Effects.find(pEffectInst))
// Effect IDs can be reused across effects but should be unique for all effect instances sharing the same effect code
auto itEffect = std::find_if(m_Effects.begin(), m_Effects.end(), [pEffectInst](const LLVisualEffect* pEffect) { return pEffect->getCode() == pEffectInst->getCode() && pEffect->getId() == pEffectInst->getId(); });
llassert(m_Effects.end() == itEffect);
if (m_Effects.end() != itEffect)
return false;
m_Effects.insert(pEffectInst);
m_Effects.insert(std::upper_bound(m_Effects.begin(), m_Effects.end(), pEffectInst, cmpEffect), pEffectInst);
return true;
}
LLVisualEffect* LLVfxManager::getEffect(const LLUUID& idEffect) const
LLVisualEffect* LLVfxManager::getEffect(EVisualEffect eCode, const LLUUID& idEffect) const
{
auto itEffect = std::find_if(m_Effects.begin(), m_Effects.end(), [&idEffect](const LLVisualEffect* pEffect) { return pEffect->getId() == idEffect; });
auto itEffect = std::find_if(m_Effects.begin(), m_Effects.end(), [eCode, &idEffect](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode && pEffect->getId() == idEffect; });
return (m_Effects.end() != itEffect) ? *itEffect : nullptr;
}
LLVisualEffect* LLVfxManager::getEffect(EVisualEffect eCode) const
bool LLVfxManager::getEffects(std::list<LLVisualEffect*>& effectList, std::function<bool(const LLVisualEffect*)> fnFilter)
{
// NOTE: returns the first found but there could be more
auto itEffect = std::find_if(m_Effects.begin(), m_Effects.end(), [eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; });
return (m_Effects.end() != itEffect) ? *itEffect : nullptr;
effectList.clear();
auto itEffect = boost::make_filter_iterator(fnFilter, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(fnFilter, m_Effects.end(), m_Effects.end());
while (itEffect != endEffect)
{
effectList.push_back(*itEffect++);
}
return effectList.size();
}
bool LLVfxManager::removeEffect(const LLUUID& idEffect)
bool LLVfxManager::removeEffect(EVisualEffect eCode, const LLUUID& idEffect)
{
auto itEffect = std::find_if(m_Effects.begin(), m_Effects.end(), [&idEffect](const LLVisualEffect* pEffect) { return pEffect->getId() == idEffect; });
auto itEffect = std::find_if(m_Effects.begin(), m_Effects.end(), [eCode, &idEffect](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode && pEffect->getId() == idEffect; });
if (m_Effects.end() == itEffect)
return false;
@ -109,32 +117,54 @@ bool LLVfxManager::removeEffect(const LLUUID& idEffect)
void LLVfxManager::runEffect(EVisualEffect eCode, LLVisualEffectParams* pParams)
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
auto pred = [eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; };
auto itEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
for (; itEffect != endEffect; ++itEffect)
{
if (pParams)
pParams->step(itEffect == endEffect);
(*itEffect)->run(pParams);
}
runEffect([eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; }, pParams);
}
void LLVfxManager::runEffect(EVisualEffectType eType, LLVisualEffectParams* pParams)
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
auto pred = [eType](const LLVisualEffect* pEffect) { return pEffect->getType() == eType; };
runEffect([eType](const LLVisualEffect* pEffect) { return pEffect->getType() == eType; }, pParams);
}
auto itEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
for (; itEffect != endEffect; ++itEffect)
void LLVfxManager::runEffect(std::function<bool(const LLVisualEffect*)> predicate, LLVisualEffectParams* pParams)
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
auto itEffect = boost::make_filter_iterator(predicate, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(predicate, m_Effects.end(), m_Effects.end());
while (itEffect != endEffect)
{
if (pParams)
pParams->step(itEffect == endEffect);
(*itEffect)->run(pParams);
LLVisualEffect* pEffect = *itEffect++;
if (pEffect->getEnabled())
{
if (pParams)
pParams->step(itEffect == endEffect);
pEffect->run(pParams);
}
}
}
void LLVfxManager::updateEffect(LLVisualEffect* pEffect, bool fEnabled, U32 nPriority)
{
llassert(m_Effects.end() != std::find(m_Effects.begin(), m_Effects.end(), pEffect));
if ( (pEffect->getEnabled() != fEnabled) || (pEffect->getPriority() != nPriority) )
{
pEffect->setEnabled(fEnabled);
pEffect->setPriority(nPriority);
std::sort(m_Effects.begin(), m_Effects.end(), cmpEffect);
}
}
// static
bool LLVfxManager::cmpEffect(const LLVisualEffect* pLHS, const LLVisualEffect* pRHS)
{
if (pLHS && pRHS)
{
// Sort by code, then priority, then memory address
return (pLHS->getCode() == pRHS->getCode()) ? (pLHS->getPriority() == pRHS->getPriority() ? pLHS < pRHS
: pLHS->getPriority() > pRHS->getPriority())
: pLHS->getCode() < pRHS->getCode();
}
return (pLHS);
}
// ============================================================================

View File

@ -73,6 +73,7 @@ struct LLShaderEffectParams : LLVisualEffectParams
class LLVisualEffect
{
friend class LLVfxManager;
public:
LLVisualEffect(LLUUID id, EVisualEffect eCode, EVisualEffectType eType)
: m_id(id), m_eCode(eCode), m_eType(eType)
@ -80,12 +81,17 @@ public:
virtual ~LLVisualEffect() {}
EVisualEffect getCode() const { return m_eCode;}
bool getEnabled() const { return m_fEnabled; }
const LLUUID& getId() const { return m_id;}
U32 getPriority() const { return m_nPriority; }
EVisualEffectType getType() const { return m_eType;}
void setEnabled(bool enable) { m_fEnabled = enable; }
virtual void run(const LLVisualEffectParams* pParams) = 0;
protected:
void setPriority(U32 priority) { m_nPriority = priority; }
/*
* Member variables
*/
@ -93,7 +99,8 @@ protected:
LLUUID m_id;
EVisualEffect m_eCode;
EVisualEffectType m_eType;
U32 m_nPriority;
bool m_fEnabled = true;
U32 m_nPriority = 0;
};
// ============================================================================
@ -160,20 +167,34 @@ protected:
*/
public:
bool addEffect(LLVisualEffect* pEffectInst);
LLVisualEffect* getEffect(const LLUUID& idEffect) const;
template<typename T> T* getEffect(const LLUUID& idEffect) const { return dynamic_cast<T*>(getEffect(idEffect)); }
LLVisualEffect* getEffect(EVisualEffect eCode) const;
template<typename T> T* getEffect(EVisualEffect eCode) const { return dynamic_cast<T*>(getEffect(eCode)); }
bool removeEffect(const LLUUID& idEffect);
LLVisualEffect* getEffect(EVisualEffect eCode, const LLUUID& idEffect) const;
template<typename T> T* getEffect(const LLUUID& idEffect) const { return dynamic_cast<T*>(getEffect(T::EffectCode, idEffect)); }
bool getEffects(std::list<LLVisualEffect*>& effectList, std::function<bool(const LLVisualEffect*)> fnFilter);
template<typename T> bool getEffects(std::list<LLVisualEffect*>& effectList) { return getEffects(effectList, [](const LLVisualEffect* pEffect) { return pEffect->getCode() == T::EffectCode; }); }
bool hasEffect(EVisualEffect eCode) const;
bool removeEffect(EVisualEffect eCode, const LLUUID& idEffect);
template<typename T> bool removeEffect(const LLUUID& idEffect) { return removeEffect(T::EffectCode, idEffect); }
void runEffect(EVisualEffect eCode, LLVisualEffectParams* pParams = nullptr);
void runEffect(EVisualEffectType eType, LLVisualEffectParams* pParams = nullptr);
void updateEffect(LLVisualEffect* pEffect, bool fEnabled, U32 nPriority);
protected:
void runEffect(std::function<bool(const LLVisualEffect*)> fnFilter, LLVisualEffectParams* pParams);
static bool cmpEffect(const LLVisualEffect* pLHS, const LLVisualEffect* pRHS);
/*
* Member variables
*/
protected:
std::set<LLVisualEffect*> m_Effects;
std::vector<LLVisualEffect*> m_Effects;
};
// ============================================================================
// Inlined member functions
//
inline bool LLVfxManager::hasEffect(EVisualEffect eCode) const
{
return m_Effects.end() != std::find_if(m_Effects.begin(), m_Effects.end(), [eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; });
}
// ============================================================================

View File

@ -1176,6 +1176,14 @@ void LLPipeline::updateRenderDeferred()
(bool) LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred");
exoPostProcess::instance().ExodusRenderPostUpdate(); // <FS:CR> Import Vignette from Exodus
// [RLVa:KB] - @setsphere
if (!sRenderDeferred && RlvActions::hasBehaviour(RLV_BHVR_SETSPHERE) && WindLightUseAtmosShaders)
{
LLRenderTarget::sUseFBO = true;
LLPipeline::sUseDepthTexture = true;
}
// [/RLVa:KB]
}
// static
@ -4597,7 +4605,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
// [RLVa:KB] - @setsphere
if (LLPipeline::RenderDeferred || !LLRenderTarget::sUseFBO || !LLPipeline::sUseDepthTexture)
if (LLPipeline::sRenderDeferred || !LLRenderTarget::sUseFBO || !LLPipeline::sUseDepthTexture)
{
doOcclusion(camera);
}

View File

@ -39,7 +39,7 @@ const S32 RLV_VERSION_BUILD_COMPAT = 0;
// Implementation version
const S32 RLVa_VERSION_MAJOR = 2;
const S32 RLVa_VERSION_MINOR = 4;
const S32 RLVa_VERSION_PATCH = 0;
const S32 RLVa_VERSION_PATCH = 1;
const S32 RLVa_IMPL_ID = 13;
// Uncomment before a final release

View File

@ -40,6 +40,7 @@ RlvOverlayEffect::RlvOverlayEffect(const LLUUID& idRlvObj)
, m_fBlockTouch(false)
, m_Color(LLColor3(c_DefaultColor))
{
m_fEnabled = false;
}
RlvOverlayEffect::~RlvOverlayEffect()
@ -50,7 +51,7 @@ RlvOverlayEffect::~RlvOverlayEffect()
// static
ERlvCmdRet RlvOverlayEffect::onAlphaValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvOverlayEffect* pEffect = dynamic_cast<RlvOverlayEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvOverlayEffect* pEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(idRlvObj))
{
pEffect->m_nAlpha = (newValue) ? boost::get<float>(newValue.value()) : c_DefaultAlpha;
}
@ -60,7 +61,7 @@ ERlvCmdRet RlvOverlayEffect::onAlphaValueChanged(const LLUUID& idRlvObj, const b
// static
ERlvCmdRet RlvOverlayEffect::onBlockTouchValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvOverlayEffect* pEffect = dynamic_cast<RlvOverlayEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvOverlayEffect* pEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(idRlvObj))
{
pEffect->m_fBlockTouch = (newValue) ? boost::get<bool>(newValue.value()) : false;
}
@ -69,7 +70,7 @@ ERlvCmdRet RlvOverlayEffect::onBlockTouchValueChanged(const LLUUID& idRlvObj, co
// static
ERlvCmdRet RlvOverlayEffect::onColorValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvOverlayEffect* pEffect = dynamic_cast<RlvOverlayEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvOverlayEffect* pEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(idRlvObj))
{
pEffect->m_Color = LLColor3( (newValue) ? boost::get<LLVector3>(newValue.value()).mV : c_DefaultColor);
}
@ -79,7 +80,7 @@ ERlvCmdRet RlvOverlayEffect::onColorValueChanged(const LLUUID& idRlvObj, const b
// static
ERlvCmdRet RlvOverlayEffect::onTextureChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvOverlayEffect* pEffect = dynamic_cast<RlvOverlayEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvOverlayEffect* pEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(idRlvObj))
{
if (newValue)
pEffect->setImage(boost::get<LLUUID>(newValue.value()));
@ -189,7 +190,7 @@ RlvSphereEffect::~RlvSphereEffect()
// static
ERlvCmdRet RlvSphereEffect::onModeChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
pEffect->m_eMode = (ESphereMode)((newValue) ? boost::get<int>(newValue.value()) : c_SphereDefaultMode);
}
@ -199,7 +200,7 @@ ERlvCmdRet RlvSphereEffect::onModeChanged(const LLUUID& idRlvObj, const boost::o
// static
ERlvCmdRet RlvSphereEffect::onOriginChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
pEffect->m_eOrigin = (ESphereOrigin)((newValue) ? boost::get<int>(newValue.value()) : c_SphereDefaultOrigin);
}
@ -209,7 +210,7 @@ ERlvCmdRet RlvSphereEffect::onOriginChanged(const LLUUID& idRlvObj, const boost:
// static
ERlvCmdRet RlvSphereEffect::onColorChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
LLVector4 vecColor = (newValue) ? LLVector4(boost::get<LLVector3>(newValue.value()), 1.0f) : LLVector4(c_SphereDefaultColor);
if (!pEffect->m_nTweenDuration)
@ -223,7 +224,7 @@ ERlvCmdRet RlvSphereEffect::onColorChanged(const LLUUID& idRlvObj, const boost::
// static
ERlvCmdRet RlvSphereEffect::onDistMinChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
float nDistanceMin = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultDistance;
if (!pEffect->m_nTweenDuration)
@ -237,7 +238,7 @@ ERlvCmdRet RlvSphereEffect::onDistMinChanged(const LLUUID& idRlvObj, const boost
// static
ERlvCmdRet RlvSphereEffect::onDistMaxChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
float nDistanceMax = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultDistance;
if (!pEffect->m_nTweenDuration)
@ -251,7 +252,7 @@ ERlvCmdRet RlvSphereEffect::onDistMaxChanged(const LLUUID& idRlvObj, const boost
// static
ERlvCmdRet RlvSphereEffect::onDistExtendChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
pEffect->m_eDistExtend = (ESphereDistExtend)((newValue) ? boost::get<int>(newValue.value()) : c_SphereDefaultDistanceExtend);
}
@ -261,7 +262,7 @@ ERlvCmdRet RlvSphereEffect::onDistExtendChanged(const LLUUID& idRlvObj, const bo
// static
ERlvCmdRet RlvSphereEffect::onParamsChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
LLVector4 params = LLVector4((newValue) ? boost::get<LLVector4>(newValue.value()).mV : c_SphereDefaultColor);
if (!pEffect->m_nTweenDuration)
@ -275,7 +276,7 @@ ERlvCmdRet RlvSphereEffect::onParamsChanged(const LLUUID& idRlvObj, const boost:
// static
ERlvCmdRet RlvSphereEffect::onTweenDurationChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
pEffect->m_nTweenDuration = (newValue) ? boost::get<float>(newValue.value()) : 0;
}
@ -285,7 +286,7 @@ ERlvCmdRet RlvSphereEffect::onTweenDurationChanged(const LLUUID& idRlvObj, const
// static
ERlvCmdRet RlvSphereEffect::onValueMinChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
float nValueMin = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultAlpha;;
if (!pEffect->m_nTweenDuration)
@ -299,7 +300,7 @@ ERlvCmdRet RlvSphereEffect::onValueMinChanged(const LLUUID& idRlvObj, const boos
// static
ERlvCmdRet RlvSphereEffect::onValueMaxChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
if (RlvSphereEffect* pEffect = LLVfxManager::instance().getEffect<RlvSphereEffect>(idRlvObj))
{
float nValueMax = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultAlpha;
if (!pEffect->m_nTweenDuration)

View File

@ -35,6 +35,7 @@ public:
RlvOverlayEffect(const LLUUID& idRlvObj);
~RlvOverlayEffect();
static const EVisualEffect EffectCode = EVisualEffect::RlvOverlay;
public:
bool hitTest(const LLCoordGL& ptMouse) const;
void run(const LLVisualEffectParams*) override;
@ -70,6 +71,7 @@ public:
RlvSphereEffect(const LLUUID& idRlvObj);
~RlvSphereEffect();
static const EVisualEffect EffectCode = EVisualEffect::RlvSphere;
public:
void run(const LLVisualEffectParams* pParams) override;
static ERlvCmdRet onModeChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);

View File

@ -19,6 +19,7 @@
#include "llagent.h"
#include "llappearancemgr.h"
#include "llavatarnamecache.h"
#include <llchatentry.h>
#include "llclipboard.h"
#include "llcombobox.h"
#include "llinventoryfunctions.h"
@ -733,7 +734,7 @@ static const char s_strRlvConsoleDisabled[] = "RLVa is disabled";
static const char s_strRlvConsoleInvalid[] = "Invalid command";
RlvFloaterConsole::RlvFloaterConsole(const LLSD& sdKey)
: LLFloater(sdKey), m_pOutputText(nullptr)
: LLFloater(sdKey)
{
}
@ -743,11 +744,14 @@ RlvFloaterConsole::~RlvFloaterConsole()
BOOL RlvFloaterConsole::postBuild()
{
LLLineEditor* pInputEdit = getChild<LLLineEditor>("console_input");
pInputEdit->setEnableLineHistory(true);
pInputEdit->setCommitCallback(boost::bind(&RlvFloaterConsole::onInput, this, _1, _2));
pInputEdit->setFocus(true);
pInputEdit->setCommitOnFocusLost(false);
m_pInputEdit = getChild<LLChatEntry>("console_input");
m_pInputEdit->setCommitCallback(boost::bind(&RlvFloaterConsole::onInput, this, _1, _2));
m_pInputEdit->setTextExpandedCallback(boost::bind(&RlvFloaterConsole::reshapeLayoutPanel, this));
m_pInputEdit->setFocus(true);
m_pInputEdit->setCommitOnFocusLost(false);
m_pInputPanel = getChild<LLLayoutPanel>("input_panel");
m_nInputEditPad = m_pInputPanel->getRect().getHeight() - m_pInputEdit->getRect().getHeight();
m_pOutputText = getChild<LLTextEditor>("console_output");
m_pOutputText->appendText(s_strRlvConsolePrompt, false);
@ -769,12 +773,12 @@ void RlvFloaterConsole::addCommandReply(const std::string& strCommand, const std
void RlvFloaterConsole::onInput(LLUICtrl* pCtrl, const LLSD& sdParam)
{
LLLineEditor* pInputEdit = static_cast<LLLineEditor*>(pCtrl);
LLChatEntry* pInputEdit = static_cast<LLChatEntry*>(pCtrl);
std::string strInput = pInputEdit->getText();
LLStringUtil::trim(strInput);
m_pOutputText->appendText(strInput, false);
pInputEdit->clear();
pInputEdit->setText(LLStringUtil::null);
if (!rlv_handler_t::isEnabled())
{
@ -831,4 +835,9 @@ void RlvFloaterConsole::onInput(LLUICtrl* pCtrl, const LLSD& sdParam)
m_pOutputText->appendText(s_strRlvConsolePrompt, true);
}
void RlvFloaterConsole::reshapeLayoutPanel()
{
m_pInputPanel->reshape(m_pInputPanel->getRect().getWidth(), m_pInputEdit->getRect().getHeight() + m_nInputEditPad, FALSE);
}
// ============================================================================

View File

@ -1,21 +1,20 @@
/**
/**
*
* Copyright (c) 2009-2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
*
* The source code in this file is provided to you under the terms of the
* GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt
* in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt
*
*
* By copying, modifying or distributing this software, you acknowledge that
* you have read and understood your obligations described above, and agree to
* you have read and understood your obligations described above, and agree to
* abide by those obligations.
*
*
*/
#ifndef RLV_FLOATERS_H
#define RLV_FLOATERS_H
#pragma once
#include "llfloater.h"
@ -25,7 +24,9 @@
// ============================================================================
// Foward declarations
//
class LLChatEntry;
class LLComboBox;
class LLLayoutPanel;
class LLTextEditor;
// ============================================================================
@ -150,21 +151,23 @@ private:
public:
BOOL postBuild() override;
void onClose(bool fQuitting) override;
/*
* Member functions
*/
protected:
void addCommandReply(const std::string& strCommand, const std::string& strReply);
void onInput(LLUICtrl* ctrl, const LLSD& param);
void reshapeLayoutPanel();
/*
* Member variables
*/
protected:
LLTextEditor* m_pOutputText;
LLTextEditor* m_pOutputText = nullptr;
LLLayoutPanel* m_pInputPanel = nullptr;
LLChatEntry* m_pInputEdit = nullptr;
int m_nInputEditPad = 0;
};
// ============================================================================
#endif // RLV_FLOATERS_H

View File

@ -2065,14 +2065,44 @@ void RlvBehaviourToggleHandler<RLV_BHVR_PAY>::onCommandToggle(ERlvBehaviour eBhv
}
}
// Handles: @setoverlay=n|y toggles
// Handles: @setoverlay=n|y
template<> template<>
void RlvBehaviourToggleHandler<RLV_BHVR_SETOVERLAY>::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr)
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETOVERLAY>::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)
{
if (fHasBhvr)
LLVfxManager::instance().addEffect(new RlvOverlayEffect(gRlvHandler.getCurrentObject()));
else
LLVfxManager::instance().removeEffect(gRlvHandler.getCurrentObject());
ERlvCmdRet eRet = RlvBehaviourGenericHandler<RLV_OPTION_NONE_OR_MODIFIER>::onCommand(rlvCmd, fRefCount);
if ( (RLV_RET_SUCCESS == eRet) && (!rlvCmd.isModifier()) )
{
if (gRlvHandler.hasBehaviour(rlvCmd.getObjectID(), rlvCmd.getBehaviourType()))
{
LLVfxManager::instance().addEffect(new RlvOverlayEffect(gRlvHandler.getCurrentObject()));
}
else
{
LLVfxManager::instance().removeEffect<RlvOverlayEffect>(gRlvHandler.getCurrentObject());
}
}
// Refresh overlay effects according to object hierarchy
std::list<LLVisualEffect*> effects;
if (LLVfxManager::instance().getEffects<RlvOverlayEffect>(effects))
{
auto itActiveEffect = std::find_if(effects.begin(), effects.end(), [](const LLVisualEffect* pEffect) { return pEffect->getEnabled(); });
if (effects.end() == itActiveEffect)
{
// If nothing is active just pick the first one to activate
itActiveEffect = effects.begin();
}
const LLUUID idActiveRootObj = (effects.end() != itActiveEffect) ? Rlv::getObjectRootId((*itActiveEffect)->getId()) : LLUUID::null;
for (LLVisualEffect* pEffect : effects)
{
bool isActive = (idActiveRootObj.isNull() && pEffect == effects.front()) || (Rlv::getObjectRootId(pEffect->getId()) == idActiveRootObj);
int nPriority = (isActive) ? 256 - Rlv::getObjectLinkNumber(pEffect->getId()) : pEffect->getPriority();
LLVfxManager::instance().updateEffect(pEffect, isActive, nPriority);
}
}
return eRet;
}
// Handles: @setsphere=n|y
@ -2086,22 +2116,28 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETSPHERE>::onCommand(const RlvCommand&
ERlvCmdRet eRet = RlvBehaviourGenericHandler<RLV_OPTION_NONE_OR_MODIFIER>::onCommand(rlvCmd, fRefCount);
if ( (RLV_RET_SUCCESS == eRet) && (!rlvCmd.isModifier()) )
{
// If we're not using deferred but are using Windlight shaders we need to force use of FBO and depthmap texture
if ( (!LLPipeline::RenderDeferred) && (LLPipeline::WindLightUseAtmosShaders) && (!LLPipeline::sUseDepthTexture) )
{
LLRenderTarget::sUseFBO = true;
LLPipeline::sUseDepthTexture = true;
gPipeline.releaseGLBuffers();
gPipeline.createGLBuffers();
gPipeline.resetVertexBuffers();
LLViewerShaderMgr::instance()->setShaders();
}
if (gRlvHandler.hasBehaviour(rlvCmd.getObjectID(), rlvCmd.getBehaviourType()))
{
Rlv::forceAtmosphericShadersIfAvailable();
// If we're not using deferred but are using Windlight shaders we need to force use of FBO and depthmap texture
if ( (!LLPipeline::sRenderDeferred) && (LLPipeline::WindLightUseAtmosShaders) && (!LLPipeline::sUseDepthTexture) )
{
LLRenderTarget::sUseFBO = true;
LLPipeline::sUseDepthTexture = true;
gPipeline.releaseGLBuffers();
gPipeline.createGLBuffers();
gPipeline.resetVertexBuffers();
LLViewerShaderMgr::instance()->setShaders();
}
LLVfxManager::instance().addEffect(new RlvSphereEffect(rlvCmd.getObjectID()));
}
else
LLVfxManager::instance().removeEffect(gRlvHandler.getCurrentObject());
{
LLVfxManager::instance().removeEffect<RlvSphereEffect>(gRlvHandler.getCurrentObject());
}
}
return eRet;
}
@ -2418,11 +2454,10 @@ void RlvBehaviourToggleHandler<RLV_BHVR_SETENV>::onCommandToggle(ERlvBehaviour e
}
}
// Don't allow toggling "Atmopsheric Shaders" through the debug settings under @setenv=n
gSavedSettings.getControl("WindLightUseAtmosShaders")->setHiddenFromSettingsEditor(fHasBhvr);
if (fHasBhvr)
{
Rlv::forceAtmosphericShadersIfAvailable();
// Usurp the 'edit' environment for RLVa locking so TPV tools like quick prefs and phototools are automatically locked out as well
// (these needed per-feature awareness of RLV in the previous implementation which often wasn't implemented)
LLEnvironment* pEnv = LLEnvironment::getInstance();

View File

@ -17,9 +17,11 @@
#include "llviewerprecompiledheaders.h"
#include "llappearancemgr.h"
#include "llattachmentsmgr.h"
#include "llfeaturemanager.h"
#include "llgesturemgr.h"
#include "llnotificationsutil.h"
#include "llviewerobjectlist.h"
#include "pipeline.h"
//<FS:TS> FIRE-4453 bridge detached by the RLV command @remattach=force
#include "fslslbridge.h"
@ -223,16 +225,16 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
addEntry(new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SETCAM_UNLOCK, RLV_OPTION_NONE>("camunlock", RlvBehaviourInfo::BHVR_SYNONYM | RlvBehaviourInfo::BHVR_DEPRECATED));
// Overlay
RlvBehaviourInfo* pSetOverlayBhvr = new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SETOVERLAY, RLV_OPTION_NONE_OR_MODIFIER>("setoverlay");
RlvBehaviourInfo* pSetOverlayBhvr = new RlvBehaviourProcessor<RLV_BHVR_SETOVERLAY>("setoverlay");
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayAlpha, typeid(float), "alpha", &RlvOverlayEffect::onAlphaValueChanged);
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayTexture, typeid(LLUUID), "texture", &RlvOverlayEffect::onTextureChanged);
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayTint, typeid(LLVector3), "tint", &RlvOverlayEffect::onColorValueChanged);
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayTouch, typeid(LLVector3), "touch", &RlvOverlayEffect::onBlockTouchValueChanged);
addEntry(pSetOverlayBhvr);
addEntry(new RlvForceProcessor<RLV_BHVR_SETOVERLAY_TWEEN>("setoverlay_tween", RlvBehaviourInfo::BHVR_EXPERIMENTAL));
addEntry(new RlvForceProcessor<RLV_BHVR_SETOVERLAY_TWEEN>("setoverlay_tween"));
// Sphere
RlvBehaviourInfo* pSetSphereBhvr = new RlvBehaviourProcessor<RLV_BHVR_SETSPHERE>("setsphere", RlvBehaviourInfo::BHVR_EXPERIMENTAL);
RlvBehaviourInfo* pSetSphereBhvr = new RlvBehaviourProcessor<RLV_BHVR_SETSPHERE>("setsphere");
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereMode, typeid(int), "mode", &RlvSphereEffect::onModeChanged);
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereOrigin, typeid(int), "origin", &RlvSphereEffect::onOriginChanged);
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereColor, typeid(LLVector3), "color", &RlvSphereEffect::onColorChanged);
@ -2044,3 +2046,40 @@ std::string rlvGetLastParenthesisedText(const std::string& strText, std::string:
}
// =========================================================================
// Various helper functions
//
namespace Rlv
{
void forceAtmosphericShadersIfAvailable()
{
if ( (LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) && (!LLPipeline::WindLightUseAtmosShaders) )
{
// Triggers handleSetShaderChanged() which will do the actual work for us
gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE);
}
}
int getObjectLinkNumber(const LLUUID& idObj)
{
const LLViewerObject* pObj = gObjectList.findObject(idObj);
const LLViewerObject* pRootObj = (pObj) ? pObj->getRootEdit() : nullptr;
if ( (!pRootObj) || (pRootObj->getChildren().empty()) )
return 0;
else if (pRootObj == pObj)
return 1;
return 2 + std::distance(pRootObj->getChildren().begin(), std::find(pRootObj->getChildren().begin(), pRootObj->getChildren().end(), pObj));
}
const LLUUID& getObjectRootId(const LLUUID& idObj)
{
if (const LLViewerObject* pObj = gObjectList.findObject(idObj))
{
pObj = pObj->getRootEdit();
return pObj->getID();
}
return idObj;
}
}
// =========================================================================

View File

@ -689,6 +689,14 @@ ERlvAttachGroupType rlvAttachGroupFromString(const std::string& strGroup);
std::string rlvGetFirstParenthesisedText(const std::string& strText, std::string::size_type* pidxMatch = NULL);
std::string rlvGetLastParenthesisedText(const std::string& strText, std::string::size_type* pidxStart = NULL);
namespace Rlv
{
void forceAtmosphericShadersIfAvailable();
int getObjectLinkNumber(const LLUUID& idObj);
const LLUUID& getObjectRootId(const LLUUID& idObj);
}
// ============================================================================
// Inlined class member functions
//

View File

@ -1,44 +1,74 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
can_resize="true"
height="400"
layout="topleft"
min_height="300"
min_width="300"
name="rlv_console"
can_resize="true"
height="400"
layout="topleft"
min_height="300"
min_width="300"
name="rlv_console"
save_rect="true"
title="RLVa console"
width="600"
>
<text_editor
title="RLVa console"
width="600"
>
<layout_stack
animate="false"
bottom="-1"
default_tab_group="2"
follows="all"
left="10"
length="1"
font="Monospace"
height="366"
ignore_tab="false"
left="5"
layout="topleft"
max_length="65536"
name="console_output"
read_only="true"
track_end="true"
type="string"
width="576"
word_wrap="true"
mouse_opaque="false"
name="main_stack"
right="-5"
orientation="vertical"
tab_group="1"
top="1"
>
</text_editor>
<line_editor
border_style="line"
border_thickness="1"
bottom_delta="20"
follows="left|right|bottom"
font="SansSerif"
height="19"
layout="topleft"
max_length_chars="127"
name="console_input"
top_delta="0"
width="576"
>
</line_editor>
<layout_panel
name="body_panel"
height="235">
<text_editor
follows="all"
left="1"
right="-1"
top="0"
length="1"
font="Monospace"
bottom="-1"
ignore_tab="false"
layout="topleft"
max_length="65536"
name="console_output"
read_only="true"
track_end="true"
type="string"
word_wrap="true"
>
</text_editor>
</layout_panel>
<layout_panel
height="26"
auto_resize="false"
name="input_panel">
<chat_editor
layout="topleft"
expand_lines_count="5"
follows="left|right|bottom"
font="SansSerifSmall"
height="20"
is_expandable="true"
text_tentative_color="TextFgTentativeColor"
name="console_input"
max_length="1023"
spellcheck="true"
tab_group="3"
bottom_delta="20"
left="1"
top="1"
right="-1"
wrap="true"
/>
</layout_panel>
</layout_stack>
</floater>