Improved the polygon renderer to allow for per-polygon colors. It was actually quite a bit of work since I had to optimize how tile paint jobs are dispatched. Came up with a simple API - the geometry is built by repeatedly calling add_line_segment(Ctx *ctx, Point a, Point b)
and then finish_polygon(Ctx *ctx, Polygon_Style *style)
after all the segments of a polygon were added. Rinse and repeat for next polygon. What's nice is that the internal structures aren't much more complex. Given that everything is chunked by tiles already, I can afford to duplicate a handle to the Polygon_Style
in each tile paint job. The renderer doesn't need to track individual polygons, so there is no need to maintain a complicated object graph.
Next up is testing with more complex shapes and seeing which tricks can be employed to keep it running smoothly.