thisistherk / fast_obj

Fast C OBJ parser
MIT License
616 stars 46 forks source link

Trim trailing whitespace for names #43

Closed zeux closed 1 year ago

zeux commented 1 year ago

Some .obj files have extra whitespace after usemtl and other statements; this may interfere with parsing, for example by adding a space to the material name which can result in inability to find it in .mtl file.

For consistency, we replace all uses of is_end_of_name with skip_name that handles this by leaving trailing whitespace alone. It will be skipped in the parsing flow when we skip the newline, which is similar to the behavior of trailing whitespace after numeric data (which parse_float/int leave alone).

Closes #37 (by providing an alternate solution)

thisistherk commented 1 year ago

Great, thanks!