Just found out the hard way that attempting to call rendering.draw_polygon with vertices that aren't a convex hull results in odd and unpredictable results.
My workaround is having to break the shape down into convex parts myself and render them separately, which is not ideal.
Could support for concave polygons be added?
EDIT: Or at least update the API docs to specify that only convex polygons are supported, because I spent way too long "debugging" this!
EDIT2: Turns out that even with concave shapes, an alpha value on the colour doesn't work well as some parts are drawn over multiple times. I finally had to break my shape down all the way to individual triangles to get it working properly.
Concave polygons
Re: Concave polygons
+1 for multiple ways to define polygons.
viewtopic.php?t=80171&p=492321
viewtopic.php?t=80171&p=492321
Last edited by darkfrei on Fri Jan 22, 2021 6:32 pm, edited 1 time in total.
Re: Concave polygons
Sorry but this isn't likely to happen. As far as I know; the polygon function in LuaRendering was thrown in "because we already have the function on the C++ side" and so if anyone wanted to use it they could. We aren't looking to expand or change how it functions on the C++ side. It was created to draw exactly what it supports and nothing more; to be as fast as it possibly can be.
If you want to get ahold of me I'm almost always on Discord.
Re: Concave polygons
Understandable. Rendering individual triangles works and is fine in my case (an arched arrow to show a projectile trajectory)
Re: Concave polygons
Unfortunatelly, draw_polygon is misleading. It's drawing a triangle strip
Re: Concave polygons
Yup, that's what I figured out the hard way XD Might be a nice touch to add that to the API docs so others don't run afoul of the problem I had.
draw_polygon is perfectly fine for drawing convex, solid shapes. I only ran into extra problems because I wanted semi-transparent colour, which exposed the underlying triangle strip!
draw_polygon is perfectly fine for drawing convex, solid shapes. I only ran into extra problems because I wanted semi-transparent colour, which exposed the underlying triangle strip!
Re: Concave polygons
[Koub] Moving this to "won't implement" then.
Koub - Please consider English is not my native language.