#[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_stencilsonce, thenStencilTable::interpolateeach frame. Stencil composition is O(output × entries²) but amortized over many frames. - Multiple buffers:
interpolatecan be called once per buffer (positions, UVs, colors, …) — all share the same topology computation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.topology: MeshRefined 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: LineageMapsAncestry 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: AdjacencyPre-built adjacency arrays for the refined topology.
Allows adapter-side mesh construction without redundant edge discovery or adjacency analysis.
scheme: SchemeScheme that produced this result. Recorded at
refine_uniform time so
scheme-dependent post-processing
(limit_stencils) needs no refiner
handle.
options: SchemeOptionsScheme options in effect during refinement (boundary and
sharpness conventions for limit_stencils).
Implementations§
Source§impl RefinementResult
impl RefinementResult
Sourcepub fn limit_stencils(&self) -> Result<LimitStencils, KernelError>
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.
Sourcepub fn compose_limit_stencils(
&self,
input_vertex_count: usize,
) -> Result<LimitStencils, KernelError>
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.
Sourcepub fn sectored_limit_stencils(
&self,
) -> Result<SectoredLimitStencils, KernelError>
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.
Sourcepub fn compose_sectored_limit_stencils(
&self,
input_vertex_count: usize,
) -> Result<SectoredLimitStencils, KernelError>
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
impl RefinementResult
Sourcepub fn limit_evaluator<'a>(
&'a self,
positions: &'a [[f32; 3]],
) -> Result<LimitEvaluator<'a>, KernelError>
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
impl RefinementResult
Sourcepub fn interpolate<T: Interpolatable>(&self, input: &[T]) -> Vec<T>
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.
Sourcepub fn compose_stencils(&self, input_vertex_count: usize) -> StencilTable
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.
Sourcepub fn inverse_stencil_chain(&self) -> InverseStencilChain
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.
Sourcepub fn affected_outputs(&self, changed_inputs: &[u32]) -> Vec<u32>
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
impl RefinementResult
Sourcepub fn patch_table(&self) -> Result<PatchTable, KernelError>
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
impl Clone for RefinementResult
Source§fn clone(&self) -> RefinementResult
fn clone(&self) -> RefinementResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RefinementResult
impl Debug for RefinementResult
Source§impl PartialEq for RefinementResult
impl PartialEq for RefinementResult
Source§fn eq(&self, other: &RefinementResult) -> bool
fn eq(&self, other: &RefinementResult) -> bool
self and other values to be equal, and is used by ==.