Fix build on linux.
This commit is contained in:
7
test.cc
7
test.cc
@@ -1,5 +1,7 @@
|
||||
#include "tiny_obj_loader.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
@@ -51,6 +53,11 @@ main(
|
||||
printf(" material.map_Kd = %s\n", shapes[i].material.diffuse_texname.c_str());
|
||||
printf(" material.map_Ks = %s\n", shapes[i].material.specular_texname.c_str());
|
||||
printf(" material.map_Ns = %s\n", shapes[i].material.normal_texname.c_str());
|
||||
std::map<std::string, std::string>::iterator it(shapes[i].material.unknown_parameter.begin());
|
||||
std::map<std::string, std::string>::iterator itEnd(shapes[i].material.unknown_parameter.end());
|
||||
for (; it != itEnd; it++) {
|
||||
printf(" material.%s = %s\n", it->first.c_str(), it->second.c_str());
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,14 @@
|
||||
//
|
||||
|
||||
//
|
||||
// version 0.9.1: Add initial .mtl load suppor
|
||||
// version 0.9.2: Add more .mtl load support
|
||||
// version 0.9.1: Add initial .mtl load support
|
||||
// version 0.9.0: Initial
|
||||
//
|
||||
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
#include <string>
|
||||
@@ -403,13 +406,13 @@ std::string LoadMtl (
|
||||
}
|
||||
|
||||
// unknown parameter
|
||||
char* _space = strchr(token, ' ');
|
||||
const char* _space = strchr(token, ' ');
|
||||
if(!_space) {
|
||||
_space = strchr(token, '\t');
|
||||
}
|
||||
if(_space) {
|
||||
*_space = '\0';
|
||||
std::string key = token;
|
||||
int len = _space - token;
|
||||
std::string key(token, len);
|
||||
std::string value = _space + 1;
|
||||
material.unknown_parameter.insert(std::pair<std::string, std::string>(key, value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user