orangeduck / Corange

Pure C Game Engine
http://www.youtube.com/watch?v=482GxqTWXtA
Other
1.78k stars 199 forks source link

obj - convert polygons to triangles #40

Closed blogdron closed 5 years ago

blogdron commented 5 years ago

Many 3D editors create polygons instead of triangles by default. And convert each model is inconvenient. And if this is not done, the models are painted without half surfaces. When rendering, only triangles are used, so it seems to me to be good if the polygons are automatically converted into triangles.

Test model before edit obj_load_file() poligons

Test model after edit obj_load_file() triangles

I found a conversion mechanism here https://stackoverflow.com/questions/23723993/converting-quadriladerals-in-an-obj-file-into-triangles I hope everything is correct and it will not cause hidden bugs, but I kind of checked on different export files, everything seems to be fine.

blogdron commented 5 years ago

i found bug for 12 elems like f 1/1/1 2/2/1 3/3/1 4/4/1 i close now and going fix it