This code
creates a disk and a dodecahedron and then calls
par_shapes_merge on them. The problem is that the disk has normals but the dodecahedron does not.
|
if (src->normals || dst->normals) { |
allocates enough space for normals of both but since the second has none it leaves part of the buffer uninitialized. Later when the code tries to read normals it gets uninitialized values.
You should either
- fail the operation when one mesh has normals and the other doesn't
- build the missing normals automatically
- clear the buffer to zero if normals are missing
Not sure which is best.