refactor(tess): move solid sampling to kernel

Remove local face, edge, spline, sweep, loft, and silhouette
samplers. Meshes and overlays share the kernel tolerance and edge
schedule.
This commit is contained in:
Hakan Seven committed 2026-08-10 10:18:53 +03:00
1 parent 60f5bca0d4
commit dc998fe46b
15 files changed
+410 -3938

No files matched your search

+4 -76
View File
@@ -42,76 +42,10 @@ pub struct MeshModel {
///
/// `lods` holds up to one MeshModel per LOD level (high → low). Empty
/// slots fall back to the nearest available LOD at render time.
/// A curved face's generator, kept so a view-dependent silhouette (DISPSILH)
/// can be computed per frame — the silhouette is where the surface turns away
/// from the eye, which no baked edge can capture. World-space, post body
/// transform; base/centre points carry a double-single low half so they stay
/// precise at UTM scale like the mesh verts. Each variant also carries the
/// face's parametric extent so the silhouette is clipped to the actual face
/// rather than drawn across the whole (possibly partial) surface.
#[derive(Clone, Copy, Debug)]
pub enum CurvedGen {
/// Cone / cylinder: two edge-on lines up the surface.
Cone {
base: [f32; 3],
base_low: [f32; 3],
axis: [f32; 3],
/// Radial frame: `u` is the θ=0 direction, `v = axis × u`.
u_dir: [f32; 3],
v_dir: [f32; 3],
/// Radius at the base (`h = 0`).
radius: f32,
/// `tan(half-angle)`: radius at height `h` is `radius + h * tan_a`.
tan_a: f32,
/// Height span along the axis the face covers (base is `h = 0`).
h_max: f32,
theta_min: f32,
theta_span: f32,
full: bool,
},
/// Sphere: the great circle perpendicular to the view, clipped to the
/// face's longitude/colatitude window.
Sphere {
center: [f32; 3],
center_low: [f32; 3],
pole: [f32; 3],
u_dir: [f32; 3],
v_dir: [f32; 3],
radius: f32,
theta_min: f32,
theta_span: f32,
full: bool,
phi_min: f32,
phi_max: f32,
},
/// Torus: view-dependent tube silhouette, clipped to both parametric
/// windows the face covers.
Torus {
center: [f32; 3],
center_low: [f32; 3],
axis: [f32; 3],
u_dir: [f32; 3],
v_dir: [f32; 3],
major: f32,
minor: f32,
phi_min: f32,
phi_span: f32,
full: bool,
theta_min: f32,
theta_span: f32,
theta_full: bool,
},
}
/// Kernel-owned source for a view-dependent silhouette.
#[derive(Clone, Debug)]
pub struct StoredSilhouette {
pub viewport_id: i64,
pub view_direction: [f32; 3],
pub up_vector: [f32; 3],
pub target: [f32; 3],
pub is_perspective: bool,
pub edge_verts: Vec<[f32; 3]>,
pub edge_verts_low: Vec<[f32; 3]>,
pub struct CurvedGen {
pub source: acadrust::kernel::brep::mesh::SilhouetteSource,
}
#[derive(Clone, Copy, Debug, Default)]
@@ -149,13 +83,8 @@ pub struct MeshLodSet {
pub edge_verts: Vec<[f32; 3]>,
/// Low residual paired with `edge_verts`.
pub edge_verts_low: Vec<[f32; 3]>,
/// Curved-face generators for per-frame silhouette (DISPSILH). Empty for a
/// solid with no curved faces, or when silhouettes aren't wanted.
/// Kernel sources for per-frame silhouettes.
pub curved_gens: Vec<CurvedGen>,
/// View-specific silhouette caches stored in COMMON_3DSOLID. They are used
/// when the decoded surface family cannot provide a live analytic
/// silhouette for the current view.
pub stored_silhouettes: Vec<StoredSilhouette>,
/// Geometry measurements calculated once from the highest available LOD.
/// Properties can read these without re-parsing or re-tessellating ACIS on
/// the UI thread.
@@ -291,7 +220,6 @@ impl MeshLodSet {
edge_verts: Vec::new(),
edge_verts_low: Vec::new(),
curved_gens: Vec::new(),
stored_silhouettes: Vec::new(),
metrics,
world_aabb,
z_aabb,