Crate genmesh

Source
Expand description

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§

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

Structs§

  • Represents a line
  • 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 search accelerating structure.
  • A polygon with 4 points. Maps to GL_QUADS
  • A polygon with 3 points. Maps to GL_TRIANGLE
  • Used to iterator of polygons into a iterator of triangles
  • Common vertex type.
  • an iterator that breaks a polygon down into its individual verticies.

Enums§

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

Traits§

  • Convert a Polygon into it’s fragments
  • provides a way to convert a polygon down to triangles
  • 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.
  • Creates an LinesIterator from another Iterator
  • 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.
  • equivalent of map but per-vertex
  • 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.
  • 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 Aliases§