frenchtoast747 / webgl-obj-loader

A simple OBJ model loader to help facilitate the learning of WebGL.
http://frenchtoast747.github.io/webgl-obj-loader/
MIT License
281 stars 59 forks source link

Adding the ability to use .obj files that have quads instead of triangles. #1

Closed spockNinja closed 11 years ago

spockNinja commented 11 years ago

When looking for some good free .obj files to use, I found that a lot of them tended to have quads. I took one of them and manually made it into triangles, then realized that the same thing could be accomplished within the obj-loader itself. I have heard that it is possible to do this in something like blender too, but I'm sure I'm not alone in that I don't have any software like that.

The changes I made have no affect on properly triangulated objects. They only take effect when faces have more than 3 sets of items (assuming that means they are quads). I tested it on several objects, and it worked as I would have expected. It even resulted in having less vertices than the object I had triangulated manually.

Let me know if you have any questions or issues with it. It is entirely possible that I didn't think of something.