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
impl Refinement
Sourcepub fn vertex_stencils(&self) -> Vec<StencilTable>
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));Sourcepub fn face_varying_stencils(
&self,
channel: &FaceVaryingChannel,
mode: FaceVaryingInterpolation,
) -> Result<Vec<StencilTable>, KernelError>
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.
Sourcepub fn final_topology(&self) -> &Mesh
pub fn final_topology(&self) -> &Mesh
Final refined topology.
Sourcepub fn lineage(&self) -> &LineageMaps
pub fn lineage(&self) -> &LineageMaps
Lineage maps (last level, relative to level N-1).
Sourcepub fn edge_polylines(&self) -> Option<&[Vec<u32>]>
pub fn edge_polylines(&self) -> Option<&[Vec<u32>]>
Edge polylines (original parent-edge slots → refined vertex index sequences), if requested at refinement time.
Sourcepub fn selected_faces(&self) -> Option<&[bool]>
pub fn selected_faces(&self) -> Option<&[bool]>
Selected faces at final level.
Sourcepub fn refinement_steps(&self) -> usize
pub fn refinement_steps(&self) -> usize
Number of refinement steps (levels beyond the base mesh).
Sourcepub fn level_lineage(&self, step: usize) -> Option<&LineageMaps>
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.
Sourcepub fn into_final_parts(self) -> RefinedFinalParts
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.