fix(render): correct polyline segment widths, flat arc end caps, and zero-width endpoints

This commit is contained in:
Karim Jerbi committed 2026-09-10 12:43:25 +01:00
1 parent 6ca16738f0
commit 0ad31ece6f
8 files changed
+346 -73

No files matched your search

+5 -4
View File
@@ -43,7 +43,7 @@ struct WireConst {
align_end: f32,
align_total: f32,
world_half_width: f32,
_pad1: f32,
is_tapered: f32,
_pad2: f32,
marker_origin_high: vec4<f32>,
marker_origin_low: vec4<f32>,
@@ -152,7 +152,8 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, in: VertexIn) -> VertexOut
let rel_a = marker_relative(seg_pos_a, seg_pos_a_low, in.translation, in.translation_low);
let rel_b = marker_relative(seg_pos_b, seg_pos_b_low, in.translation, in.translation_low);
let is_world = wire_const.world_half_width > 0.0 || seg_taper_ratio.x > 0.0 || seg_taper_ratio.y > 0.0;
let is_tapered = wire_const.is_tapered > 0.5;
let is_world = wire_const.world_half_width > 0.0;
var final_clip: vec4<f32>;
var out_dist: f32;
@@ -165,8 +166,8 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, in: VertexIn) -> VertexOut
// the segment and the plane normal), so the rectangle remains hosted rigidly
// on the 3D plane when the camera rotates, orbits, or tilts, matching CAD
// behavior and circle.wgsl planar arcs.
let world_hw_a = select(wire_const.world_half_width, seg_taper_ratio.x * wire_const.world_half_width, seg_taper_ratio.x > 0.0);
let world_hw_b = select(wire_const.world_half_width, seg_taper_ratio.y * wire_const.world_half_width, seg_taper_ratio.y > 0.0);
let world_hw_a = select(wire_const.world_half_width, seg_taper_ratio.x * wire_const.world_half_width, is_tapered);
let world_hw_b = select(wire_const.world_half_width, seg_taper_ratio.y * wire_const.world_half_width, is_tapered);
let cur_world_hw = mix(world_hw_a, world_hw_b, which_end);
let eff_hw = max(cur_world_hw, 0.5 * u.world_per_pixel);