Skip to content

RotateModifier

Source: RotateModifier.h

RotateModifier

class RotateModifier
src/light/modifiers/RotateModifier.h:33

Inherits: ModifierBase

Modifier rotating the 2D image about its center over time.

Author: WildCats08 / @Brandon502 (MoonLight), https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Modifiers/M_MoonLight.h

Public Attributes

uint8_t speed = 1 : Rotation speed, 1..255 (turns faster as it rises).

Public Methods

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

virtual inline Dim dimensions() const override : Which axes this modifier works on, advisory for the UI chip.

virtual inline bool hasModifyLive() const override : Whether this modifier also transforms per frame.

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

virtual inline bool affectsPrepare(const char *) const override : Whether a change here forces the mapping to rebuild.

virtual inline void modifyLive(Coord3D & pos, const Coord3D & logical) const override : Transform a position per frame, after the mapping is built.

virtual inline void tick() override : The hot tick, which by default ticks every enabled child and times each.

More info

Rotates the 2D image around its center, turning continuously over time. The one DYNAMIC modifier in the set: it overrides [modifyLive()], so the Layer re-applies it every frame (a smooth turn, not a stepped LUT rebuild). A static-only chain pays nothing, the per-frame pass runs only because this modifier reports [hasModifyLive()].

The live pass maps backward

For each destination logical cell it computes the source cell to gather from. No destination is ever left unfilled, which is the textbook reason image warping samples backward. The source is the inverse rotation R(-θ) of the destination.

The transform-matrix reference

This modifier is also the codebase's reference for a matrix-backed transform. Rotation is the canonical affine transform, unlike the non-affine folds that mask or repeat. It is written as an explicit rotation matrix applied to the centerd coordinate. The matrix entries are integer fixed point, the trig table's output centerd so subtracting its midpoint gives a signed unit component. A future affine transform combining translation, scale, rotation and shear would compose its matrix the same way, so the fold interface hosts one with no change. A non-affine modifier cannot use a matrix at all, a mask being a predicate and a tile a modulo, which is why only this one is matrix-shaped.

Prior art: MoonLight M_MoonLight.h Rotate (modifyXYZ per-frame transform). Same per-frame coordinate remap; we name the hook modifyLive and carry an explicit matrix.