CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.7k stars 305 forks source link

Fix negative indices #191

Closed lilleyse closed 5 years ago

lilleyse commented 5 years ago

Fixes https://github.com/AnalyticalGraphicsInc/obj2gltf/issues/184

Negative indices were not treated properly when retrieving vertices from the vertex cache. For example two vertices with -1 would get the same vertex from the cache, but this is incorrect since a negative index can be a different absolute index depending on where in the file it is parsed. The fix is to convert negative indices to absolute indices from the start.

The reason the negative-indices test didn't catch this was because it didn't interleave any v and f sections. The updated test data now interleaves the sections.

tfili commented 5 years ago

Thanks @lilleyse This looks good. The user's test models now work as do the tests.