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.
This code
par/test/test_shapes.c
Line 234 in b3571fd
creates a disk and a dodecahedron and then calls
par_shapes_mergeon them. The problem is that the disk has normals but the dodecahedron does not.par/par_shapes.h
Line 685 in b3571fd
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
Not sure which is best.