pub struct MeshGLP<P: Copy + Default, I: Copy + Default = u32> {
pub num_prop: I,
pub vert_properties: Vec<P>,
pub tri_verts: Vec<I>,
pub merge_from_vert: Vec<I>,
pub merge_to_vert: Vec<I>,
pub run_index: Vec<I>,
pub run_original_id: Vec<u32>,
pub run_transform: Vec<P>,
pub face_id: Vec<I>,
pub halfedge_tangent: Vec<P>,
pub run_flags: Vec<u8>,
pub tolerance: P,
}Expand description
GL-style mesh representation. Generic over precision (f32/f64) and index type (u32/u64).
Fields§
§num_prop: INumber of properties per vertex, always >= 3.
vert_properties: Vec<P>Flat interleaved vertex properties: [x, y, z, …] × num_verts.
tri_verts: Vec<I>Triangle vertex indices, 3 per triangle (CCW from outside).
merge_from_vert: Vec<I>Optional: merge-from vertex indices.
merge_to_vert: Vec<I>Optional: merge-to vertex indices.
run_index: Vec<I>Optional: run start indices into triVerts.
run_original_id: Vec<u32>Optional: original mesh ID per run.
run_transform: Vec<P>Optional: 3×4 column-major transform per run (12 elements each).
face_id: Vec<I>Optional: source face ID per triangle.
halfedge_tangent: Vec<P>Optional: halfedge tangent vectors (4 per halfedge).
run_flags: Vec<u8>Optional: per-run flags; 1 = backside (normals need flipping).
tolerance: PTolerance for mesh simplification.
Implementations§
Source§impl MeshGLP<f32, u32>
impl MeshGLP<f32, u32>
pub fn num_vert(&self) -> usize
pub fn num_tri(&self) -> usize
pub fn get_vert_pos(&self, v: usize) -> [f32; 3]
pub fn get_tri_verts(&self, t: usize) -> [u32; 3]
pub fn get_tangent(&self, h: usize) -> [f32; 4]
Sourcepub fn merge(&mut self) -> bool
pub fn merge(&mut self) -> bool
Merges coincident vertices based on position within tolerance. Uses BVH collision detection to find open edges, then groups coincident vertices via union-find. Returns true if new merges were found, false if the mesh was already fully merged.
Sourcepub fn backside(&self, run: usize) -> bool
pub fn backside(&self, run: usize) -> bool
True if triangle run run is on the backside (e.g. from a subtraction).
run_flags is a bitmask (#1718): bit 0 = backside. Informational only —
the framework already orients stored normals on the standard flow.
Sourcepub fn has_normals(&self, run: usize) -> bool
pub fn has_normals(&self, run: usize) -> bool
True if the first three extra-property channels (slots 3, 4, 5) of run
run carry world-frame vertex normals (set by CalculateNormals(0),
round-tripped via run_flags bit 1, #1718). Consumers should treat the
slot as normals and skip re-applying run_transform to it.
Sourcepub fn update_normals(&mut self, normal_idx: usize)
pub fn update_normals(&mut self, normal_idx: usize)
Applies run transforms to normals stored at normal_idx in each vertex’s properties,
then clears run_transform and run_flags. Matches C++ MeshGL::UpdateNormals(normalIdx).
The normal transform is the inverse-transpose of the 3×3 rotation part of the run transform. For backside runs (run_flags bit 0 set), normals are additionally negated.