Skip to content

@modoki/engine / index / GridMesh

Interface: GridMesh

Mesh tessellation for 2D skinning rigs — turns a sprite's rectangle into a deformable triangle grid (the geometry half of "auto-rig from a sprite"). Pure + deterministic (no wall-clock/RNG, no DOM): the editor supplies sprite dimensions and an optional alpha isInside predicate; this returns texture-space verts, UVs, and a triangle index buffer ready for a .rig2d.json mesh block.

Grid tessellation (this module) is the robust default. Alpha-outline tracing + earcut triangulation (tighter silhouettes) is a planned follow-up; a grid with fully-transparent cells culled already gives a usable, artifact-free rig.

Skinning

tris

tris: number[]


uvs

uvs: number[][]


verts

verts: number[][]

Built with Modoki.