Skip to content

RegionModifier

Source: RegionModifier.h

RegionModifier

class RegionModifier
src/light/modifiers/RegionModifier.h:35

Inherits: ModifierBase

Modifier carving the layer to a percentage sub-rectangle.

Public Attributes

lengthType startX = 0 : The region's low corner.

lengthType startY = 0

lengthType startZ = 0

lengthType endX = 100 : Its high corner.

lengthType endY = 100

lengthType endZ = 100

Public Methods

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

virtual inline Dim dimensions() const override : Clips a box, which is an extent on every axis.

virtual inline void defineControls() override : The controls a user sets on the card.

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

Carves the layer down to a sub-region of the physical bounding box: the effect renders only into the region, everything outside is dark. The region is given as PERCENTAGES of the physical extent on each axis (start 0 / end 100 = the full box, an identity carve). It survives a physical resize, a 0..50 region stays the left half whether the panel is 64 or 128 wide.

A crop, not a remap

It is a region crop, the textbook crop node of any compositor. It shrinks the logical box to the region and folds each physical light into region-local space by subtracting the start offset. A light landing outside the region is then rejected, which is what makes everything beyond it dark. A 1:1 fold, same family as CheckerboardModifier.

The rounding rule

The interval is half-open: a start percentage floors to the lower pixel, and an end percentage ceils to an exclusive one. That makes abutting regions tile exactly: a 0..50 and a 50..100 layer split a 128-wide axis into two halves with no overlap and no gap.

Off-screen windows. start/end percentages may go negative or past 100 (Int16 on the wire, default UI range −100..200) to slide the window partly or fully out of the visible box. The logical box is the full window span, so the effect renders at a consistent scale. A physical light outside the window is dropped, and a window cell with none under it is simply dark. A window entirely off-box renders nothing, the layer goes dark, which is how you move an effect completely out of view.

Fast path: the cheapest carve is no modifier, then Layer::rebuildLUT takes its identity/memcpy path with zero carving cost. Adding a full-region (0/100) RegionModifier is correct but not free; the default is to not add one. Author: MoonLight, https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Modifiers/M_MoonLight.h