Skip to main content

Refinement

Struct Refinement 

Source
pub struct Refinement { /* private fields */ }
Expand description

Cached multi-level refinement topology.

Created by Refiner::refine_topology. Use vertex_stencils and face_varying_stencils to compute stencils from the cached topology without redundant edge discovery, and level_lineage / refinement_steps to walk multi-level ancestry by reference.

The shape mirrors OpenSubdiv’s Far::TopologyRefiner — all per-level queries return borrowed slices into cached storage so adapters can fold across levels without cloning per-level state.

Implementations§

Source§

impl Refinement

Source

pub fn scheme(&self) -> Scheme

The subdivision scheme this refinement was produced with.

Source

pub fn vertex_stencils(&self) -> Vec<StencilTable>

Compute per-level vertex stencils from cached topology.

Returns one StencilTable per refinement step (length equals refinement_steps). Apply with the chaining pattern from RefinementResult::interpolate:

let tables = refined.vertex_stencils();
let final_positions = tables
    .iter()
    .fold(input_positions, |data, t| t.interpolate(&data));
Source

pub fn face_varying_stencils( &self, channel: &FaceVaryingChannel, mode: FaceVaryingInterpolation, ) -> Result<Vec<StencilTable>, KernelError>

Compute per-level face-varying stencils from cached topology.

All four FaceVaryingInterpolation modes are implemented for CC, Loop and √3; Doo-Sabin’s face-local smooth rule makes its three smooth modes coincide.

Source

pub fn final_topology(&self) -> &Mesh

Final refined topology.

Source

pub fn lineage(&self) -> &LineageMaps

Lineage maps (last level, relative to level N-1).

Source

pub fn adjacency(&self) -> &Adjacency

Adjacency (last level).

Source

pub fn edge_polylines(&self) -> Option<&[Vec<u32>]>

Edge polylines (original parent-edge slots → refined vertex index sequences), if requested at refinement time.

Source

pub fn selected_faces(&self) -> Option<&[bool]>

Selected faces at final level.

Source

pub fn refinement_steps(&self) -> usize

Number of refinement steps (levels beyond the base mesh).

Source

pub fn level_lineage(&self, step: usize) -> Option<&LineageMaps>

Per-level lineage view by reference, zero allocation.

level_lineage(step) returns the lineage of the refinement step indexed from 0 (first refinement level relative to the base mesh). Valid range is 0..refinement_steps().

Adapters fold over this to chain ancestry from the final level back to the original input mesh, mirroring OpenSubdiv’s TopologyLevel::face_parent_face / per-level walk pattern.

Source

pub fn into_final_parts(self) -> RefinedFinalParts

Consume the handle and yield its owned final-level outputs.

Call this after any stencil or per-level-lineage borrows have ended (vertex_stencils, face_varying_stencils, level_lineage), since those read from cached level data that this method moves out.

Zero clones: topology / lineage / adjacency / polylines are moved out of the final level’s scheme-specific struct.

Auto Trait Implementations§

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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, 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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,