Skip to main content

Module warp_mesh

Module warp_mesh 

Source
Expand description

Warp-mesh geometry and MD2’s per-vertex UV formula (milkdropfs.cpp CPlugin::ComputeGridAlphaValues, vertex setup in plugin.cpp AllocateMilkDropDX9).

The engine evaluates per-pixel code (if any) for every grid vertex and hands the resulting variables to warp_vertex_uv; presets without per-pixel code use warp_mesh_uniform. The result is the warp_uv grid in crate::FrameInput.

Conventions (identical to MD2):

  • grid is (gx+1) x (gy+1) vertices, row-major, row 0 is stored at clip y = -1 (bottom of the screen). UV v = 0 is the top of the texture, so row 0 samples v ~ 1.
  • x/y are clip-space coordinates (x*0.5+0.5 / y*-0.5+0.5 are the preset-space x/y seen by per-pixel code, before the aspect correction).

Structs§

MeshGeometry
Static mesh data: vertex positions and MD2’s rad/ang per-vertex attributes.
VertexVars
The ten per-vertex motion variables after (optional) per-pixel code (pv_zoom, pv_zoomexp, pv_rot, pv_warp, pv_cx, pv_cy, pv_dx, pv_dy, pv_sx, pv_sy).
WarpAnim
Warp-animation terms computed once per frame in ComputeGridAlphaValues.

Constants§

MAX_MESH_CELLS
Largest warp mesh (cells per axis) accepted.

Functions§

aspect_xy
(m_fAspectX, m_fAspectY) from texture size (plugin.cpp).
texel_offset_uv
texel_offset (texels) -> UV offset for a texture size, as RenderConfig defines it.
warp_mesh_uniform
The default per-vertex path (no per-pixel code): every vertex uses the same frame variables.
warp_vertex_uv
MD2’s per-vertex UV (the non-blending branch of ComputeGridAlphaValues).