bjornbytes / lovr

Lua Virtual Reality Framework
https://lovr.org
MIT License
2k stars 138 forks source link

Pass:polygon #769

Closed bjornbytes closed 5 months ago

bjornbytes commented 6 months ago

Should we have Pass:polygon? It's a more convenient way to draw triangles, non-plane quadrilaterals, or maybe the faces of the new convex hull physics shape.

The input points would be directly rendered as a triangle fan, and so the points need to be coplanar and the resulting polygon would need to be simple (i.e. not self-intersecting) and convex. LÖVR could try to do validation or just render it anyway (I lean towards no validation).

The normal vector of the polygon could be computed as the cross product of the 2 direction vectors formed by the first 3 points. I don't think we can compute UVs.

bjornbytes commented 5 months ago

Pass:polygon exists now, but it doesn't have normal vectors yet.