Skip to main content

MeshGLP

Struct MeshGLP 

Source
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: I

Number 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: P

Tolerance for mesh simplification.

Implementations§

Source§

impl MeshGLP<f32, u32>

Source

pub fn num_vert(&self) -> usize

Source

pub fn num_tri(&self) -> usize

Source

pub fn get_vert_pos(&self, v: usize) -> [f32; 3]

Source

pub fn get_tri_verts(&self, t: usize) -> [u32; 3]

Source

pub fn get_tangent(&self, h: usize) -> [f32; 4]

Source

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.

Source

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.

Source

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.

Source

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.

Source§

impl MeshGLP<f64, u64>

Source

pub fn num_vert(&self) -> usize

Source

pub fn num_tri(&self) -> usize

Source

pub fn get_vert_pos(&self, v: usize) -> [f64; 3]

Source

pub fn get_tri_verts(&self, t: usize) -> [u64; 3]

Source

pub fn get_tangent(&self, h: usize) -> [f64; 4]

Trait Implementations§

Source§

impl<P: Clone + Copy + Default, I: Clone + Copy + Default> Clone for MeshGLP<P, I>

Source§

fn clone(&self) -> MeshGLP<P, I>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug + Copy + Default, I: Debug + Copy + Default> Debug for MeshGLP<P, I>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Default + Copy + Default, I: Default + Copy + Default> Default for MeshGLP<P, I>

Source§

fn default() -> MeshGLP<P, I>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<P, I> Freeze for MeshGLP<P, I>
where I: Freeze, P: Freeze,

§

impl<P, I> RefUnwindSafe for MeshGLP<P, I>

§

impl<P, I> Send for MeshGLP<P, I>
where I: Send, P: Send,

§

impl<P, I> Sync for MeshGLP<P, I>
where I: Sync, P: Sync,

§

impl<P, I> Unpin for MeshGLP<P, I>
where I: Unpin, P: Unpin,

§

impl<P, I> UnsafeUnpin for MeshGLP<P, I>
where I: UnsafeUnpin, P: UnsafeUnpin,

§

impl<P, I> UnwindSafe for MeshGLP<P, I>
where I: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.