refactor(tess): move per-entity tessellation into entities/

Each entity's tessellation now lives alongside its definition in
entities/*.rs, attached to the entity type via a local trait:

  LegacyTess     — Viewport / Insert / Hatch / Ole2Frame
                   (fallback path for entities not on the truck pipeline)
  LeaderTess     — Leader
  MultiLeaderTess — MultiLeader
  DimensionTess  — Dimension (carries its dim-only helpers too:
                   ~1700 lines of dim_geometry, dim_text_*, format_*,
                   tolerance, suppression, etc.)

scene/tessellate.rs keeps only the cross-entity dispatcher plus the
shared dim machinery reused by leader/multileader/dimension
(ArrowKind, DimGeom, append_arrow, arrow_from_block, add_segment,
add_polyline, normalized_or, push_tri, color_or_inherit, entity_z,
offset_snap_pts). Cross-entity arc helpers + aci_to_rgba moved to
scene/tess_util.rs.

scene/tessellate.rs shrinks from ~3300 to 809 lines. Compile clean,
all 9 tests pass.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-05-23 23:12:27 +03:00
1 parent 163725ca22
commit aadb64860d
12 files changed
+3016 -2832

No files matched your search

+24
View File
@@ -118,3 +118,27 @@ impl Transformable for Insert {
apply_transform(self, t);
}
}
impl crate::entities::traits::LegacyTess for Insert {
fn legacy_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::LegacyGeometry {
let [ox, oy, oz] = world_offset;
let ip = Vec3::new(
(self.insert_point.x - ox) as f32,
(self.insert_point.y - oy) as f32,
(self.insert_point.z - oz) as f32,
);
let s = 0.1_f32;
let pts = vec![
[ip.x - s, ip.y, ip.z],
[ip.x + s, ip.y, ip.z],
[ip.x, ip.y - s, ip.z],
[ip.x, ip.y + s, ip.z],
];
(
pts,
vec![(ip, crate::scene::wire_model::SnapHint::Insertion)],
vec![],
vec![],
)
}
}