feat(mline): GPU-dash multiline elements with shared A-type alignment
MLINE dashed elements were fully CPU-expanded (apply_along) — one wire per dash — to keep the parallel lines in phase. Move pure-dash elements onto the GPU dash shader and end-align every element to the multiline's centre-line so they share one interior phase. - wire_distances now accumulates arc-length from the double-single (high+low) points, so the dash phase stays precise at UTM coordinates. f32-high-only deltas quantised ~0.1 there and drifted the parallel lines apart — the original reason MLINE dashes were CPU-side. - New WireModel.dash_align_end carries a shared begin/end dash length. The shader uses it as align_end for every parallel element (the interior phase depends on align_end, not the wire's own length) while align_total stays the element's own length, so each still ends on a dash at its own endpoint. - MLINE tessellation derives that length once from the centre-line, routes pure dash/space/dot elements to the GPU pattern and text-bearing elements to apply_along. - apply_along gained an "A"-type mode (shared reference length): a solid begin/end dash and a phased interior, so its dashes — and embedded text — line up with the GPU-dashed sibling elements instead of tiling from start. Pure-dash MLINEs now cost one WireModel + pattern per element instead of N segments; single (non-MLINE) entities keep the from-start tiling unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
743dc1026d
commit
5bd683cf4e
41 changed files with 263 additions and 14 deletions
|
|
@ -482,6 +482,7 @@ pub(crate) fn tessellate_entity(
|
|||
);
|
||||
let marker = WireModel {
|
||||
dash_from_start: false,
|
||||
dash_align_end: None,
|
||||
text_verts: Vec::new(),
|
||||
name: h.value().to_string(),
|
||||
points: vec![],
|
||||
|
|
@ -693,6 +694,9 @@ pub(crate) fn tessellate_entity(
|
|||
entity_color,
|
||||
sel,
|
||||
base.line_weight_px,
|
||||
// Single (non-MLINE) entity: keep the from-start tiling (no shared
|
||||
// A-type reference — there are no sibling elements to align with).
|
||||
None,
|
||||
);
|
||||
if !wires.is_empty() {
|
||||
for w in &mut wires {
|
||||
|
|
@ -856,6 +860,7 @@ fn lod_stub_wire(
|
|||
let stored_color = if selected { WireModel::SELECTED } else { color };
|
||||
WireModel {
|
||||
dash_from_start: false,
|
||||
dash_align_end: None,
|
||||
text_verts: Vec::new(),
|
||||
name,
|
||||
// Diagonal of the entity's 3D AABB so depth tests against
|
||||
|
|
@ -920,6 +925,7 @@ fn lod_stub_wire_3d(
|
|||
let stored_color = if selected { WireModel::SELECTED } else { color };
|
||||
WireModel {
|
||||
dash_from_start: false,
|
||||
dash_align_end: None,
|
||||
text_verts: Vec::new(),
|
||||
name,
|
||||
points,
|
||||
|
|
|
|||
Loading…
Reference in a new issue