Closed Ralith closed 4 years ago
Graphical resources are currently unaware of transformations (this also includes Font
and Text
). In this particular case, Mesh
tessellates shapes in stroke
and fill
calls by using lyon
with the default tolerance.
A quick fix could be adding a Mesh::new_with_tolerance
method to build a Mesh
with a custom tolerance. Would you be okay with this?
However, I imagine the best kind of fix would be to defer tessellation and make it target-aware. This would make draw
performance a bit unpredictable though, and we would also probably need to add limits to the Transformation
type (how would we deal with non-uniform scaling?) and keep track of them in Target
. I am not sure it is worth the hassle.
Another possibility would be to make Mesh
have a width
and height
and choose a tolerance based on the shape relative size. Or maybe just directly configure a scale
value on construction.
Any other ideas?
Explicit tolerance seems like a reasonable compromise between convenience and magic, particularly if you want to hold on to a complex Mesh
for reuse in later frames.
I have implemented the Mesh::new_with_tolerance
method in #100.
The first thing I do when drawing is scale such that graphics units match my world units, meaning that 1 unit covers many pixels on my 4k screen. Circles seem to be drawn under the assumption that no scaling is applied, so they're very polygonal.