forked from 1b-agent/opencadstudio-upstream
The batched hatch pass drew a screen-covering AABB quad per hatch and, for every fragment, ran a point-in-polygon ray-cast over the whole boundary plus the pattern test, with a discard that disabled early-Z. Zoomed into a hatch the quad covers the screen, so the shader re-ran per pixel every frame — the cost the PR #273 interaction-LOD worked around by suppressing hatches during navigation, which made fills flicker on and off while zooming. Triangulate each boundary once (lyon, even-odd — same coverage as the old in_polygon, islands/holes included) and rasterize those triangles instead: no screen-filling overdraw, no per-fragment boundary test. The fragment shader keeps the boundary test only on a per-instance fallback path (poly_test == 1) for boundaries that fail to tessellate. Tessellation is cached with the batch build (geometry_epoch) in local space, so the double-single relative-to-eye precision is preserved. With the fast path the interaction-LOD is no longer needed; it is gated behind OCS_HATCH_LOD (default off) as a safety net for now.