Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc948e4

Browse files
authored
Deal with more than one texture option
After processing one textureoption like "-s u v w" the next option " -o u v w" has a beginning whitespace. Due to this it does not match to the option "-o" and it is skipped.
1 parent 889b218 commit cc948e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tiny_obj_loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ static bool ParseTextureNameAndOption(std::string *texname,
788788
const char *token = linebuf; // Assume line ends with NULL
789789

790790
while (!IS_NEW_LINE((*token))) {
791+
token += strspn(token, " \t"); // skip space
791792
if ((0 == strncmp(token, "-blendu", 7)) && IS_SPACE((token[7]))) {
792793
token += 8;
793794
texopt->blendu = parseOnOff(&token, /* default */ true);
@@ -831,7 +832,6 @@ static bool ParseTextureNameAndOption(std::string *texname,
831832
parseReal2(&(texopt->brightness), &(texopt->contrast), &token, 0.0, 1.0);
832833
} else {
833834
// Assume texture filename
834-
token += strspn(token, " \t"); // skip space
835835
size_t len = strcspn(token, " \t\r"); // untile next space
836836
texture_name = std::string(token, token + len);
837837
token += len;

0 commit comments

Comments
 (0)