forked from 1b-agent/opencadstudio-upstream
feat(render): draw ACIS solids as B-rep feature edges, meshes as tri edges
Solid wireframes rendered every triangle edge of the tessellation, so a curved solid read as a dense mesh instead of its real outline. Now each ACIS solid's B-rep face-boundary edges are collected from the SAT `edge` records (straight edges as segments, ellipse/circle edges sampled along their bounded arc), body-transformed and split into the double-single pair, and stored on the MeshLodSet. The block-instance and top-level offset paths transform these edges alongside the mesh vertices. The batch builder routes a solid with feature edges into a dedicated LineList vertex buffer and skips its triangle wireframe; a mesh with no B-rep edges keeps its triangulation edges. Edge colour follows the display mode: the flat `fs_edge` shader draws the entity colour in the lines-only modes (wireframe, hidden-line) and a `fs_edge_black` twin forces black for the edge overlay in filled render modes. Verified: the Clinic storefront arch bars now yield ~14-16 clean edge segments (vs the full triangulation) bounded to the solid's true extent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
a08cf477c1
commit
1065bc12b2
6 files changed
+285
-63
No files matched your search
@@ -39,6 +39,13 @@ pub struct MeshModel {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MeshLodSet {
|
||||
pub lods: Vec<MeshModel>,
|
||||
/// Feature-edge line list (LOD-independent): pairs of endpoints, high half
|
||||
/// of the double-single. Populated for ACIS solids (the B-rep face-boundary
|
||||
/// edges) so their wireframe shows real edges rather than the triangulation.
|
||||
/// Empty for plain meshes — those fall back to triangle edges at batch time.
|
||||
pub edge_verts: Vec<[f32; 3]>,
|
||||
/// Low residual paired with `edge_verts`.
|
||||
pub edge_verts_low: Vec<[f32; 3]>,
|
||||
/// World XY AABB `[min_x, min_y, max_x, max_y]` of the mesh — used
|
||||
/// by the per-frame LOD selector to compute the projected pixel
|
||||
/// diagonal.
|
||||
@@ -76,7 +83,13 @@ impl MeshLodSet {
|
||||
/// Build a set from its LODs, computing the 3D AABB.
|
||||
pub fn from_lods(lods: Vec<MeshModel>) -> Self {
|
||||
let (world_aabb, z_aabb) = compute_mesh_aabb(&lods);
|
||||
Self { lods, world_aabb, z_aabb }
|
||||
Self {
|
||||
lods,
|
||||
edge_verts: Vec::new(),
|
||||
edge_verts_low: Vec::new(),
|
||||
world_aabb,
|
||||
z_aabb,
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrap a single MeshModel as a one-LOD set. Used by interactive
|
||||
|
||||
Reference in new issue
Block a user