Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement draw.polygon() API #148

Merged
merged 10 commits into from
Jun 10, 2018
Merged

Conversation

mitchmindtree
Copy link
Member

This involved a large update to the inner IntoDrawn API used for mapping Drawings of geometric primitives to their "meshed" representation. The overhaul now allows for a dynamic number of arbitrary vertices per drawn primitive without requiring the need to reallocate buffers on each draw call.

The Drawing API has also been updated to allow for builders to produce new Drawing types. This allows for typed ordering of builder methods. E.g. draw.polygon().points(points) produces a Drawing<Polygon<Fill>> which implements SetColor, while draw.polygon().colored_points(points) produces a Drawing<Polygon<PerVertex>> which does not (as the color is specified via the vertices).

draw.polygon() supports both "filled" coloring and per-vertex coloring. A simple_polygon.rs example has been added demonstrating the new feature.

See the commit messages below for more details.

This allows to avoid submitting the primitive for drawing when `drop` is
called on the `Drawing` withing the `map` methods.
This gives more flexibility to implementations of the **IntoDrawn**
trait as the **Vertices** types no longer require
`Iterator<Item = Point>` and now have access to the **GeomVertexData**
when yeilding each vertex.

Closes nannou-org#146.
`draw.polygon()` now works as expected.
@mitchmindtree mitchmindtree merged commit 6cfe8e5 into nannou-org:master Jun 10, 2018
@mitchmindtree mitchmindtree deleted the polygon branch June 10, 2018 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant