I have a model defined by a list of vertices and a list of faces. But the faces aren’t all triangles but can be any flat convex polygons (triangle, square, pentagon, etc). aka they can be tris, quads and n-gons.
// vertices, list of x,y,z let vertices = [ x1,y1,z1, x2,y2,z2, x3,y3,z3, ... ] // faces, list of list of indices of vertices let faces = [ [1,2,3], // a tri [2,3,4,5], // a quad [6,7,8,9,10], // a penta [4,6,8], // a tri ... ]
(for instance a box could be defined by 6 quad faces instead of the usual 12 tris).
I’m thinking of using VertexData and converting every non tri to some tris by a simple fan triangulation but I was wondering if something like that already exists in BJS.
And is this the most efficient way to do this (I can sometimes have 300k+ faces) both in term of time to compute and memory/typescript efficiency ?
Additionally how can I render the orignal faces in wireframe (so without seeing the triangulation) ?