Kha icon indicating copy to clipboard operation
Kha copied to clipboard

Add worldSpace option for drawing polygons

Open Devination opened this issue 9 years ago • 6 comments
trafficstars

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

Devination avatar May 04 '16 07:05 Devination

Doesn't make too much sense to me, you could just pass in 0 for x and y, right?

RobDangerous avatar May 04 '16 15:05 RobDangerous

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

Devination avatar May 04 '16 16:05 Devination

Uh, that is very strange. Any objections if I change that? Don't think a center point makes sense.

RobDangerous avatar May 04 '16 23:05 RobDangerous

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.

Devination avatar May 05 '16 01:05 Devination

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

Devination avatar May 05 '16 08:05 Devination

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.

RobDangerous avatar May 09 '16 00:05 RobDangerous