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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-06-23 18:28:52 +03:00
1 parent a0b4968ad2
commit 97d6993768
39 files changed
+72 -1

No files matched your search

+2
View File
@@ -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,
+5
View File
@@ -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,
+2
View File
@@ -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,
+6
View File
@@ -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,
+1
View File
@@ -702,6 +702,7 @@ pub fn tessellate_table(
WireModel {
name: name.clone(),
points,
points_low: Vec::new(),
color,
selected,
pattern_length: 0.0,
+2
View File
@@ -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,
+1
View File
@@ -126,6 +126,7 @@ fn preview_wire(points: Vec<Vec3>) -> 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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -133,6 +133,7 @@ fn preview_wire(points: Vec<Vec3>) -> 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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -102,6 +102,7 @@ fn preview_wire(points: Vec<Vec3>) -> 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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+2
View File
@@ -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,
+1
View File
@@ -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,
+2
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+1
View File
@@ -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,
+8
View File
@@ -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,
+5
View File
@@ -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,
+9 -1
View File
@@ -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,
+1
View File
@@ -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,