feat(lwpolyline): render the wide-polyline band via the wire shader

A wide polyline's flat band was drawn by the hatch pipeline: a solid fill
with only draw-order depth. It ignored the entity linetype (the width
"crushed" the dash pattern) and showed through 3-D geometry in a tilted view.

Draw the band from the polyline's own centre-line wire instead. A new
`WireModel.world_width` (drawing units) makes the wire vertex shader expand
the quad by `world_half_width / world_per_pixel` (clamped to a hairline), so
the band is sized in world units and tracks zoom. Because it is now a wire:

- the GPU dash shader dashes the band by arc-length — the linetype applies;
- it is depth-tested at the polyline elevation — no draw-order see-through;
- no CPU band triangles or per-dash geometry are generated.

`world_half_width` rides in `WireConst` (native, replacing a pad) and the web
`WireInstance` (loc 14); both wire shaders branch on it. The tessellator sets
`world_width` from the LwPolyline width on the Contour / SegmentedLines arms,
and the model-space fill loop no longer emits a hatch band for any LwPolyline.
Pick still uses the band polygon (`pick_tris`).

Blocks keep the hatch band: `LocalWire` carries no `world_width` (finalize
zeroes it), so a scaled insert still scales its band correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-20 14:50:27 +03:00
1 parent 3d37e1f8d8
commit bd1a5affd7
44 files changed
+158 -17

No files matched your search

+7
View File
@@ -325,6 +325,12 @@ fn build_defn(
subs.push(LocalSub::Nested(build_nested_ref(nested_ins, doc, bg_color)));
}
_ => {
// A wide polyline inside a block keeps its thin centre-line
// here (`LocalWire` carries no `world_width`, and `finalize`
// rebuilds every block wire with `world_width: 0.0`); its band
// is drawn by the hatch pipeline (`push_block_wide_fills`),
// which transforms with the block instance so the band scales
// correctly. The shader band is a top-level-entity path only.
for lw in tessellate_sub_local(doc, entity, anno_scale, bg_color) {
subs.push(LocalSub::Wire(lw));
}
@@ -848,6 +854,7 @@ impl Batches {
// the cached defn.
let color = crate::scene::view::render::adapt_to_bg(b.color, bg_color);
WireModel {
world_width: 0.0,
fill_is_3d: false,
pick_tris: b.pick_tris,
pick_tris_low: b.pick_tris_low,