summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2018-06-06 10:09:01 +0300
committerJanne Kangas <janne.kangas@qt.io>2018-06-18 11:41:23 +0000
commit5714008022d0a70b9c176fea1b721b5ae74f5ccc (patch)
tree4568a623195eed57687984fecebd602e26a6b660 /src/Authoring/Studio/Render/StudioRendererTranslation.cpp
parentc5ea9e8ce658bcc633cd2e0b4b587af4671af5a6 (diff)
Reset effect when user changes effect parameters
Fix resets the (corona) effect accumulation that would eventually paint the entire screen for Fade parameter 1.0. Now changing any parameters for the effect resets the effect and allows the user to see the actual impact of current parameters without carryover from previously rendered frames, for shader effects that accumulate. Task-ID: QT3DS-155 Change-Id: I01541ff7fbff018502e41c2a45f551c0a6647a4a Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Render/StudioRendererTranslation.cpp')
-rw-r--r--src/Authoring/Studio/Render/StudioRendererTranslation.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
index a99ced10..139ab573 100644
--- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
+++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
@@ -1130,6 +1130,13 @@ struct SEffectTranslator : public SDynamicObjectTranslator
else
theItem.m_Flags.SetActive(inActive);
}
+
+ void ResetEffect() override
+ {
+ SEffect &theItem = static_cast<SEffect &>(GetGraphObject());
+ if (m_EffectSystem)
+ theItem.Reset(*m_EffectSystem);
+ }
};
struct SCustomMaterialTranslator : public SDynamicObjectTranslator
{
@@ -2035,6 +2042,10 @@ void STranslation::MarkDirty(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
THandleTranslatorPairList &theTranslators = GetTranslatorsForInstance(inInstance);
for (size_t idx = 0, end = theTranslators.size(); idx < end; ++idx) {
m_DirtySet.insert(*theTranslators[(eastl::allocator::size_type)idx].second);
+ // Reset effect when effect parameters change, as with certain corner cases
+ // some effects would accumulate ~infinitely and result would not reflect
+ // actual parameter setting unless reset (f.ex corona, other blur types)
+ m_DirtySet.back()->ResetEffect();
}
RequestRender();
}