Closed luca-della-vedova closed 1 year ago
Thanks @luca-della-vedova ! I'll find some time to review the PR fully this week
I think these changes look good, having to do the try_into
in parse_float3
is a bit of a pain, but it looks like it's not possible to collect
directly into a fixed size array, so it's ok as it is.
:warning: Breaking Change :warning:
Proposed fix for https://github.com/Twinklebear/tobj/issues/59
The issue itself describes what this change is trying to address. Material fields are now
Option
s which means users will be able to know if a field was not present, instead of having a default value provided.I took the liberty of doing a minor refactor to reduce the number of match statements / lines of code, as well as just deriving
Default
where the a struct'sDefault
implementation was just aDefault
for all of its fields, namely inMesh
andMaterial
. The former was always possible, while the latter is only possible after this change since some values were initialized to 1.0.The bulk of the change is in example / test code, I'm not 100% happy with adding the
unwrap
calls in the test but not sure how to do it otherwise without adding quite some boilerplate. I'm also not very happy with what theparse_float
andparse_float3
functions look like, they save a bunch of code but are not very pretty