Kha
Kha copied to clipboard
Add worldSpace option for drawing polygons
Found myself wanting a worldSpace option when drawing polygons. Not sure if this is the best way to do it or if it fits your code style though
Doesn't make too much sense to me, you could just pass in 0 for x and y, right?
Not quite, if you look at the last 2 arguments in the fillTriangle calls, x and y are also used for the last point of every triangle in the polygon. So while 0s for x and y will kill the offset, it will also pin 1 point (the 'center' point) of the polygon to the top left corner of the screen. Wednesday, 04 May 2016, 08:28AM -07:00 from Robert Konrad < [email protected]> :
Doesn't make too much sense to me, you could just pass in 0 for x and y, right? — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub
Uh, that is very strange. Any objections if I change that? Don't think a center point makes sense.
No objections from me, sounds like a good change! I'm just not sure how extensively other people are relying on it in it's current form.
Or wait sorry, (x,y) doesn't have to be a center point. It could just as well be a corner of the polygon from which the rest of the verts fan out. It's a little strange that you supply those separately from the rest of the verts instead of just taking them from the first vert in the array but that doesn't bother me as much as not having a world space option
It's a so called triangle fan. But I think having a regular triangle array instead makes more sense and resolves the world space problem.