aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralangfel <alangfel@users.noreply.github.com>2017-05-12 08:34:05 +0200
committerGitHub <noreply@github.com>2017-05-12 08:34:05 +0200
commitcc948e4c443aac525ca3822c602ae871dc35c9a6 (patch)
tree2caad52a3c4839001f7b29a04283caec000d2a44
parent889b2187c1baa2e918069ae7fb7b14348ba4574b (diff)
downloadtinyobjloader-cc948e4c443aac525ca3822c602ae871dc35c9a6.tar.gz
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.
-rw-r--r--tiny_obj_loader.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tiny_obj_loader.h b/tiny_obj_loader.h
index ee44076..a666f33 100644
--- a/tiny_obj_loader.h
+++ b/tiny_obj_loader.h
@@ -788,6 +788,7 @@ static bool ParseTextureNameAndOption(std::string *texname,
const char *token = linebuf; // Assume line ends with NULL
while (!IS_NEW_LINE((*token))) {
+ token += strspn(token, " \t"); // skip space
if ((0 == strncmp(token, "-blendu", 7)) && IS_SPACE((token[7]))) {
token += 8;
texopt->blendu = parseOnOff(&token, /* default */ true);
@@ -831,7 +832,6 @@ static bool ParseTextureNameAndOption(std::string *texname,
parseReal2(&(texopt->brightness), &(texopt->contrast), &token, 0.0, 1.0);
} else {
// Assume texture filename
- token += strspn(token, " \t"); // skip space
size_t len = strcspn(token, " \t\r"); // untile next space
texture_name = std::string(token, token + len);
token += len;