Function plexus::generate::zip_vertices [] [src]

pub fn zip_vertices<T, U>(
    tuple: U
) -> Map<Zip<T>, fn(_: <Zip<T> as Iterator>::Item) -> <<Zip<T> as Iterator>::Item as ZipVerticesInto>::Output> where
    Zip<T>: From<U> + Iterator,
    <Zip<T> as Iterator>::Item: ZipVerticesInto, 

Zips the vertices and topologies from multiple iterators into a single iterator.

This is useful for zipping different attributes of a primitive generator. For example, it can be used to combine position, plane, and texture coordinate data of a cube into a single topology stream.

Examples

Create a topological stream of position and texture coordinate data for a cube:

use plexus::generate;
use plexus::generate::cube::Cube;
use plexus::prelude::*;

let cube = Cube::new();
let polygons = generate::zip_vertices((
    cube.polygons_with_position(),
    cube.polygons_with_texture(),
)).map_vertices(|(position, texture)| {
    (position, texture, map_to_color(&texture))
})
    .triangulate()
    .collect::<Vec<_>>();