Open trishume opened 8 years ago
It looks like a good way to implement this might be to add a flag to Polygon
for convexity (or a new primitive) that renders with draw_tri
instead of draw
in graphics.rs
. That or just always use draw_tri
and take a small (or large?) perf hit on convex polygons. Either way it should be clear in the documentation what it does.
Hi,
I'm running into this as well. Did you find a way to work around it? Is draw_tri
the solution? I tried it but I wasn't successful in getting concave shapes to be filled correctly.
I'm trying to write a visualization application with a disk tree graph that looks like DaisyDisk which requires buttons shaped like arc segments.
I tried implementing a custom button widget rendered with a polygon, but unfortunately it wasn't clearly documented either by Conrod or Piston that polygon means convex polygon. So I spent a bunch of time generating point lists for arcs for polygons, only to find they didn't render correctly because arc segments are concave. Instead of closing between the last point and the first it renders the convex hull of the point list.
The only way I can think of to work around this is to render tens of thousands of Polygon widgets which just contain triangles. This sounds slow and bad but if it isn't let me know. It's at least harder to generate a list of triangles for an arc rather than a list of points, but not that hard.
It would be great if either there was some way to directly render concave polygons, but even a half-measure like a widget for rendering a whole bunch of triangles directly would be okay. Ideally for my case but not other people's cases would be a primitive for rendering arc segments.
I'm interested in contributing if there's something a newbie to Conrod could do to solve this, but I'd appreciate some feedback on how best to solve this problem before I do anything.
@bvssvni @mitchmindtree