Skip to main content

Module wavegen_md3

Module wavegen_md3 

Source
Expand description

Main waveform of MilkDrop 3 (3.37): the 17 modes 0..=16 (docs/md3.md, “Main waveform”).

MD3 keeps the BeatDrop DrawWave structure (per-pass set-up, blend of the old and the new mode, colour, SmoothWave, thick / dots passes) and differs in the modes themselves: every formula reads one channel (like the original MilkDrop 2 and unlike BeatDrop, which averages left and right), mode 14 really halves rad and ang, mode 13 reads past the end of the right channel into the spectrum, mode 16 is BeatDrop’s triangle spinning the other way, and BeatDrop’s mode 17 does not exist. The shared tail (WaveGeom consumers in the renderer) is the MD2 one.

Output convention as in crate::wavegen: clip space, x right, y up, before SmoothWave.

Constants§

MD3_NUM_WAVES
NUM_WAVES of MilkDrop 3: valid modes are 0..=16; the drawn mode is (int)wave_mode % 17.

Functions§

main_wave_geometry_md3_raw
One pass of MD3’s DrawWave loop: the vertices and the alpha of the wave number mw.mode before the “alpha < 0.004” test (which applies to the possibly blended result).
md3_wave_mode
The mode MilkDrop 3 draws for the per-frame variable wave_mode: C truncation to int (cvttsd2si: NaN and out-of-range values give INT_MIN), then the C remainder by 17, which keeps the sign of the dividend. A negative result is not a mode: main_wave_geometry_md3_raw then yields 480 zero vertices.