KhronosGroup/COLLADA2GLTF

Segmentation Fault for COLLADA files with multiple materials and normal maps

citron0xa9 opened this issue · 3 comments

Hey,
I get a segmentation fault when trying to convert a COLLADA file that has multiple materials where at least one uses a normal map. (See attached example file). I am on the current master, i.e. aaaaf7fa911de0dcc5b68e71a200b4122c8890f4

The problem appears in COLLADA2GLTFWriter.cpp:989 where the samplerId of a normal map is out of bounds. It seems like during parsing, only the normal mapping data for the last effect is saved in _extraHandlers and when writing an effect, this data is used, even if not the last effect is written.

I am not sure how you handle Pull Requests, but here would be my fix for it: https://github.com/citron0xa9/COLLADA2GLTF/tree/fix_normals

example-collada.zip

Hi @citron0xa9, your fix for this looks fine to me. We do accept pull requests - if you open one, I will accept it.

Ok thank you, I created a PR

Fixed in #254