dmsurti / AssimpKit

A library (macOS, iOS) that converts the files supported by Assimp to Scene Kit scenes.
http://assimpkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
477 stars 54 forks source link

Fixed crash when reading nodes with vertex colors and multiple meshes. #90

Closed tsharju closed 6 years ago

tsharju commented 6 years ago

Fixing crash caused by reading nodes containing vertex colors with multiple meshes. I was accidentally using the total number of vertices when iterating through the colors and not the number of mesh vertices. This worked fine if node has only one mesh, but obviously fails if there are multiple.

This kind of let me to think how it should work if there is a node with vertex colors only on some of the meshes. This implementation does not add vertex colors to any meshes in that case. Because it returns NULL if just one of the meshes does not have vertex colors specified.

tsharju commented 6 years ago

Related to #89 I included in this pull request a FBX file containing vertex colored cubes that can be used in testing. Seems to be working fine.

dmsurti commented 6 years ago

@tsharju Thanks. Will check this out tomorrow and merge.