forked from 1b-agent/opencadstudio-upstream
feat(render): double-single vertices for the mesh pipeline
3D solid / surface meshes were the last single-f32 path. truck's mesh tessellation now returns a paired verts_low residual (TruckTessResult::Mesh, polygon_to_result), MeshModel/MeshLodSet carry it, the model-space offset and block-instance transforms reconstruct the f64 position and re-split it after subtracting world_offset, MeshVertex gains position_low (location 3), and mesh.wgsl reconstructs the eye-relative position. Native SAT / ACIS / OBJ mesh paths default to a zero residual (no regression — they were never sub-f32 precise). With this every world-space pipeline (wire, hatch, image, face3d, mesh) is full double-single relative-to-eye; large-coordinate jitter is gone. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
c0f3d0de5e
commit
ddf6344dbe
10 files changed
+112
-46
No files matched your search
@@ -9,8 +9,11 @@
|
||||
pub struct MeshModel {
|
||||
/// Unique identifier (entity handle value as decimal string).
|
||||
pub name: String,
|
||||
/// World-space vertex positions.
|
||||
/// World-space vertex positions (high half of the double-single pair).
|
||||
pub verts: Vec<[f32; 3]>,
|
||||
/// Low residual paired with `verts` so meshes stay precise at UTM scale.
|
||||
/// Empty = all-zero (legacy / interactive meshes near the origin).
|
||||
pub verts_low: Vec<[f32; 3]>,
|
||||
/// Per-vertex normals (may be empty if not available).
|
||||
pub normals: Vec<[f32; 3]>,
|
||||
/// Triangle indices into `verts` (every 3 values = one triangle).
|
||||
|
||||
@@ -172,12 +172,14 @@ pub fn mesh_from_solid(solid: &Solid, color: [f32; 4]) -> Option<MeshLodSet> {
|
||||
match tessellate_solid(solid, [0.0; 3]) {
|
||||
TruckTessResult::Mesh {
|
||||
verts,
|
||||
verts_low,
|
||||
normals,
|
||||
indices,
|
||||
} if !indices.is_empty() => {
|
||||
let mesh = MeshModel {
|
||||
name: String::new(),
|
||||
verts,
|
||||
verts_low,
|
||||
normals,
|
||||
indices,
|
||||
color,
|
||||
|
||||
Reference in new issue
Block a user