refactor: remove the last world_offset zero-locals
Clean up the remaining `let [ox,oy,oz] = [0,0,0]` bindings and their zero-valued add/subtract arithmetic across scene/mod.rs (mesh LOD resplit, model AABB, wide-polyline fills, wipeout boundary, hatch/solid models, insert/entity AABB), table, multileader and xclip. Coordinates now read as the plain absolute values they are. No world_offset reference remains. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5b1a5a71a0
commit
ef8d5b2610
4 changed files with 54 additions and 85 deletions
|
|
@ -1127,9 +1127,8 @@ impl MultiLeaderTess for MultiLeader {
|
|||
|
||||
let name = handle.value().to_string();
|
||||
let nan = [f32::NAN; 3];
|
||||
let [ox, oy, oz] = [0.0_f64; 3];
|
||||
let p3 = |v: &acadrust::types::Vector3| -> [f32; 3] {
|
||||
[(v.x - ox) as f32, (v.y - oy) as f32, (v.z - oz) as f32]
|
||||
[(v.x) as f32, (v.y) as f32, (v.z) as f32]
|
||||
};
|
||||
|
||||
// ── Scaling ──────────────────────────────────────────────────────────────
|
||||
|
|
@ -1261,8 +1260,8 @@ impl MultiLeaderTess for MultiLeader {
|
|||
// Horizontal landing toward the text's side (mirrors live).
|
||||
let d = ml.dogleg_length * effective_scale as f64;
|
||||
let landing_end = [
|
||||
(cp.x + text_sign_w * d - ox) as f32,
|
||||
(cp.y - oy) as f32,
|
||||
(cp.x + text_sign_w * d) as f32,
|
||||
(cp.y) as f32,
|
||||
cp_f[2],
|
||||
];
|
||||
points.push(nan);
|
||||
|
|
@ -1272,8 +1271,8 @@ impl MultiLeaderTess for MultiLeader {
|
|||
// attached as the text moves.
|
||||
if ml.content_type == LeaderContentType::MText && !ml.context.text_string.is_empty()
|
||||
{
|
||||
let tx = (ml.context.text_location.x - ox) as f32;
|
||||
let ty = (ml.context.text_location.y - oy) as f32;
|
||||
let tx = (ml.context.text_location.x) as f32;
|
||||
let ty = (ml.context.text_location.y) as f32;
|
||||
points.push(landing_end);
|
||||
points.push([tx, ty, cp_f[2]]);
|
||||
}
|
||||
|
|
@ -1389,9 +1388,9 @@ impl MultiLeaderTess for MultiLeader {
|
|||
// Subtract world_offset in f64 before casting to f32: drawings often
|
||||
// sit at large absolute coordinates and casting first then subtracting
|
||||
// throws away the precision needed for the rotated sub-glyph offsets.
|
||||
let local_ins_x = (ins.x - ox) as f32;
|
||||
let local_ins_y = (ins.y - oy) as f32;
|
||||
let z = (ins.z - oz) as f32;
|
||||
let local_ins_x = (ins.x) as f32;
|
||||
let local_ins_y = (ins.y) as f32;
|
||||
let z = (ins.z) as f32;
|
||||
|
||||
// Rotation: prefer text_direction (transforms survive rotations /
|
||||
// mirrors when acadrust updates it) and fall back to text_rotation.
|
||||
|
|
|
|||
|
|
@ -354,12 +354,11 @@ pub fn tessellate_table(
|
|||
return Vec::new();
|
||||
}
|
||||
|
||||
let [ox, oy, oz] = [0.0_f64; 3];
|
||||
let rel = |p: Vec3| -> [f32; 3] {
|
||||
[
|
||||
(p.x as f64 - ox) as f32,
|
||||
(p.y as f64 - oy) as f32,
|
||||
(p.z as f64 - oz) as f32,
|
||||
(p.x as f64) as f32,
|
||||
(p.y as f64) as f32,
|
||||
(p.z as f64) as f32,
|
||||
]
|
||||
};
|
||||
let resolve_col = |c: &Color, fallback: [f32; 4]| -> [f32; 4] {
|
||||
|
|
@ -652,7 +651,7 @@ pub fn tessellate_table(
|
|||
let rot = content.map(|c| c.rotation as f32).unwrap_or(0.0) + cell.rotation as f32;
|
||||
let layout = layout_mtext(&MTextRenderOpts {
|
||||
value: text,
|
||||
insertion: [(to.x as f64 - ox), (to.y as f64 - oy), (to.z as f64 - oz)],
|
||||
insertion: [(to.x as f64), (to.y as f64), (to.z as f64)],
|
||||
height: cell_h,
|
||||
rect_w: 0.0,
|
||||
rotation: rot,
|
||||
|
|
@ -688,7 +687,7 @@ pub fn tessellate_table(
|
|||
buf.push([f32::NAN; 3]);
|
||||
}
|
||||
for &[x, y] in stroke {
|
||||
buf.push([x + sx, y + sy, (to.z as f64 - oz) as f32]);
|
||||
buf.push([x + sx, y + sy, (to.z as f64) as f32]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue