forked from 1b-agent/opencadstudio-upstream
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:
1 parent
a0b4968ad2
commit
97d6993768
39 files changed
+72
-1
No files matched your search
Vendored
+1
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user