Skip to content
Snippets Groups Projects
Commit f34f0857 authored by Kitty Barnett's avatar Kitty Barnett
Browse files

Only one @setsphere effect is ever visible (broken when code moved to LLPipeline::renderFinalize)

parent 8238aee5
No related branches found
No related tags found
No related merge requests found
...@@ -107,33 +107,33 @@ bool LLVfxManager::removeEffect(const LLUUID& idEffect) ...@@ -107,33 +107,33 @@ bool LLVfxManager::removeEffect(const LLUUID& idEffect)
return true; return true;
} }
void LLVfxManager::runEffect(EVisualEffect eCode, const LLVisualEffectParams* pParams) void LLVfxManager::runEffect(EVisualEffect eCode, LLVisualEffectParams* pParams)
{ {
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact // *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 pred = [eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; };
auto beginEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()), 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()); endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
for (; itEffect != endEffect; ++itEffect)
auto effectRange = boost::make_iterator_range(beginEffect, endEffect);
for (LLVisualEffect* pEffect : effectRange)
{ {
pEffect->run(pParams); if (pParams)
pParams->step(itEffect == endEffect);
(*itEffect)->run(pParams);
} }
} }
void LLVfxManager::runEffect(EVisualEffectType eType, const LLVisualEffectParams* 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 // *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; }; auto pred = [eType](const LLVisualEffect* pEffect) { return pEffect->getType() == eType; };
auto beginEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()), 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()); endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
for (; itEffect != endEffect; ++itEffect)
auto effectRange = boost::make_iterator_range(beginEffect, endEffect);
for (LLVisualEffect* pEffect : effectRange)
{ {
pEffect->run(pParams); if (pParams)
pParams->step(itEffect == endEffect);
(*itEffect)->run(pParams);
} }
} }
......
...@@ -46,14 +46,23 @@ enum class EVisualEffectType ...@@ -46,14 +46,23 @@ enum class EVisualEffectType
struct LLVisualEffectParams struct LLVisualEffectParams
{ {
virtual void step(bool isLast) = 0;
}; };
struct LLShaderEffectParams : LLVisualEffectParams struct LLShaderEffectParams : LLVisualEffectParams
{ {
explicit LLShaderEffectParams(LLRenderTarget* pSrcBuffer, LLRenderTarget* pDstBuffer) : m_pSrcBuffer(pSrcBuffer), m_pDstBuffer(pDstBuffer) {} explicit LLShaderEffectParams(LLRenderTarget* pSrcBuffer, LLRenderTarget* pScratchBuffer, bool fBindLast) : m_pSrcBuffer(pScratchBuffer), m_pDstBuffer(pSrcBuffer), m_fBindLast(fBindLast) {}
void step(bool isLast) override
{
LLRenderTarget* pPrevSrc = m_pSrcBuffer, *pPrevDst = m_pDstBuffer;
m_pSrcBuffer = pPrevDst;
m_pDstBuffer = (!isLast || !m_fBindLast) ? pPrevSrc : nullptr;
}
LLRenderTarget* m_pSrcBuffer = nullptr; LLRenderTarget* m_pSrcBuffer = nullptr;
LLRenderTarget* m_pDstBuffer = nullptr; LLRenderTarget* m_pDstBuffer = nullptr;
bool m_fBindLast = false;
}; };
// ============================================================================ // ============================================================================
...@@ -161,8 +170,8 @@ class LLVfxManager : public LLSingleton<LLVfxManager> ...@@ -161,8 +170,8 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
LLVisualEffect* getEffect(EVisualEffect eCode) const; LLVisualEffect* getEffect(EVisualEffect eCode) const;
template<typename T> T* getEffect(EVisualEffect eCode) const { return dynamic_cast<T*>(getEffect(eCode)); } template<typename T> T* getEffect(EVisualEffect eCode) const { return dynamic_cast<T*>(getEffect(eCode)); }
bool removeEffect(const LLUUID& idEffect); bool removeEffect(const LLUUID& idEffect);
void runEffect(EVisualEffect eCode, const LLVisualEffectParams* pParams = nullptr); void runEffect(EVisualEffect eCode, LLVisualEffectParams* pParams = nullptr);
void runEffect(EVisualEffectType eType, const LLVisualEffectParams* pParams = nullptr); void runEffect(EVisualEffectType eType, LLVisualEffectParams* pParams = nullptr);
protected: protected:
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment