Skip to content

Commit be02c9c

Browse files
authored
Add alternative aliases for displacement maps during mtl parsing (#343)
1 parent a1e8bad commit be02c9c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tiny_obj_loader.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,15 +2203,8 @@ void LoadMtl(std::map<std::string, int> *material_map,
22032203
}
22042204

22052205
// bump texture
2206-
if ((0 == strncmp(token, "map_bump", 8)) && IS_SPACE(token[8])) {
2207-
token += 9;
2208-
ParseTextureNameAndOption(&(material.bump_texname),
2209-
&(material.bump_texopt), token);
2210-
continue;
2211-
}
2212-
2213-
// bump texture
2214-
if ((0 == strncmp(token, "map_Bump", 8)) && IS_SPACE(token[8])) {
2206+
if ((0 == strncmp(token, "map_bump", 8)) && IS_SPACE(token[8]) ||
2207+
(0 == strncmp(token, "map_Bump", 8)) && IS_SPACE(token[8])) {
22152208
token += 9;
22162209
ParseTextureNameAndOption(&(material.bump_texname),
22172210
&(material.bump_texopt), token);
@@ -2235,6 +2228,15 @@ void LoadMtl(std::map<std::string, int> *material_map,
22352228
continue;
22362229
}
22372230

2231+
// displacement texture
2232+
if ((0 == strncmp(token, "map_disp", 8)) && IS_SPACE(token[8]) ||
2233+
(0 == strncmp(token, "map_Disp", 8)) && IS_SPACE(token[8])) {
2234+
token += 9;
2235+
ParseTextureNameAndOption(&(material.displacement_texname),
2236+
&(material.displacement_texopt), token);
2237+
continue;
2238+
}
2239+
22382240
// displacement texture
22392241
if ((0 == strncmp(token, "disp", 4)) && IS_SPACE(token[4])) {
22402242
token += 5;

0 commit comments

Comments
 (0)