Merge pull request #126 from alangfel/multiple_texoptions

Deal with more than one texture option
This commit is contained in:
Syoyo Fujita
2017-05-24 14:59:56 +09:00
committed by GitHub

View File

@@ -788,6 +788,7 @@ static bool ParseTextureNameAndOption(std::string *texname,
const char *token = linebuf; // Assume line ends with NULL const char *token = linebuf; // Assume line ends with NULL
while (!IS_NEW_LINE((*token))) { while (!IS_NEW_LINE((*token))) {
token += strspn(token, " \t"); // skip space
if ((0 == strncmp(token, "-blendu", 7)) && IS_SPACE((token[7]))) { if ((0 == strncmp(token, "-blendu", 7)) && IS_SPACE((token[7]))) {
token += 8; token += 8;
texopt->blendu = parseOnOff(&token, /* default */ true); 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); parseReal2(&(texopt->brightness), &(texopt->contrast), &token, 0.0, 1.0);
} else { } else {
// Assume texture filename // Assume texture filename
token += strspn(token, " \t"); // skip space
size_t len = strcspn(token, " \t\r"); // untile next space size_t len = strcspn(token, " \t\r"); // untile next space
texture_name = std::string(token, token + len); texture_name = std::string(token, token + len);
token += len; token += len;