Closed olson-sean-k closed 6 years ago
This should be addressed by 43d5dcc. That commit changes IndexVertices
and related indexing traits so that indeces are emitted as polygons instead of raw usize
s, which preserves topology and arity. This more closely mirrors the indexed polygons and unique vertices generated by primitives, and allows a primitive like UvSphere
to be indexed and collected into a Mesh
without needing to triangulate the topology first.
The MapVerticesInto
trait has also been changed to support this and now relies on the associated type of Topology
to discern the input vertex data.
MeshBuffer
still enforces arity constraints because it only supports "flat" index buffers. Because triangulation is not required, it is no longer performed automatically in FromIndexer
implementations.
The
IndexVertices
trait can be used to index arbitrary streams of vertex data, but requires that the arity of the topology (polygons) is constant (i.e., all triangles or all quads). It should be possible to index streams with variable arity and, for example, generate aMesh
with a mix of triangles and quads. TheUvSphere
primitive generates both triangles and quads, but currently must be triangulated before conversion into aMeshBuffer
orMesh
.Provide a mechanism for preserving the original topology of such generators when indexing/converting into a
Mesh
. (Note that this really don't apply toMeshBuffer
, which is meant mostly for rendering pipelines that typically expect a constant arity anyway.)