Skip to main content

RefinementResult

Struct RefinementResult 

Source
#[non_exhaustive]
pub struct RefinementResult { pub topology: Mesh, pub level_stencils: Vec<StencilTable>, pub lineage: LineageMaps, pub face_root: Vec<u32>, pub selected_faces: Option<Vec<bool>>, pub edge_polylines: Option<Vec<Vec<u32>>>, pub adjacency: Adjacency, pub scheme: Scheme, pub options: SchemeOptions, }
Expand description

Output of Refiner::refine_uniform.

Contains the refined topology, per-level stencil tables, and lineage information. Use interpolate to apply subdivision weights to any data buffer, or compose_stencils to precompute a single stencil table for amortized re-evaluation (animation).

§Performance model

  • One-shot: call interpolate — chains per-level stencil application. Same algorithmic cost as direct subdivision. No exponential stencil growth.
  • Animation: call compose_stencils once, then StencilTable::interpolate each frame. Stencil composition is O(output × entries²) but amortized over many frames.
  • Multiple buffers: interpolate can be called once per buffer (positions, UVs, colors, …) — all share the same topology computation.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§topology: Mesh

Refined topology (no positions).

§level_stencils: Vec<StencilTable>

Per-level stencil tables. level_stencils[i] maps level-i vertices to level-(i+1) vertices. Length equals the number of refinement levels.

§lineage: LineageMaps

Ancestry tracking for adapter-side attribute propagation. Relative to the previous level (level N-1 -> N); for direct refined-face -> base-face ancestry use face_root.

§face_root: Vec<u32>

Base-mesh (root) face index for each refined face – the per-level face_parent chain pre-folded across all refinement levels, so an adapter can map any refined face straight to the input face it descends from (picking, per-face attribute propagation). Indexed by refined face; values index the faces of the mesh given to the Refiner.

§selected_faces: Option<Vec<bool>>

Refined face selection mask (present when input had selection).

§edge_polylines: Option<Vec<Vec<u32>>>

For each input edge, the refined vertices lying along it, in order.

Some only when the edge_polylines refinement option was set. Indices refer to topology.

§adjacency: Adjacency

Pre-built adjacency arrays for the refined topology.

Allows adapter-side mesh construction without redundant edge discovery or adjacency analysis.

§scheme: Scheme

Scheme that produced this result. Recorded at refine_uniform time so scheme-dependent post-processing (limit_stencils) needs no refiner handle.

§options: SchemeOptions

Scheme options in effect during refinement (boundary and sharpness conventions for limit_stencils).

Implementations§

Source§

impl RefinementResult

Source

pub fn limit_stencils(&self) -> Result<LimitStencils, KernelError>

Limit masks over the refined level’s own vertices (row i reads refined vertices, writes limit data for refined vertex i).

Catmull-Clark only, and the result must come from at least one full (unselected) refinement – see the module docs for the rule conventions and restrictions.

Source

pub fn compose_limit_stencils( &self, input_vertex_count: usize, ) -> Result<LimitStencils, KernelError>

The cage -> limit composition: each LimitStencils table composed onto compose_stencils, so a host can upload three GPU tables and evaluate limit position and tangents straight from control points. The surface normal is tangent1 x tangent2.

input_vertex_count must match the number of vertices in the original (pre-refinement) topology.

Source

pub fn sectored_limit_stencils( &self, ) -> Result<SectoredLimitStencils, KernelError>

Per-sector limit masks over the refined level’s own vertices: the position table is per refined vertex, the tangent tables per sector, with SectoredLimitStencils::corner_sector mapping each refined face-corner to its tangent row.

Same scheme/option gating and errors as limit_stencils.

Source

pub fn compose_sectored_limit_stencils( &self, input_vertex_count: usize, ) -> Result<SectoredLimitStencils, KernelError>

The cage -> limit composition of sectored_limit_stencils: all three tables composed onto compose_stencils, so a host uploads the tables and evaluates per-sector limit tangents straight from control points.

input_vertex_count must match the number of vertices in the original (pre-refinement) topology.

Source§

impl RefinementResult

Source

pub fn limit_evaluator<'a>( &'a self, positions: &'a [[f32; 3]], ) -> Result<LimitEvaluator<'a>, KernelError>

Build a LimitEvaluator over this refined level.

positions is one position per refined vertex (the PatchTable evaluation input – CPU-interpolated or read back from the GPU stencil path). Same gating as patch_table: Catmull-Clark, at least one full (unselected) refinement.

Source§

impl RefinementResult

Source

pub fn interpolate<T: Interpolatable>(&self, input: &[T]) -> Vec<T>

Interpolate a data buffer through all refinement levels.

Chains per-level stencil application: each level reads from the previous level’s output and writes the next. This avoids the exponential stencil growth of compose_stencils and matches the performance of direct subdivision.

The input buffer must have one entry per vertex in the original (pre-refinement) topology. The output has one entry per vertex in topology.

Source

pub fn compose_stencils(&self, input_vertex_count: usize) -> StencilTable

Compose all per-level stencil tables into a single table mapping original vertices directly to final refined vertices.

Use this when you need to re-evaluate the same topology with different data many times (e.g. animation with static topology). The composed table enables a single StencilTable::interpolate call per frame instead of chaining N levels.

For one-shot subdivision, prefer interpolate which avoids the O(output × entries²) composition cost. Compose all per-level stencil tables into a single table mapping original vertices directly to final refined vertices.

input_vertex_count must match the number of vertices in the original (pre-refinement) topology.

Source

pub fn inverse_stencil_chain(&self) -> InverseStencilChain

Build the inverse stencil chain for this refinement – the transpose of every level – used to map changed control points to the refined output vertices they affect.

The chain is topology-only, so build it once and reuse it across edits. For a single edit, affected_outputs is a convenience that builds and queries it in one call.

Source

pub fn affected_outputs(&self, changed_inputs: &[u32]) -> Vec<u32>

Final refined output indices affected by changing the given original (pre-refinement) control-point indices, sorted ascending and deduped.

changed_inputs are indices into the input buffer – the same order as the vertices of the Mesh given to the Refiner and of interpolate’s input – not host-mesh vertex IDs. A host that keys edits by a stable vertex ID must map those IDs to this dense input order first.

Outputs not in this set are bit-identical under a change confined to changed_inputs – this is the basis of sparse re-evaluation. This rebuilds the inverse chain on each call; for repeated edits, cache inverse_stencil_chain and call its affected_outputs directly.

Source§

impl RefinementResult

Source

pub fn patch_table(&self) -> Result<PatchTable, KernelError>

Classify every refined quad and extract the bicubic B-spline patches of the regular ones.

Catmull-Clark only, and the result must come from at least one full (unselected) refinement – the same gating as limit_stencils, except that open meshes are accepted under every boundary rule (boundary quads are always QuadClass::Feature).

Trait Implementations§

Source§

impl Clone for RefinementResult

Source§

fn clone(&self) -> RefinementResult

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 Debug for RefinementResult

Source§

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

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

impl PartialEq for RefinementResult

Source§

fn eq(&self, other: &RefinementResult) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RefinementResult

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