[][src]Module plexus::index

Indexing and aggregation.

This module provides indexers, which disambiguate geometry and produce the minimal set of topological and geometric data. This is primarily used to index streams of $n$-gons (NGon, Trigon, etc.) into raw buffers or polygonal mesh data structures like MeshBuffer.

Indexing produces an index buffer and vertex buffer. The index buffer describes the topology of a mesh by providing ordered groups of indices into the vertex buffer. Each group of indices represents a polygon. The vertex buffer contains geometric data associated with a vertex, such as positions or surface normals. Plexus supports both structured and flat index buffers.

Flat index buffers directly store individual indices, such as Vec<usize>. Because there is no explicit structure, arity must by constant, but arbitrarily sized $n$-gons are trivially supported. Flat index buffers tend to be more useful for rendering pipelines, especially triangular buffers, because rendering pipelines typically expect a simple contiguous buffer of index data. See MeshBuffer3 and Flat.

Structured index buffers contain sub-structures that explicitly group indices, such as Vec<Trigon<usize>>. Structured index buffers typically contain Trigons, Tetragons, or Polygons. Notably, Polygon can describe the topology of a mesh even if its arity is non-constant.

The primary interface of this module is the IndexVertices and CollectWithIndexer traits along with the HashIndexer and LruIndexer types.


Indexing data for a cube to create raw buffers and a MeshBuffer:

use decorum::N64;
use nalgebra::Point3;
use plexus::buffer::MeshBuffer3;
use plexus::index::{Flat3, HashIndexer};
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;

let (indices, positions) = Cube::new()
    .index_vertices::<Flat3, _>(HashIndexer::default());
let buffer = MeshBuffer3::<u32, _>::from_raw_buffers(indices, positions).unwrap();



Flat index buffer meta-grouping.


Hashing vertex indexer.


LRU caching vertex indexer.



Functions for collecting a stream of $n$-gons into a mesh data structure.


Functions for collecting a stream of $n$-gons into raw index and vertex buffers.


Index buffer.


Functions for collecting a stream of $n$-gons into raw index and vertex buffers.


Vertex indexer.


Type Definitions


Alias for a flat and triangular index buffer.


Alias for a flat and quadrilateral index buffer.