Skip to content

ModifierBase

Source: ModifierBase.h

ModifierBase

class ModifierBase
src/light/modifiers/ModifierBase.h:42

Inherits: MoonModule

A coordinate transform that reshapes how a layer's output maps onto the physical lights.

Several modifiers on one layer compose, applying in child order. Each reshapes the result of the one below it.

Public Methods

virtual inline ModuleRole role() const override : Role for type identification (no RTTI needed).

virtual inline bool affectsPrepare(const char *) const override : Whether a control change rebuilds the mapping, which every modifier control does.

virtual inline Dim dimensions() const : Which axes this modifier can transform.

virtual inline void modifyLogicalSize(Coord3D &) : Reshape the running logical box, once per rebuild in child order.

virtual inline bool modifyLogical(Coord3D &) const : Fold one coordinate into this stage's logical space, returning false to reject it.

virtual inline void modifyLive(Coord3D &, const Coord3D &) const : Remap a coordinate per frame, without rebuilding the mapping.

virtual inline bool hasModifyLive() const : Whether this modifier does per-frame work, which gates the live pass.

virtual inline bool consumeNeedsRebuild() : Whether this modifier's mapping changed and wants a rebuild, clearing the flag.

More info

The fold contract

A layer builds its mapping by folding every physical light through each enabled modifier. The whole chain collapses into one table, so the per-frame render stays a single lookup. Three hooks do it, each a no-op by default, so a modifier implements only what it needs.

Fan-out is free

The build walks physical lights, so several folding onto one logical cell is the fan-out. Each physical light contributes at most one destination, so the mapping cannot overflow.

Affine modifiers

Most are not affine: a mask is a predicate and a tile is modulo. Rotation is the exception, written as an integer rotation matrix.

Prior art

The textbook image-warping pattern: bake a transform into a spatial table, built backward.