forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
743dc1026d
commit
5bd683cf4e
41 files changed
+263
-14
No files matched your search
@@ -79,6 +79,13 @@ pub struct WireModel {
|
||||
/// from the START vertex with continuous phase and no A-type end forcing —
|
||||
/// DGN line styles are not end-aligned.
|
||||
pub dash_from_start: bool,
|
||||
/// Shared "A"-type end-dash length for MLINE elements. `Some(len)` makes the
|
||||
/// dash shader use `len` as the begin/end solid-dash length for EVERY
|
||||
/// parallel element (derived once from the multiline's centre-line length),
|
||||
/// while `align_total` stays each element's own length — so all elements
|
||||
/// share one interior phase (perpendicular dashes line up) yet each still
|
||||
/// ends on a dash. `None` (the default) = per-wire A-type / from-start.
|
||||
pub dash_align_end: Option<f32>,
|
||||
/// Paper-space bounding box [x0, y0, x1, y1] for GPU scissor clipping.
|
||||
/// Set only for viewport-projected wires in paper-space layouts.
|
||||
pub vp_scissor: Option<[f32; 4]>,
|
||||
@@ -158,6 +165,7 @@ impl WireModel {
|
||||
aabb: Self::UNBOUNDED_AABB,
|
||||
plinegen: true,
|
||||
dash_from_start: false,
|
||||
dash_align_end: None,
|
||||
vp_scissor: None,
|
||||
fill_tris: vec![],
|
||||
fill_tris_low: Vec::new(),
|
||||
@@ -367,6 +375,7 @@ impl Default for WireModel {
|
||||
aabb: Self::UNBOUNDED_AABB,
|
||||
plinegen: true,
|
||||
dash_from_start: false,
|
||||
dash_align_end: None,
|
||||
vp_scissor: None,
|
||||
fill_tris: Vec::new(),
|
||||
fill_tris_low: Vec::new(),
|
||||
|
||||
Reference in new issue
Block a user