Expand description
Geometry generation for the main waveform (CPlugin::DrawWave) and custom-wave helpers
(DrawCustomWaves, SmoothWave). Pure functions: no GPU.
Coordinate convention of the outputs: clip space, x right, y up (so y = 1 is the top
of the screen). MD2 draws through an ortho projection with a flipped Y; DrawWave negates
all y values at the end (“to stay consistent with the pre-VMS milkdrop”), which cancels
the projection flip — the y it computes is the clip-space y.
Structs§
- Custom
Wave Sampling - Parameters of one custom wave’s sample preparation (
CWavefields +fWaveScale). - PmWave
Geom - Output of
main_wave_geometry_projectm. - PmWave
Scratch - Reusable vertex buffers of
main_wave_geometry_projectm(contents are overwritten every call). - Wave
Geom - Result of
main_wave_geometry.
Constants§
- NUM_
FREQ_ SAMPLES - Length of the spectrum arrays (
fSpecLeft/fSpecRight). - NUM_
WAVEFORM_ SAMPLES NUM_WAVEFORM_SAMPLES(MD2: 480).- NUM_
WAVES_ DRAWN - Number of wave modes the classic MD2 port draws (0..=7 are MD2 classic; 8 is the spectrum line).
- NUM_
WAVES_ MD2 NUM_WAVESof the MilkDrop 2 sources inthird_party/md2(md_defines.h): modes0..=17, the ones from 9 on being the BeatDrop / MilkDrop2077 additions, drawn whenCompatRules::md2_wave_modes_9_17is on.- NUM_
WAVE_ INPUT - Length of the raw waveform arrays the renderer reads (
mysound.fWave[ch][576]). - PM_
WAVE_ MODES - Number of main-wave modes in projectM (
WaveformMode::Count); the preset value is wrapped with it. - PM_
WAVE_ POINTS - Largest wave buffer length in projectM (
WaveformMaxPoints).
Functions§
- custom_
wave_ values_ into - Port of the sample-preparation block of
DrawCustomWaves: resampling, forward + backward smoothing and scaling. Fillsout(cleared first) with(value1, value2)per point for the engine’s per-point code.data1/data2arem_sound.fWaveform[0/1](480 valid samples) orfSpectrum[0/1](512). - main_
wave_ geometry - Port of the single-waveform part of
DrawWave(no preset blending:its == 1). - main_
wave_ geometry_ projectm - Port of projectM’s main waveform (
Waveform::Drawminus the GL calls): vertex generation,SmoothWave, alpha and colour for wave modes0..PM_WAVE_MODES(mw.modealready wrapped). - main_
wave_ geometry_ raw - The per-wave part of
DrawWave’s loop (for it in 0..its): the vertices and the alpha of one wave before MD2’s “don’t draw wave if alpha < 0.004” test, which only applies to the (possibly blended) final alpha.blendingism_pState->m_bBlending: the wave modes that close their loop by duplicating the first vertex do not while blending.extendedenables modes9..NUM_WAVES_MD2(NUM_WAVES_MD2); without it they are unsupported.Nonefor an unsupported mode. - prepare_
main_ waveform RenderFrame: scale (fWaveScale/128) and IIR-smooth the raw 576-sample waveform.- prepare_
main_ waveform_ projectm WaveformMath::GetVertices’ sample preparation: copy, scale byscale/128, IIR smoothing over 512 slots.- smooth_
wave SmoothWave: “better-than-linear” smoothing, roughly doubles the vertex count.- smooth_
wave_ into smooth_waveinto a reusable buffer (cleared first).
Type Aliases§
- PmWave
Tail - Slots
NUM_WAVEFORM_SAMPLES..PM_WAVE_POINTSof projectM’s per-channel wave buffers (WaveformMath::m_pcmDataL/R).