chore: drop dead scene/IO helpers + simplify XATTACH command state
* helpers::wcs_to_ucs — UCS inverse transform with zero call sites. * scene::Scene::compute_and_set_world_offset — never called; the load path uses the free function `compute_world_offset` directly. * tessellate::tessellate_mesh — never called; mesh tessellation goes through `solid3d_tess`, not the truck Shell/Solid path. * truck_tess::tess_to_mesh_model — orphaned with tessellate_mesh's removal. * MeshModel::WHITE / MeshModel::SELECTED — only used by the removed tessellate_mesh. * xattach::Step::FilePath variant — never constructed; XATTACH always enters through `with_path` after the file picker. Replaced the Step enum + prefilled_path field with flat `path` / `block_name` fields and dropped the unreachable text-input flow. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
22543e4f97
commit
a1ed87da3d
7 changed files with 19 additions and 163 deletions
|
|
@ -21,12 +21,6 @@ pub struct MeshModel {
|
|||
pub selected: bool,
|
||||
}
|
||||
|
||||
impl MeshModel {
|
||||
#[allow(dead_code)]
|
||||
pub const WHITE: [f32; 4] = [1.00, 1.00, 1.00, 1.0];
|
||||
pub const SELECTED: [f32; 4] = [0.15, 0.55, 1.00, 1.0];
|
||||
}
|
||||
|
||||
/// Bundle of mesh tessellations at different sampling densities, picked
|
||||
/// per frame by the render pipeline based on the projected pixel size of
|
||||
/// `world_aabb`. Phase 3.4 LOD ladder:
|
||||
|
|
|
|||
|
|
@ -632,14 +632,6 @@ impl Scene {
|
|||
self.geometry_epoch = GEOMETRY_EPOCH.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn compute_and_set_world_offset(&mut self) {
|
||||
let model_block = self.model_space_block_handle();
|
||||
let (offset, lim) = compute_world_offset(&self.document, model_block);
|
||||
self.world_offset = offset;
|
||||
self.local_extent_max = lim;
|
||||
}
|
||||
|
||||
/// Returns true if this viewport should display model-space content
|
||||
/// (i.e. it is a user viewport, not the sheet/overall viewport).
|
||||
///
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@ use acadrust::{CadDocument, EntityType, Handle};
|
|||
use glam::Vec3;
|
||||
|
||||
use crate::scene::acad_to_truck::{convert, TruckObject};
|
||||
use crate::scene::mesh_model::MeshModel;
|
||||
use crate::scene::truck_tess::{
|
||||
self, tessellate_edge, tessellate_solid, tessellate_vertex, tessellate_wire, TruckTessResult,
|
||||
tessellate_edge, tessellate_vertex, tessellate_wire, TruckTessResult,
|
||||
};
|
||||
use crate::scene::wire_model::{SnapHint, TangentGeom, WireModel};
|
||||
|
||||
|
|
@ -47,7 +46,8 @@ pub fn aci_to_rgba(color: &AcadColor) -> [f32; 4] {
|
|||
/// Tessellate one entity into a WireModel.
|
||||
/// For Text/MText entities this produces one WireModel with all glyph strokes
|
||||
/// encoded as NaN-separated segments (wire_gpu skips NaN pairs).
|
||||
/// For Solid3D entities this returns an empty wire; use `tessellate_mesh` instead.
|
||||
/// For Solid3D entities this returns an empty wire; mesh tessellation lives
|
||||
/// in `solid3d_tess` and is uploaded via the mesh pipeline instead.
|
||||
pub fn tessellate(
|
||||
document: &CadDocument,
|
||||
handle: Handle,
|
||||
|
|
@ -351,10 +351,11 @@ pub fn tessellate(
|
|||
}
|
||||
|
||||
TruckObject::Volume(_) => {
|
||||
// Solid3D / Region / Body → handled by tessellate_mesh().
|
||||
// As a wire fallback, render the pre-computed edge wires
|
||||
// stored in the entity when present (e.g. from SOLVIEW output
|
||||
// or when the SAT kernel cannot parse the ACIS data).
|
||||
// Solid3D / Region / Body → mesh tessellation lives in
|
||||
// `solid3d_tess`. As a wire fallback, render the pre-computed
|
||||
// edge wires stored in the entity when present (e.g. from
|
||||
// SOLVIEW output or when the SAT kernel cannot parse the
|
||||
// ACIS data).
|
||||
let wire_pts = solid_wire_fallback(entity, world_offset);
|
||||
let mut wm = WireModel::solid(name, wire_pts, color, selected);
|
||||
// Add insertion snap at point_of_reference.
|
||||
|
|
@ -1098,29 +1099,6 @@ pub fn tessellate_multileader(
|
|||
wires
|
||||
}
|
||||
|
||||
/// Tessellate a Solid3D entity into a MeshModel (truck Shell/Solid path).
|
||||
#[allow(dead_code)]
|
||||
pub fn tessellate_mesh(
|
||||
document: &CadDocument,
|
||||
handle: Handle,
|
||||
entity: &EntityType,
|
||||
selected: bool,
|
||||
color: [f32; 4],
|
||||
world_offset: [f64; 3],
|
||||
) -> Option<MeshModel> {
|
||||
let te = convert(entity, document)?;
|
||||
let result = match te.object {
|
||||
TruckObject::Volume(solid) => tessellate_solid(&solid, world_offset),
|
||||
_ => return None,
|
||||
};
|
||||
truck_tess::tess_to_mesh_model(
|
||||
result,
|
||||
handle.value().to_string(),
|
||||
if selected { MeshModel::SELECTED } else { color },
|
||||
selected,
|
||||
)
|
||||
}
|
||||
|
||||
// ── Entity Z helper ───────────────────────────────────────────────────────
|
||||
|
||||
/// Extract the Z elevation from a text/mtext entity.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ use truck_modeling::base::{BoundedCurve, ParameterDivision1D};
|
|||
use truck_modeling::{Edge, Shell, Solid, Vertex, Wire};
|
||||
use truck_polymesh::PolygonMesh;
|
||||
|
||||
use crate::scene::mesh_model::MeshModel;
|
||||
|
||||
// Chord-height tolerance used for adaptive curve sampling (world units).
|
||||
const CURVE_TOL: f64 = 0.005;
|
||||
|
|
@ -141,32 +140,6 @@ pub fn tessellate_solid(s: &Solid, offset: [f64; 3]) -> TruckTessResult {
|
|||
polygon_to_result(meshed.to_polygon(), offset)
|
||||
}
|
||||
|
||||
// ── MeshModel helper ──────────────────────────────────────────────────────
|
||||
|
||||
/// Convert a TruckTessResult::Mesh into a MeshModel (fills name/color later).
|
||||
pub fn tess_to_mesh_model(
|
||||
result: TruckTessResult,
|
||||
name: String,
|
||||
color: [f32; 4],
|
||||
selected: bool,
|
||||
) -> Option<MeshModel> {
|
||||
match result {
|
||||
TruckTessResult::Mesh {
|
||||
verts,
|
||||
normals,
|
||||
indices,
|
||||
} => Some(MeshModel {
|
||||
name,
|
||||
verts,
|
||||
normals,
|
||||
indices,
|
||||
color,
|
||||
selected,
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
// ── Internal ─────────────────────────────────────────────────────────────
|
||||
|
||||
fn polygon_to_result(mesh: PolygonMesh, offset: [f64; 3]) -> TruckTessResult {
|
||||
|
|
|
|||
Loading…
Reference in a new issue