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

Development: Fix bugs preventing the use of app.js #68

Closed qtip closed 4 years ago

qtip commented 4 years ago

All the small fixes here are being committed at the same time to allow the use of app.js for development.

Layout: Switch back to strings for TYPES

Layout TYPES need to be strings because they're used to index into a GLRenderingContext. I put a switch case in the Layout constructor to calculate the gl type size in bytes.

Mesh: Add makeIndexBufferDataForMaterials to Mesh

The current behavior of makeIndexBufferData will make an index buffer for only one material which is strange at best and difficult-to-use at worst. I've added here a method to build an index buffer given any number of materials.

downloadMtlTextures: Don't fetch directory listings when filename doesn't exist

When filename is empty for texture map data, don't try downloading the root directory.