Registered quad media on terrain
Valid convex quads from common image/video/canvas sources now combine with DEM terrain. Corners retain source-image order: top-left, top-right, bottom-right, bottom-left, and the existing bilinear Mercator mapping. Rotation and nonparallel trapezoids work. UV is inverted per terrain fragment, avoiding distortion from evaluating only coarse terrain vertices.
map.addSource('overlay', {
type: 'image', url: 'https://example.com/image.png',
coordinates: [[0, 0.02], [0.02, 0], [0, -0.02], [-0.02, 0]]
});
map.addLayer({ id: 'overlay', type: 'raster', source: 'overlay' });
map.setTerrain({ source: 'dem' });
await map.sqs.flush({ render: true });
Image sources retain HTTP decoding/updateImage; video/named Canvas retain manual RGBA frames and existing playback/pause rules. Registration does not imply pixel readiness. Coordinates, frames, layer order, opacity and exaggeration update actual pixels; stopping/rerunning uses full cleanup.
Quads must be finite, convex and noncrossing in one Mercator world. Dateline crossing, multiple-world stitching and nonconvex regions remain unsupported. Inversion has at most 12 normalized iterations; degenerate/unconverged fragments are discarded without out-of-range sampling. Existing pixel/terrain budgets apply. Outside DEM coverage, the explicit lower imagery fallback remains; elevation/coordinate queries still report actual terrain only.
The complete HTML example includes every shape/opacity/image-update/terrain control and credit, using generated data. Native and browser main thread/Worker use the same seven-check script across all three frame providers and four texture-color positions. External devices remain separate acceptance; independent URL raster styles and building/symbol draping remain pending.