Uses of sscanf_s give the following warnings in 64-bit builds:
tiny_obj_loader.cc(471): warning C4477: 'sscanf_s' : format string '%s' requires an argument of type 'int', but variadic argument 2 has type 'unsigned __int64'
tiny_obj_loader.cc(471): note: this argument is used as a buffer size
This was fixed by casting the uses of _countof(namebuf) to unsigned, since the MSDN documentation for sscanf_s specifies that "The size parameter is of type **unsigned**, not **size_t**." (https://msdn.microsoft.com/en-us/library/t6z7bya3.aspx)
This silences the warnings.
function parseString seemed to not increment token after it used strspn to get the length of the whitespace characters at the beginning of token. So strcspn called right after that would return 0 and the created string would be an empty string.
Seems to have been working so far since it gets passed strings that don't begin with whitespace characters.
+ Added a LoadObj function that reads from a std::istream. This should allow
more generic usage and possibly make testing a little easier.
o This LoadObj accepts a function that returns a
std::unique_ptr<std::istream> for a material.
+ Modified LoadMtl to read from a std::istream to allow more generic
usage.
+ Modified test.cc to check that the changes work as expected and nothing was
broken.
Tests:
+ Compiled test.cc, checked diff of output against pre change output.
Same output where expected.
variables should be passed by reference.
They are passed by value. It could be passed as a (const) reference which is usually faster and recommended in C++.
This gives a 9% performance boost in my project.
26.28s to load instead of 28.94s