Skip to content

BlockModifier

Source: BlockModifier.h

BlockModifier

class BlockModifier
src/light/modifiers/BlockModifier.h:23

Inherits: ModifierBase

Modifier expanding a 1D effect into concentric square rings.

Public Methods

virtual inline const char * tags() const override : The catalog tags this modifier carries.

virtual inline Dim dimensions() const override : Two-dimensional: it reads x and y and writes into y, leaving z untouched.

virtual inline void modifyLogicalSize(Coord3D & size) override : Resize the logical box this modifier presents to the effect.

virtual inline bool modifyLogical(Coord3D & pos) const override : Transform one light's logical position, false dropping it from the mapping.

More info

Remaps a 1D effect onto the CHEBYSHEV-distance field of a 2D box. Each physical light folds to its block distance from the box center, max(|dx|,|dy|), so the effect draws as concentric SQUARE rings expanding from the middle. It is the square-ring sibling of the Circle modifier (which uses the Euclidean sqrt and draws round rings). Block swaps that for the Chebyshev max, which is why the rings are axis-aligned squares. Z is not part of the distance (this is a 2D remap, exactly as MoonLight defines it).

The logical box the fold produces is one row wide and (max block distance + 1) tall: a 1D effect painted along y lights the rings from center outward.

Prior art: MoonLight's BlockModifier (M_MoonLight.h), same center formula ((n+1)/2 - 1, a floor-biased middle), same dx/dy abs deltas, same distance = max(dx, dy), same {0, distance, 0} output. The same box transform (fold the box through the position map, then grow each axis by one). Written fresh against our fold interface: modifySize() -> modifyLogicalSize (stashing the incoming box), modifyPosition() -> the const modifyLogical fold that reads the stash. Author: MoonLight, https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Modifiers/M_MoonLight.h