feat(polyline): Polyline2D width band + tube, and block-instance shader bands

Extends the wide-polyline shader band to the two cases the first pass left on
the hatch pipeline.

Polyline2D:
- A flat wide Polyline2D now draws its band from the centre-line wire
  (`world_width`), same as LwPolyline (`polyline_band_width` handles both).
- A thickened wide Polyline2D extrudes a solid 3-D tube. `thick_wide_band`'s
  body moves to a shared `common::thick_band_tube(origin, fills, thickness,
  normal, to_wcs)`; LwPolyline delegates to it and Polyline2D calls it from
  its thickness path. Tube edges read black for both kinds.
- The model-space wide-band hatch loop is deleted (both kinds now wire/tube).

Blocks:
- Block-internal wide polylines draw the shader band too. `LocalWire` carries
  `world_width`; `emit_wire` scales it by the insert transform (average of the
  X/Y axis image lengths) so the band tracks a scaled insert, and the scaled
  width joins the batch `style_key`. `push_block_wide_fills` (the block hatch
  band) is removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-20 16:04:03 +03:00
commit a8aece1909
6 changed files with 161 additions and 219 deletions

View file

@ -238,6 +238,28 @@ fn tessellate_polyline2d(pl: &Polyline2D) -> TruckEntity {
let (wbx, wby, wbz) = to_wcs(ox1, oy1);
kv.push([wbx, wby, wbz]);
}
// A wide Polyline2D extrudes its whole band into a solid tube (walls +
// caps), same as a thickened LwPolyline; a zero-width one falls through
// to the centre-line extrusion below.
let is_wide = pl.start_width > 1e-9
|| pl.end_width > 1e-9
|| pl
.vertices
.iter()
.any(|v| v.start_width > 1e-9 || v.end_width > 1e-9);
if is_wide {
let (origin, fills) = wide_fills(pl);
let (fill_tris, lines) =
crate::entities::common::thick_band_tube(origin, &fills, t, normal, &to_wcs);
return TruckEntity {
pick_tris: fill_tris.clone(),
object: TruckObject::Lines(lines),
snap_pts: vec![],
tangent_geoms: tgs,
key_vertices: kv,
fill_tris,
};
}
let mut pts: Vec<[f64; 3]> = Vec::with_capacity(path.len() * 2 + kv.len() * 3 + 4);
pts.extend_from_slice(&path);
pts.push([f64::NAN; 3]);