quad/n-gon data.. how to convert to triangles?
Posted: Wed Nov 25, 2009 9:03 pm
I'm in the process of writing a simple editor for an old and rather obscure game. I'm at the stage of writing code to import its 3d models into my engine built on irrlicht.
I have successfully managed to import the data into custom SMeshBuffer/SMesh objects, and largely it works well. However, I noticed that some objects have large gaps when rendered.
I since found out that this old file format supports objects which are described not only as triangles, but using any number of vertices per single face (polygons/n-gons). For example, you can describe a quad with 4 vertices and 4 face indices, whereas using triangles you'd need 4 vertices 6 indices. So for objects built using triangles it works 100%, but for others irrlicht isn't rendering the faces properly.
Obviously irrlicht is not going to realise that the data is stored in a format other than triangles. Is there a way I can convert n-gons to triangles? If not, is there a way to render these objects in irrlicht? Using a custom scenenode for example?
Thanks,
David
I have successfully managed to import the data into custom SMeshBuffer/SMesh objects, and largely it works well. However, I noticed that some objects have large gaps when rendered.
I since found out that this old file format supports objects which are described not only as triangles, but using any number of vertices per single face (polygons/n-gons). For example, you can describe a quad with 4 vertices and 4 face indices, whereas using triangles you'd need 4 vertices 6 indices. So for objects built using triangles it works 100%, but for others irrlicht isn't rendering the faces properly.
Obviously irrlicht is not going to realise that the data is stored in a format other than triangles. Is there a way I can convert n-gons to triangles? If not, is there a way to render these objects in irrlicht? Using a custom scenenode for example?
Thanks,
David