Compare commits
20 Commits
better-cxx
...
tigrazone
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
160d6be10f | ||
|
|
583590767e | ||
|
|
dc542d6638 | ||
|
|
c5976f931b | ||
|
|
0511658e86 | ||
|
|
54851f8ac7 | ||
|
|
a6c1d07560 | ||
|
|
4fe479453b | ||
|
|
af1bcf1e11 | ||
|
|
05f06d09d8 | ||
|
|
3c0196bfb7 | ||
|
|
dc4c970262 | ||
|
|
aeb0f05c0e | ||
|
|
c016910317 | ||
|
|
5d7f6bf539 | ||
|
|
b818a34f1a | ||
|
|
baa62f4d89 | ||
|
|
b2f07d10aa | ||
|
|
ee2c734c15 | ||
|
|
6e579f027f |
@@ -1440,9 +1440,7 @@ bool parseObj(attrib_t *attrib, std::vector<shape_t> *shapes,
|
||||
// std::cout << "mtllib :" << material_filename << std::endl;
|
||||
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
if (material_filename.back() == '\r') {
|
||||
material_filename.pop_back();
|
||||
}
|
||||
|
||||
std::ifstream ifs(material_filename);
|
||||
if (ifs.good()) {
|
||||
LoadMtl(&material_map, materials, &ifs);
|
||||
@@ -1518,13 +1516,13 @@ bool parseObj(attrib_t *attrib, std::vector<shape_t> *shapes,
|
||||
StackVector<std::thread, 16> workers;
|
||||
|
||||
for (size_t t = 0; t < num_threads; t++) {
|
||||
int material_id = -1; // -1 = default unknown material.
|
||||
workers->push_back(std::thread([&, t]() {
|
||||
size_t v_count = v_offsets[t];
|
||||
size_t n_count = n_offsets[t];
|
||||
size_t t_count = t_offsets[t];
|
||||
size_t f_count = f_offsets[t];
|
||||
size_t face_count = face_offsets[t];
|
||||
int material_id = -1; // -1 = default unknown material.
|
||||
|
||||
for (size_t i = 0; i < commands[t].size(); i++) {
|
||||
if (commands[t][i].type == COMMAND_EMPTY) {
|
||||
@@ -1581,19 +1579,7 @@ bool parseObj(attrib_t *attrib, std::vector<shape_t> *shapes,
|
||||
for (size_t t = 0; t < workers->size(); t++) {
|
||||
workers[t].join();
|
||||
}
|
||||
if(material_map.size()>1&& num_threads>1) {
|
||||
for (size_t t = 0; t < num_threads; t++) {
|
||||
size_t face_count = face_offsets[t];
|
||||
if (-1 == attrib->material_ids[face_count]) {
|
||||
int prev_material_id = attrib->material_ids[face_count - 1];
|
||||
size_t max_face_offset = (t == num_threads - 1) ? attrib->material_ids.size() : face_offsets[t + 1];
|
||||
for (int i = face_count; i<max_face_offset; ++i) {
|
||||
if (attrib->material_ids[i] != -1) break;
|
||||
attrib->material_ids[i] = prev_material_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto t_end = std::chrono::high_resolution_clock::now();
|
||||
ms_merge = t_end - t_start;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,6 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TINYOBJ_USE_CXX11
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class timerutil {
|
||||
public:
|
||||
#ifdef _WIN32
|
||||
@@ -70,7 +63,7 @@ class timerutil {
|
||||
}
|
||||
time_t current() {
|
||||
struct timeval t;
|
||||
gettimeofday(&t, tobj_null);
|
||||
gettimeofday(&t, NULL);
|
||||
return static_cast<time_t>(t.tv_sec * 1000 + t.tv_usec);
|
||||
}
|
||||
|
||||
@@ -268,7 +261,7 @@ static void PrintInfo(const tinyobj::attrib_t& attrib,
|
||||
}
|
||||
}
|
||||
|
||||
static bool TestLoadObj(const char* filename, const char* basepath = tobj_null,
|
||||
static bool TestLoadObj(const char* filename, const char* basepath = NULL,
|
||||
bool triangulate = true) {
|
||||
std::cout << "Loading " << filename << std::endl;
|
||||
|
||||
@@ -368,7 +361,7 @@ static bool TestStreamLoadObj() {
|
||||
virtual ~MaterialStringStreamReader() {}
|
||||
virtual bool operator()(const std::string& matId,
|
||||
std::vector<material_t>* materials,
|
||||
std::map<std::string, int>* matMap,
|
||||
std::map<unsigned int, int>* matMap,
|
||||
std::string* err) {
|
||||
(void)matId;
|
||||
std::string warning;
|
||||
|
||||
@@ -303,7 +303,8 @@ std::string matStream(
|
||||
virtual bool operator() (
|
||||
const std::string& matId,
|
||||
std::vector<material_t>* materials,
|
||||
std::map<std::string, int>* matMap,
|
||||
//std::map<std::string, int>* matMap,
|
||||
std::map<uint32_t, int>* matMap,
|
||||
std::string* err)
|
||||
{
|
||||
(void)matId;
|
||||
|
||||
1779
tiny_obj_loader.h
1779
tiny_obj_loader.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user