[][src]Crate genmesh

Genmesh's is a library that offers ways to generate and manipulate vertex streams.

The core problem that this library solves is to find a nice way to build meshes that does not just result in throwing all the vertices and indices into a Vec<T> and calling it done. While doing so is simple from a library writers point of view, the consumer will often have to translate that buffer to the format that they need before it can be used. This produces needless buffering that can be avoided.

Genmesh's solution is to utilize the Iterator trait to build a vertex processing pipeline. The Iterator trait has a number of useful functions like zip, map and collect that are useful in themselves. Genmesh includes a number of traits that can be used with the built in Iterator traits to build the meshes that your engine needs.

Modules

generators

A collection of utilties that can be used to build meshes programmatically.

Structs

Line

Represents a line

LruIndexer

An LruIndexer is useful for creating indexed steam from a stream of vertices. Each vertex that is index is only compared against the vetices contained in the cache. If a vertex is not found the LruIndexer will emit a new vertex and return the index of that new vertex.

Neighbors

Neighbors search accelerating structure.

Quad

A polygon with 4 points. Maps to GL_QUADS

Triangle

A polygon with 3 points. Maps to GL_TRIANGLE

TriangulateIterator

Used to iterator of polygons into a iterator of triangles

Vertex

Common vertex type.

VerticesIterator

an iterator that breaks a polygon down into its individual verticies.

Enums

Polygon

This is All-the-types container. This exists since some generators produce both Triangles and Quads.

Traits

EmitLines

Convert a Polygon into it's fragments

EmitTriangles

provides a way to convert a polygon down to triangles

Indexer

A trait defining how to defined an Indexer. An indexer is a object that collects verticies and emits indexes for the vertex. The intent is that an Indexer can find redundent vertexes and deduplicate them by returning aliased indexes.

Lines

Creates an LinesIterator from another Iterator

MapToVertices

This acts very similar to a vertex shader. It gives a way to manipulate and modify the vertices in a polygon. This is useful if you need to scale the mesh using a matrix multiply, or just for modifying the type of each vertex.

MapVertex

equivalent of map but per-vertex

Triangulate

Triangluate is a easy to to convert any Polygon stream to a stream of triangles. This is useful since Quads and other geometry are not supported by modern graphics pipelines like OpenGL.

Vertices

Supplies a way to convert an iterator of polygons to an iterator of vertices. Useful for when you need to write the vertices into a graphics pipeline.

Type Definitions

Normal

Common vertex normal type.

Position

Common vertex position type.