summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--MagicEx/src/ModelFileOBJ.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/MagicEx/src/ModelFileOBJ.cpp b/MagicEx/src/ModelFileOBJ.cpp
index 9ab7e69..03c8cde 100644
--- a/MagicEx/src/ModelFileOBJ.cpp
+++ b/MagicEx/src/ModelFileOBJ.cpp
@@ -212,6 +212,20 @@ static int LoadMatls(const char* lpszPathName, Model* m)
LoadTexture(src, mtl->tex_diffuse, Bitmap::BMP_SOLID);
}
+
+ else if (strstr(line, "map_Ks")) {
+ const char* src = strstr(line, "map_Ks") + 7;
+ while (!isalnum(*src)) src++;
+
+ LoadTexture(src, mtl->tex_specular, Bitmap::BMP_SOLID);
+ }
+
+ else if (strstr(line, "map_Ke")) {
+ const char* src = strstr(line, "map_Ke") + 7;
+ while (!isalnum(*src)) src++;
+
+ LoadTexture(src, mtl->tex_emissive, Bitmap::BMP_SOLID);
+ }
}
fclose(fp);
@@ -641,6 +655,10 @@ SaveWaveFrontMatLib(const char* path, const char* root, Model* model)
fprintf(f, "illum 2\n");
if (mtl->tex_diffuse)
fprintf(f, "map_Kd %s\n", mtl->tex_diffuse->GetFilename());
+ if (mtl->tex_specular)
+ fprintf(f, "map_Ks %s\n", mtl->tex_specular->GetFilename());
+ if (mtl->tex_emissive)
+ fprintf(f, "map_Ke %s\n", mtl->tex_emissive->GetFilename());
fprintf(f, "\n");
}