refactor(tess): rename LegacyTess → FallbackTess

The trait isn't deprecating anything — it carries the path entities
take when they're not covered by the truck topology pipeline
(Viewport, Insert, Hatch outline, Ole2Frame). "Fallback" names the
purpose; "Legacy" implied retirement that isn't actually on the
roadmap.

Same rename for LegacyGeometry → FallbackGeometry,
legacy_geometry() → fallback_geometry().

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-05-23 23:16:57 +03:00
1 parent aadb64860d
commit b413fe0efe
8 files changed
+35 -36

No files matched your search

+4 -4
View File
@@ -3,9 +3,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{diamond_grip, edit_prop as edit, parse_f64, ro_prop as ro};
use crate::entities::traits::{Grippable, LegacyTess, PropertyEditable, Transformable};
use crate::entities::traits::{Grippable, FallbackTess, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, LegacyGeometry};
use crate::scene::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry};
use crate::scene::wire_model::SnapHint;
fn properties(h: &Hatch) -> PropSection {
@@ -350,8 +350,8 @@ impl Grippable for Hatch {
}
}
impl LegacyTess for Hatch {
fn legacy_geometry(&self, world_offset: [f64; 3]) -> LegacyGeometry {
impl FallbackTess for Hatch {
fn fallback_geometry(&self, world_offset: [f64; 3]) -> FallbackGeometry {
let [ox, oy, oz] = world_offset;
let normal = (self.normal.x, self.normal.y, self.normal.z);
// Convert a 2D OCS hatch boundary point to WCS, then subtract world_offset.
+2 -2
View File
@@ -119,8 +119,8 @@ impl Transformable for Insert {
}
}
impl crate::entities::traits::LegacyTess for Insert {
fn legacy_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::LegacyGeometry {
impl crate::entities::traits::FallbackTess for Insert {
fn fallback_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset;
let ip = Vec3::new(
(self.insert_point.x - ox) as f32,
+2 -2
View File
@@ -202,8 +202,8 @@ impl Transformable for Ole2Frame {
}
}
impl crate::entities::traits::LegacyTess for Ole2Frame {
fn legacy_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::LegacyGeometry {
impl crate::entities::traits::FallbackTess for Ole2Frame {
fn fallback_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::FallbackGeometry {
// OLE objects carry a bounding rectangle in model space.
// Render a simple X-through-rectangle placeholder.
let [ox, oy, oz] = world_offset;
+6 -6
View File
@@ -3,18 +3,18 @@ use acadrust::{CadDocument, EntityType};
use crate::command::EntityTransform;
use crate::scene::acad_to_truck::TruckEntity;
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::tess_util::LegacyGeometry;
use crate::scene::tess_util::FallbackGeometry;
pub trait TruckConvertible {
fn to_truck(&self, document: &CadDocument) -> Option<TruckEntity>;
}
/// Legacy fallback geometry for entities not covered by the truck
/// topology pipeline (Viewport, Insert, Hatch outline, Ole2Frame, …).
/// Returns world-offset-relative `f32` points + snap/key vertices the
/// Fallback geometry for entities not routed through the truck topology
/// pipeline (Viewport, Insert, Hatch outline, Ole2Frame). Returns
/// world-offset-relative `f32` points + snap/key vertices the
/// dispatcher wraps into a `WireModel`.
pub trait LegacyTess {
fn legacy_geometry(&self, world_offset: [f64; 3]) -> LegacyGeometry;
pub trait FallbackTess {
fn fallback_geometry(&self, world_offset: [f64; 3]) -> FallbackGeometry;
}
pub trait Grippable {
+2 -2
View File
@@ -567,8 +567,8 @@ impl Transformable for Viewport {
}
}
impl crate::entities::traits::LegacyTess for Viewport {
fn legacy_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::LegacyGeometry {
impl crate::entities::traits::FallbackTess for Viewport {
fn fallback_geometry(&self, world_offset: [f64; 3]) -> crate::scene::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset;
let cx = (self.center.x - ox) as f32;
let cy = (self.center.y - oy) as f32;
+1 -1
View File
@@ -1275,7 +1275,7 @@ impl Scene {
return false;
}
// Block/BlockEnd are block-defn sentinels, not drawable geometry.
// Without this skip they fall through to legacy_geometry's `_`
// Without this skip they fall through to fallback_geometry's `_`
// arm and emit a 1-unit phantom segment at world_offset that
// poisons fit_all and shows up in selection.
if matches!(e, EntityType::Block(_) | EntityType::BlockEnd(_)) {
+5 -6
View File
@@ -10,14 +10,13 @@ use glam::Vec3;
use crate::scene::wire_model::{SnapHint, TangentGeom, WireModel};
/// Output of the legacy per-entity geometry path used by entities not
/// (yet) covered by the truck topology pipeline (Viewport, Insert,
/// Hatch outline, Ole2Frame, …). Tuple form preserved to avoid
/// touching every callsite when the dispatcher wraps these into a
/// WireModel.
/// Output of the fallback per-entity geometry path used by entities not
/// covered by the truck topology pipeline (Viewport, Insert, Hatch
/// outline, Ole2Frame). Tuple form preserved to avoid touching every
/// callsite when the dispatcher wraps these into a WireModel.
///
/// Layout: `(points, snap_pts, tangent_geoms, key_vertices)`.
pub type LegacyGeometry = (
pub type FallbackGeometry = (
Vec<[f32; 3]>,
Vec<(Vec3, SnapHint)>,
Vec<TangentGeom>,
+13 -13
View File
@@ -10,8 +10,8 @@
// TruckTessResult::Mesh → MeshModel
// TruckObject::Text → one WireModel per glyph stroke (elevation from entity Z)
//
// Entities not handled by acad_to_truck (Viewport, Hatch, …) are tessellated
// by the legacy geometry() path so nothing regresses.
// Entities not handled by acad_to_truck (Viewport, Insert, Hatch, Ole2Frame)
// are tessellated by the FallbackTess fallback_geometry() path.
use crate::entities::leader::LeaderTess;
use acadrust::types::Color as AcadColor;
@@ -428,8 +428,8 @@ pub fn tessellate(
}
}
// ── Legacy fallback for Viewport and other unhandled types ────────────
let (points, snap_pts, tangent_geoms, key_vertices) = legacy_geometry(entity, world_offset);
// ── Fallback for Viewport / Insert / Hatch / Ole2Frame ────────────────
let (points, snap_pts, tangent_geoms, key_vertices) = fallback_geometry(entity, world_offset);
vec![WireModel {
name,
points,
@@ -603,21 +603,21 @@ pub(crate) fn entity_z(entity: &EntityType) -> f32 {
}
}
// ── Legacy geometry (Viewport, Hatch outline, unrecognised) ───────────────
// ── Fallback geometry (Viewport, Insert, Hatch outline, Ole2Frame) ───────
//
// Per-entity blocks have moved to their respective `entities/*.rs` files
// (Viewport, Insert, Hatch, Ole2Frame) via the `LegacyTess` trait. This
// (Viewport, Insert, Hatch, Ole2Frame) via the `FallbackTess` trait. This
// function stays as the dispatcher used by the main `tessellate()` path.
use crate::entities::traits::LegacyTess;
use crate::scene::tess_util::LegacyGeometry as Geometry;
use crate::entities::traits::FallbackTess;
use crate::scene::tess_util::FallbackGeometry as Geometry;
fn legacy_geometry(entity: &EntityType, world_offset: [f64; 3]) -> Geometry {
fn fallback_geometry(entity: &EntityType, world_offset: [f64; 3]) -> Geometry {
match entity {
EntityType::Viewport(vp) => vp.legacy_geometry(world_offset),
EntityType::Insert(ins) => ins.legacy_geometry(world_offset),
EntityType::Hatch(h) => h.legacy_geometry(world_offset),
EntityType::Ole2Frame(ole) => ole.legacy_geometry(world_offset),
EntityType::Viewport(vp) => vp.fallback_geometry(world_offset),
EntityType::Insert(ins) => ins.fallback_geometry(world_offset),
EntityType::Hatch(h) => h.fallback_geometry(world_offset),
EntityType::Ole2Frame(ole) => ole.fallback_geometry(world_offset),
_ => {
let s = 0.5_f32;
(vec![[-s, 0.0, 0.0], [s, 0.0, 0.0]], vec![], vec![], vec![])