replace windows folder sperator

This commit is contained in:
yangxiao 2015-05-29 16:43:36 +08:00
parent 410d09525f
commit 618f63cb35
1 changed files with 13 additions and 0 deletions

View File

@ -273,6 +273,15 @@ void InitMaterial(ObjLoader::material_t& material)
material.unknown_parameter.clear();
}
static std::string& replacePathSeperator(std::string& path)
{
for (int i = 0; i < path.size(); i++) {
if (path[i] == '\\')
path[i] = '/';
}
return path;
}
std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map, const char* filename, const char* mtl_basepath)
{
material_map.clear();
@ -451,6 +460,7 @@ std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map
{
token += 7;
material.ambient_texname = trim(token);
replacePathSeperator(material.ambient_texname);
continue;
}
@ -459,6 +469,7 @@ std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map
{
token += 7;
material.diffuse_texname = trim(token);
replacePathSeperator(material.diffuse_texname);
continue;
}
@ -467,6 +478,7 @@ std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map
{
token += 7;
material.specular_texname = trim(token);
replacePathSeperator(material.specular_texname);
continue;
}
@ -475,6 +487,7 @@ std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map
{
token += 7;
material.normal_texname = trim(token);
replacePathSeperator(material.normal_texname);
continue;
}