From 97d69937689f1dc4dde79ed6578020e211c216ad Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 23 Jun 2026 17:08:54 +0300 Subject: [PATCH] refactor(wire): add WireModel.points_low parallel buffer (empty default) Foundation for double-single positions: WireModel now carries an index-paired f32 residual buffer (`points_low`) next to the existing `points` high half. Empty means "all-zero residual", so every existing constructor (interactive draw, previews) is unchanged in behaviour; tessellation from CAD f64 will fill it in the next steps so vertex precision survives at UTM-scale coordinates. Co-Authored-By: Claude Opus 4.7 --- src/app/update.rs | 2 ++ src/entities/dimension.rs | 5 +++++ src/entities/leader.rs | 2 ++ src/entities/multileader.rs | 6 ++++++ src/entities/table.rs | 1 + src/modules/annotate/aligned_dim.rs | 2 ++ src/modules/annotate/angular_dim.rs | 1 + src/modules/annotate/diameter_dim.rs | 1 + src/modules/annotate/dim_baseline.rs | 1 + src/modules/annotate/dim_continue.rs | 1 + src/modules/annotate/dimjogline.rs | 1 + src/modules/annotate/dimtedit.rs | 1 + src/modules/annotate/leader_cmd.rs | 1 + src/modules/annotate/linear_dim.rs | 1 + src/modules/annotate/mleader_cmd.rs | 1 + src/modules/annotate/mleader_edit.rs | 1 + src/modules/annotate/qdim.rs | 1 + src/modules/annotate/radius_dim.rs | 1 + src/modules/annotate/table_cmd.rs | 1 + src/modules/annotate/tolerance_cmd.rs | 1 + src/modules/draw/draw/attdef.rs | 1 + src/modules/draw/draw/ellipse.rs | 1 + src/modules/draw/draw/line.rs | 1 + src/modules/draw/draw/mline.rs | 1 + src/modules/draw/draw/raster_image.rs | 1 + src/modules/draw/draw/ray.rs | 2 ++ src/modules/draw/draw/revcloud.rs | 1 + src/modules/draw/draw/wipeout.rs | 2 ++ src/modules/draw/inquiry/area.rs | 1 + src/modules/draw/inquiry/dist.rs | 1 + src/modules/layout/mview.rs | 1 + src/modules/model/primitive_cmd.rs | 1 + src/modules/view/plot_window.rs | 1 + src/modules/view/zoom_window.rs | 1 + src/scene/cache/block_cache.rs | 1 + src/scene/convert/tessellate.rs | 8 ++++++++ src/scene/mod.rs | 5 +++++ src/scene/model/wire_model.rs | 10 +++++++++- src/scene/text/complex_lt.rs | 1 + 39 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/app/update.rs b/src/app/update.rs index d6759e3a9..55647b9b2 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -3055,6 +3055,7 @@ impl OpenCADStudio { [far_neg.x, far_neg.y, far_neg.z], [far_pos.x, far_pos.y, far_pos.z], ], + points_low: Vec::new(), color: [0.2, 0.7, 0.9, 0.6], selected: false, aci: 0, @@ -3086,6 +3087,7 @@ impl OpenCADStudio { [far_neg.x, far_neg.y, far_neg.z], [far_pos.x, far_pos.y, far_pos.z], ], + points_low: Vec::new(), color: [0.2, 0.9, 0.5, 0.6], selected: false, aci: 0, diff --git a/src/entities/dimension.rs b/src/entities/dimension.rs index 59057d42d..14bac4271 100644 --- a/src/entities/dimension.rs +++ b/src/entities/dimension.rs @@ -1158,6 +1158,7 @@ fn tessellate_dimension_inner( wires.push(WireModel { name: name.clone(), points: ext1, + points_low: Vec::new(), color: ext_color, selected, aci: 0, @@ -1177,6 +1178,7 @@ fn tessellate_dimension_inner( wires.push(WireModel { name: name.clone(), points: ext2, + points_low: Vec::new(), color: ext_color, selected, aci: 0, @@ -1196,6 +1198,7 @@ fn tessellate_dimension_inner( wires.push(WireModel { name: name.clone(), points: geom.ext_lines, + points_low: Vec::new(), color: ext_color, selected, aci: 0, @@ -1216,6 +1219,7 @@ fn tessellate_dimension_inner( wires.push(WireModel { name: name.clone(), points: geom.dim_lines, + points_low: Vec::new(), color: dim_color, selected, aci: 0, @@ -1247,6 +1251,7 @@ fn tessellate_dimension_inner( wires.push(WireModel { name: name.clone(), points: vec![], + points_low: Vec::new(), color: fill_color, selected, aci: 0, diff --git a/src/entities/leader.rs b/src/entities/leader.rs index 47ef8e972..c810312f9 100644 --- a/src/entities/leader.rs +++ b/src/entities/leader.rs @@ -603,6 +603,7 @@ impl LeaderTess for Leader { return WireModel { name, points: vec![], + points_low: Vec::new(), color, selected, aci: 0, @@ -701,6 +702,7 @@ impl LeaderTess for Leader { WireModel { name, points, + points_low: Vec::new(), color, selected, aci: 0, diff --git a/src/entities/multileader.rs b/src/entities/multileader.rs index d174edcc6..e8a53d2d2 100644 --- a/src/entities/multileader.rs +++ b/src/entities/multileader.rs @@ -1295,6 +1295,7 @@ impl MultiLeaderTess for MultiLeader { wires.push(WireModel { name: name.clone(), points, + points_low: Vec::new(), color: line_color, selected, aci: 0, @@ -1541,6 +1542,7 @@ impl MultiLeaderTess for MultiLeader { wires.push(WireModel { name: name.clone(), points: vec![p0, p1], + points_low: Vec::new(), color: text_color, selected, aci: 0, @@ -1581,6 +1583,7 @@ impl MultiLeaderTess for MultiLeader { wires.push(WireModel { name: name.clone(), points: vec![], + points_low: Vec::new(), color: text_color, selected, aci: 0, @@ -1619,6 +1622,7 @@ impl MultiLeaderTess for MultiLeader { wires.push(WireModel { name: name.clone(), points: text_points, + points_low: Vec::new(), color: text_color, selected, aci: 0, @@ -1676,6 +1680,7 @@ impl MultiLeaderTess for MultiLeader { wires.push(WireModel { name: name.clone(), points: vec![], + points_low: Vec::new(), color: fill_color, selected, aci: 0, @@ -1704,6 +1709,7 @@ impl MultiLeaderTess for MultiLeader { wires.push(WireModel { name, points: frame_points, + points_low: Vec::new(), color: text_color, selected, aci: 0, diff --git a/src/entities/table.rs b/src/entities/table.rs index 1d3a18fe0..8c8959a96 100644 --- a/src/entities/table.rs +++ b/src/entities/table.rs @@ -702,6 +702,7 @@ pub fn tessellate_table( WireModel { name: name.clone(), points, + points_low: Vec::new(), color, selected, pattern_length: 0.0, diff --git a/src/modules/annotate/aligned_dim.rs b/src/modules/annotate/aligned_dim.rs index 6635b8488..507cdeb4f 100644 --- a/src/modules/annotate/aligned_dim.rs +++ b/src/modules/annotate/aligned_dim.rs @@ -94,6 +94,7 @@ impl CadCommand for AlignedDimensionCommand { Some(WireModel { name: "dimaligned_preview".into(), points: vec![[p1.x, p1.y, p1.z], [p2.x, p2.y, p2.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, @@ -134,6 +135,7 @@ fn preview_aligned(p1: Vec3, p2: Vec3, dim_pt: Vec3) -> WireModel { [d1.x, d1.y, d1.z], [d2.x, d2.y, d2.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/angular_dim.rs b/src/modules/annotate/angular_dim.rs index dcdb559b7..6f151747b 100644 --- a/src/modules/annotate/angular_dim.rs +++ b/src/modules/annotate/angular_dim.rs @@ -126,6 +126,7 @@ fn preview_wire(points: Vec) -> WireModel { WireModel { name: "dimangular_preview".to_string(), points: points.into_iter().map(|p| [p.x, p.y, p.z]).collect(), + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/diameter_dim.rs b/src/modules/annotate/diameter_dim.rs index ef0021149..d3812c6d8 100644 --- a/src/modules/annotate/diameter_dim.rs +++ b/src/modules/annotate/diameter_dim.rs @@ -97,6 +97,7 @@ fn preview_line(a: Vec3, b: Vec3) -> WireModel { WireModel { name: "dimdia_preview".into(), points: vec![[a.x, a.y, a.z], [b.x, b.y, b.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/dim_baseline.rs b/src/modules/annotate/dim_baseline.rs index c21e8aebe..1d05c5b43 100644 --- a/src/modules/annotate/dim_baseline.rs +++ b/src/modules/annotate/dim_baseline.rs @@ -155,6 +155,7 @@ impl CadCommand for DimBaselineCommand { [dim_line_pt.x, dim_line_pt.y, dim_line_pt.z], [dim_line_pt2.x, dim_line_pt2.y, dim_line_pt2.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/dim_continue.rs b/src/modules/annotate/dim_continue.rs index 9cf52e817..4ac5d5a73 100644 --- a/src/modules/annotate/dim_continue.rs +++ b/src/modules/annotate/dim_continue.rs @@ -135,6 +135,7 @@ impl CadCommand for DimContinueCommand { [dim_line_pt.x, dim_line_pt.y, dim_line_pt.z], [dim_line_pt2.x, dim_line_pt2.y, dim_line_pt2.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/dimjogline.rs b/src/modules/annotate/dimjogline.rs index 243f3e949..65ccda901 100644 --- a/src/modules/annotate/dimjogline.rs +++ b/src/modules/annotate/dimjogline.rs @@ -92,6 +92,7 @@ impl CadCommand for DimJogLineCommand { [pt.x + d * 0.3, pt.y, pt.z - d], [pt.x + d, pt.y, pt.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/dimtedit.rs b/src/modules/annotate/dimtedit.rs index 85b708757..ba39aae81 100644 --- a/src/modules/annotate/dimtedit.rs +++ b/src/modules/annotate/dimtedit.rs @@ -106,6 +106,7 @@ impl CadCommand for DimTeditCommand { [pt.x - d, pt.y, pt.z + d], [pt.x - d, pt.y, pt.z - d], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/leader_cmd.rs b/src/modules/annotate/leader_cmd.rs index b618f2f19..e58fe490b 100644 --- a/src/modules/annotate/leader_cmd.rs +++ b/src/modules/annotate/leader_cmd.rs @@ -165,6 +165,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel { WireModel { name: "leader_preview".into(), points, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/linear_dim.rs b/src/modules/annotate/linear_dim.rs index cc2ccfed2..b56d8b7a5 100644 --- a/src/modules/annotate/linear_dim.rs +++ b/src/modules/annotate/linear_dim.rs @@ -133,6 +133,7 @@ fn preview_wire(points: Vec) -> WireModel { WireModel { name: "dimlinear_preview".to_string(), points: points.into_iter().map(|p| [p.x, p.y, p.z]).collect(), + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/mleader_cmd.rs b/src/modules/annotate/mleader_cmd.rs index 8762de559..00c3d4769 100644 --- a/src/modules/annotate/mleader_cmd.rs +++ b/src/modules/annotate/mleader_cmd.rs @@ -151,6 +151,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel { WireModel { name: "mleader_preview".into(), points, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/mleader_edit.rs b/src/modules/annotate/mleader_edit.rs index eec4568b0..2a3ff4f27 100644 --- a/src/modules/annotate/mleader_edit.rs +++ b/src/modules/annotate/mleader_edit.rs @@ -458,6 +458,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel { WireModel { name: "mleader_edit_preview".into(), points: pts.iter().map(|p| [p.x, p.y, p.z]).collect(), + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/qdim.rs b/src/modules/annotate/qdim.rs index 7e7e3803c..64a682ccf 100644 --- a/src/modules/annotate/qdim.rs +++ b/src/modules/annotate/qdim.rs @@ -90,6 +90,7 @@ impl CadCommand for QdimCommand { Some(WireModel { name: "qdim_preview".into(), points: vec![[pt.x - d * 3.0, pt.y, pt.z], [pt.x + d * 3.0, pt.y, pt.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/radius_dim.rs b/src/modules/annotate/radius_dim.rs index d81dfef7c..9e56aca82 100644 --- a/src/modules/annotate/radius_dim.rs +++ b/src/modules/annotate/radius_dim.rs @@ -102,6 +102,7 @@ fn preview_wire(points: Vec) -> WireModel { WireModel { name: "dimradius_preview".to_string(), points: points.into_iter().map(|p| [p.x, p.y, p.z]).collect(), + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/table_cmd.rs b/src/modules/annotate/table_cmd.rs index 0b44731f9..416109dad 100644 --- a/src/modules/annotate/table_cmd.rs +++ b/src/modules/annotate/table_cmd.rs @@ -150,6 +150,7 @@ impl CadCommand for TableCommand { [x, y, z - h], [x, y, z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/annotate/tolerance_cmd.rs b/src/modules/annotate/tolerance_cmd.rs index 346f9d062..395a7dd4e 100644 --- a/src/modules/annotate/tolerance_cmd.rs +++ b/src/modules/annotate/tolerance_cmd.rs @@ -92,6 +92,7 @@ impl CadCommand for ToleranceCommand { [pt.x, pt.y, pt.z - d], [pt.x, pt.y, pt.z + d], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/attdef.rs b/src/modules/draw/draw/attdef.rs index 24f1014c4..dd56da3fd 100644 --- a/src/modules/draw/draw/attdef.rs +++ b/src/modules/draw/draw/attdef.rs @@ -168,6 +168,7 @@ impl CadCommand for AttdefCommand { [pt.x, pt.y, pt.z - d], [pt.x, pt.y, pt.z + d], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/ellipse.rs b/src/modules/draw/draw/ellipse.rs index 01fdb67c6..576a3a60e 100644 --- a/src/modules/draw/draw/ellipse.rs +++ b/src/modules/draw/draw/ellipse.rs @@ -613,6 +613,7 @@ fn line_wire(from: Vec3, to: Vec3) -> WireModel { WireModel { name: "rubber_band".into(), points: vec![[from.x, from.y, from.z], [to.x, to.y, to.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/line.rs b/src/modules/draw/draw/line.rs index 8617b90a8..de3e6c4eb 100644 --- a/src/modules/draw/draw/line.rs +++ b/src/modules/draw/draw/line.rs @@ -78,6 +78,7 @@ impl CadCommand for LineCommand { Some(WireModel { name: "rubber_band".to_string(), points: vec![[last.x, last.y, last.z], [pt.x, pt.y, pt.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/mline.rs b/src/modules/draw/draw/mline.rs index 7539aee09..f4b8c9e34 100644 --- a/src/modules/draw/draw/mline.rs +++ b/src/modules/draw/draw/mline.rs @@ -133,6 +133,7 @@ impl CadCommand for MlineCommand { Some(WireModel { name: "mline_preview".into(), points: pts, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/raster_image.rs b/src/modules/draw/draw/raster_image.rs index c5e210a0d..cbd5e667e 100644 --- a/src/modules/draw/draw/raster_image.rs +++ b/src/modules/draw/draw/raster_image.rs @@ -110,6 +110,7 @@ impl CadCommand for ImageCommand { Some(WireModel { name: "image_preview".into(), points: vec![p0, p1, p2, p3, p0], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/ray.rs b/src/modules/draw/draw/ray.rs index 39d733aed..7debccdd6 100644 --- a/src/modules/draw/draw/ray.rs +++ b/src/modules/draw/draw/ray.rs @@ -76,6 +76,7 @@ impl CadCommand for RayCommand { Some(WireModel { name: "ray_preview".into(), points: vec![[base.x, base.y, base.z], [far.x, far.y, far.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, @@ -157,6 +158,7 @@ impl CadCommand for XLineCommand { [far_neg.x, far_neg.y, far_neg.z], [far_pos.x, far_pos.y, far_pos.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/revcloud.rs b/src/modules/draw/draw/revcloud.rs index f1ab91613..ef657d4e6 100644 --- a/src/modules/draw/draw/revcloud.rs +++ b/src/modules/draw/draw/revcloud.rs @@ -82,6 +82,7 @@ impl CadCommand for RevCloudCommand { Some(WireModel { name: "revcloud_preview".into(), points: preview_pts, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/draw/wipeout.rs b/src/modules/draw/draw/wipeout.rs index 0d75c39e6..4643efe20 100644 --- a/src/modules/draw/draw/wipeout.rs +++ b/src/modules/draw/draw/wipeout.rs @@ -122,6 +122,7 @@ impl CadCommand for WipeoutCommand { [min.x, max.y, max.z], [min.x, min.y, min.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, @@ -148,6 +149,7 @@ impl CadCommand for WipeoutCommand { Some(WireModel { name: "wipeout_poly_preview".into(), points: pts, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/inquiry/area.rs b/src/modules/draw/inquiry/area.rs index 5d61b153a..6c2c402da 100644 --- a/src/modules/draw/inquiry/area.rs +++ b/src/modules/draw/inquiry/area.rs @@ -66,6 +66,7 @@ impl CadCommand for AreaCommand { Some(WireModel { name: "area_preview".into(), points: pts, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/draw/inquiry/dist.rs b/src/modules/draw/inquiry/dist.rs index 96523b6e9..060f0cfed 100644 --- a/src/modules/draw/inquiry/dist.rs +++ b/src/modules/draw/inquiry/dist.rs @@ -61,6 +61,7 @@ impl CadCommand for DistCommand { Some(WireModel { name: "dist_preview".into(), points: vec![[p1.x, p1.y, p1.z], [pt.x, pt.y, pt.z]], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/layout/mview.rs b/src/modules/layout/mview.rs index ea4c844f0..5a394d442 100644 --- a/src/modules/layout/mview.rs +++ b/src/modules/layout/mview.rs @@ -88,6 +88,7 @@ impl CadCommand for MviewCommand { [c1.x, pt.y, c1.z], [c1.x, c1.y, c1.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/model/primitive_cmd.rs b/src/modules/model/primitive_cmd.rs index 160ffd9ee..d5723524c 100644 --- a/src/modules/model/primitive_cmd.rs +++ b/src/modules/model/primitive_cmd.rs @@ -307,6 +307,7 @@ fn wire(name: &str, points: Vec<[f32; 3]>) -> WireModel { WireModel { name: name.into(), points, + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/view/plot_window.rs b/src/modules/view/plot_window.rs index 2af83afa1..412cdcc56 100644 --- a/src/modules/view/plot_window.rs +++ b/src/modules/view/plot_window.rs @@ -59,6 +59,7 @@ impl CadCommand for PlotWindowCommand { [p1.x, pt.y, pt.z], [p1.x, p1.y, p1.z], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/modules/view/zoom_window.rs b/src/modules/view/zoom_window.rs index 12c40a7a4..21d478d5e 100644 --- a/src/modules/view/zoom_window.rs +++ b/src/modules/view/zoom_window.rs @@ -59,6 +59,7 @@ impl CadCommand for ZoomWindowCommand { [min.x, max.y, 0.0], [min.x, min.y, 0.0], ], + points_low: Vec::new(), color: WireModel::CYAN, selected: false, pattern_length: 0.0, diff --git a/src/scene/cache/block_cache.rs b/src/scene/cache/block_cache.rs index 1cecf77c4..a255e5f39 100644 --- a/src/scene/cache/block_cache.rs +++ b/src/scene/cache/block_cache.rs @@ -1106,6 +1106,7 @@ impl Batches { WireModel { name: name.to_string(), points: b.points, + points_low: Vec::new(), color, selected, pattern_length: b.pattern_length, diff --git a/src/scene/convert/tessellate.rs b/src/scene/convert/tessellate.rs index 8ee326d52..15d9d992e 100644 --- a/src/scene/convert/tessellate.rs +++ b/src/scene/convert/tessellate.rs @@ -169,6 +169,7 @@ pub fn tessellate( return vec![WireModel { name, points: Vec::new(), + points_low: Vec::new(), color, selected, pattern_length: 0.0, @@ -207,6 +208,7 @@ pub fn tessellate( out.push(WireModel { name: name.clone(), points: pts, + points_low: Vec::new(), color: wire_color, selected, pattern_length: 0.0, @@ -248,6 +250,7 @@ pub fn tessellate( [x, y - s, z], [x, y + s, z], ], + points_low: Vec::new(), color, selected, pattern_length: 0.0, @@ -279,6 +282,7 @@ pub fn tessellate( return vec![WireModel { name, points, + points_low: Vec::new(), color, selected, pattern_length, @@ -308,6 +312,7 @@ pub fn tessellate( return vec![WireModel { name, points, + points_low: Vec::new(), color, selected, pattern_length, @@ -355,6 +360,7 @@ pub fn tessellate( return vec![WireModel { name, points: local_pts, + points_low: Vec::new(), color, selected, pattern_length: 0.0, @@ -392,6 +398,7 @@ pub fn tessellate( return vec![WireModel { name, points: local_pts, + points_low: Vec::new(), color, selected, pattern_length, @@ -432,6 +439,7 @@ pub fn tessellate( vec![WireModel { name, points, + points_low: Vec::new(), color, selected, aci: 0, diff --git a/src/scene/mod.rs b/src/scene/mod.rs index d27743d76..e1d18c888 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -8196,6 +8196,7 @@ fn tessellate_entity( let marker = WireModel { name: h.value().to_string(), points: vec![], + points_low: Vec::new(), color: entity_color, selected: sel, aci: 0, @@ -8407,6 +8408,7 @@ fn tessellate_entity( return vec![WireModel { name: h.value().to_string(), points: pts, + points_low: Vec::new(), color: entity_color, selected: sel, aci, @@ -8444,6 +8446,7 @@ fn tessellate_entity( return vec![WireModel { name: h.value().to_string(), points: vec![], + points_low: Vec::new(), color: fill_color, selected: sel, aci, @@ -8552,6 +8555,7 @@ fn lod_stub_wire( // different elevation. 2D entities (text fallbacks) pass // z_min = z_max = 0 to keep the historical behaviour. points: vec![[ax, ay, z_min], [bx, by, z_max]], + points_low: Vec::new(), color: stored_color, selected, aci, @@ -8607,6 +8611,7 @@ fn lod_stub_wire_3d( WireModel { name, points, + points_low: Vec::new(), color: stored_color, selected, aci, diff --git a/src/scene/model/wire_model.rs b/src/scene/model/wire_model.rs index 9e82536f2..a6775c0cd 100644 --- a/src/scene/model/wire_model.rs +++ b/src/scene/model/wire_model.rs @@ -34,8 +34,14 @@ pub enum TangentGeom { pub struct WireModel { /// Unique identifier — the handle value as a decimal string. pub name: String, - /// Ordered world-space positions forming a strip of quads. + /// Ordered world-space positions forming a strip of quads. Each entry is + /// the "high" half of a double-single f32 pair; [`points_low`] carries the + /// matching residual so the shader can reconstruct the f64 source. pub points: Vec<[f32; 3]>, + /// Low-bit residual paired index-for-index with [`points`]. Empty means + /// "all-zero residual" (interactive draw / preview wires whose coordinates + /// don't need sub-f32 precision). Tessellation from CAD f64 fills it. + pub points_low: Vec<[f32; 3]>, /// RGBA colour in [0, 1]. pub color: [f32; 4], /// Whether this wire is currently selected. @@ -94,6 +100,7 @@ impl WireModel { Self { name, points, + points_low: Vec::new(), color, selected, aci: 0, @@ -216,6 +223,7 @@ impl Default for WireModel { Self { name: String::new(), points: Vec::new(), + points_low: Vec::new(), color: Self::WHITE, selected: false, pattern_length: 0.0, diff --git a/src/scene/text/complex_lt.rs b/src/scene/text/complex_lt.rs index ddafe71d8..557686277 100644 --- a/src/scene/text/complex_lt.rs +++ b/src/scene/text/complex_lt.rs @@ -210,6 +210,7 @@ pub fn apply_along( .map(|pts| WireModel { name: name.to_string(), points: pts, + points_low: Vec::new(), color, selected, pattern_length: 0.0,