Fix missing data when writing mesh file #43
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a partial fix for #42
When using
PolyanyaFile
to write a mesh file, the format doesn't quite match the specs. This PR fixes one of them and adds a workaround for the other.Firstly, when writing the vertices, there is meant to be a count of the polygons written before the list, this was missing.
Secondly, as originally reported in the issue is the neighbours aren't written. This isn't a huge issue as we don't seem to use them but it did mean we couldn't load the mesh file we wrote. Without calculating the neighbours, the workaround I add here is to set the
is_one_way
flag correctly if the neighbours list is empty.Finally as a small bonus, I added a format limit to the coordinates to avoid annoying trailing
.0000001
's in some numbers.This leaves the output looking like (e.g.):
Compared to using poly2mesh which generates this:
Edit: The original mesh without this change: