Cascade effects through a chain
renderChain runs a list of stages in order: stage 0 works on the loaded sources, every later one on the output of the stage before it, so blur after scanlines softens the scanlines rather than the photographs. The effects themselves are untouched — none of them knows whether its input came from disk. All stages share one Rng and run in sequence, so a seed still reproduces the cascade byte for byte. The sidebar grows an "Effect chain" list: add a stage from a menu built from the registry, reorder it, remove it, and edit the selected stage's params underneath. Each stage keeps its own values. The CLI takes the same chain from repeated -e, with every flag going to the stage whose effect declares it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "core/effect.hpp"
|
||||
#include "core/image.hpp"
|
||||
#include "core/params.hpp"
|
||||
#include "core/rng.hpp"
|
||||
|
||||
namespace effector {
|
||||
|
||||
// One link of a cascade: an effect together with the values it runs with.
|
||||
struct ChainStage {
|
||||
EffectPtr effect;
|
||||
ParamValues values; // missing keys fall back to the effect's defaults
|
||||
};
|
||||
|
||||
// Renders the stages in order. The first one sees the loaded sources; every
|
||||
// later one sees the previous stage's output as its only source, so blur after
|
||||
// scanlines softens the scanlines rather than the photographs.
|
||||
//
|
||||
// All stages share one Rng and run strictly in sequence, so a seed still
|
||||
// reproduces the cascade byte for byte.
|
||||
Image renderChain(const std::vector<ChainStage>& stages, const std::vector<Image>& sources,
|
||||
int width, int height, Rng& rng);
|
||||
|
||||
// "Scanlines → Blur", for window titles and status lines.
|
||||
std::string chainTitle(const std::vector<ChainStage>& stages);
|
||||
|
||||
// "scanlines-blur", for file names.
|
||||
std::string chainSlug(const std::vector<ChainStage>& stages);
|
||||
|
||||
} // namespace effector
|
||||
Reference in New Issue
Block a user