[−][src]Trait plexus::index::IndexVertices
Functions for collecting a stream of $n$-gons into raw index and vertex buffers.
Unlike GroupedIndexVertices
, this trait provides functions that are
parameterized with respect to grouping. See the Grouping
trait.
Using an indexer is not always the most effecient method to create a mesh
data structure from a generator. Generators provide per-attribute indices
that may be less expensive than an indexer when only a single attribute is
needed. For example, see also vertices_with_position
and
indices_for_position
.
See HashIndexer
and LruIndexer
.
Examples
use decorum::N64; use nalgebra::Point3; use plexus::index::{Flat3, HashIndexer}; use plexus::prelude::*; use plexus::primitive::generate::Position; use plexus::primitive::sphere::UvSphere; let sphere = UvSphere::new(32, 32); let (indices, positions) = sphere .polygons::<Position<Point3<N64>>>() .triangulate() .index_vertices::<Flat3, _>(HashIndexer::default());
Provided methods
fn index_vertices_with<R, N, K, F>(
self,
indexer: N,
f: F
) -> (Vec<R::Item>, Vec<P::Vertex>) where
Self: GroupedIndexVertices<R, P>,
R: Grouping,
N: Indexer<P, K>,
F: Fn(&P::Vertex) -> &K,
self,
indexer: N,
f: F
) -> (Vec<R::Item>, Vec<P::Vertex>) where
Self: GroupedIndexVertices<R, P>,
R: Grouping,
N: Indexer<P, K>,
F: Fn(&P::Vertex) -> &K,
Indexes a stream of $n$-gons into raw index and vertex buffers using the given grouping, indexer, and keying function.
fn index_vertices<R, N>(self, indexer: N) -> (Vec<R::Item>, Vec<P::Vertex>) where
Self: GroupedIndexVertices<R, P>,
R: Grouping,
N: Indexer<P, P::Vertex>,
Self: GroupedIndexVertices<R, P>,
R: Grouping,
N: Indexer<P, P::Vertex>,
Indexes a stream of $n$-gons into raw index and vertex buffers using the given grouping and indexer.
Examples
use decorum::N64; use nalgebra::Point3; use plexus::index::HashIndexer; use plexus::prelude::*; use plexus::primitive::cube::Cube; use plexus::primitive::generate::Position; use plexus::primitive::Trigon; // `indices` contains `Trigon`s with index data. let (indices, positions) = Cube::new() .polygons::<Position<Point3<N64>>>() .subdivide() .triangulate() .index_vertices::<Trigon<usize>, _>(HashIndexer::default());
Implementors
impl<P, I> IndexVertices<P> for I where
I: Iterator<Item = P>,
P: Topological,
[src]
I: Iterator<Item = P>,
P: Topological,