From 1697171fc003d26dace4a7d70e2f8038df60a196 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Thu, 2 Jan 2025 18:14:45 +0100 Subject: [PATCH] pass: allow removing all pass elements of a given type --- src/render/pass/Pass.cpp | 4 ++++ src/render/pass/Pass.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp index 8fdc3049..3e1282f0 100644 --- a/src/render/pass/Pass.cpp +++ b/src/render/pass/Pass.cpp @@ -247,3 +247,7 @@ float CRenderPass::oneBlurRadius() { static auto PBLURPASSES = CConfigValue("decoration:blur:passes"); return *PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think. } + +void CRenderPass::removeAllOfType(const std::string& type) { + std::erase_if(m_vPassElements, [&type](const auto& e) { return e->element->passName() == type; }); +} diff --git a/src/render/pass/Pass.hpp b/src/render/pass/Pass.hpp index 5d7d3bb3..5fa25fc3 100644 --- a/src/render/pass/Pass.hpp +++ b/src/render/pass/Pass.hpp @@ -14,6 +14,7 @@ class CRenderPass { void add(SP elem); void clear(); + void removeAllOfType(const std::string& type); CRegion render(const CRegion& damage_);