Merge branch 'master' of https://git.frank-ebner.de/FHWS/Indoor
This commit is contained in:
@@ -9,8 +9,9 @@
|
|||||||
#include "Obstacle3.h"
|
#include "Obstacle3.h"
|
||||||
|
|
||||||
// LINUX ONLY
|
// LINUX ONLY
|
||||||
#include <dirent.h>
|
//#include <dirent.h>
|
||||||
#include <stdio.h>
|
//#include <stdio.h>
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
|
||||||
|
|
||||||
namespace Ray3D {
|
namespace Ray3D {
|
||||||
@@ -42,19 +43,26 @@ namespace Ray3D {
|
|||||||
initDone = true;
|
initDone = true;
|
||||||
|
|
||||||
// LINUX ONLY!
|
// LINUX ONLY!
|
||||||
DIR* d = opendir(folder.c_str());
|
//DIR* d = opendir(folder.c_str());
|
||||||
if (!d) {throw Exception("OBJPool: folder not found: " + folder);}
|
//if (!d) {throw Exception("OBJPool: folder not found: " + folder);}
|
||||||
|
std::experimental::filesystem::path d(folder);
|
||||||
|
if (!std::experimental::filesystem::exists(d)) {
|
||||||
|
throw Exception("OBJPool: folder not found: " + folder);
|
||||||
|
}
|
||||||
|
|
||||||
struct dirent *dir;
|
//struct dirent *dir;
|
||||||
while ((dir = readdir(d)) != NULL) {
|
//while ((dir = readdir(d)) != NULL) {
|
||||||
const std::string absFile = folder + "/" + dir->d_name;
|
for (std::experimental::filesystem::directory_entry entry : std::experimental::filesystem::directory_iterator(d)) {
|
||||||
|
//const std::string absFile = folder + "/" + dir->d_name;
|
||||||
|
const std::string absFile = entry.path().native();
|
||||||
if (endsWith(absFile, ".obj")) {
|
if (endsWith(absFile, ".obj")) {
|
||||||
std::string name = std::string(dir->d_name);
|
//std::string name = std::string(dir->d_name);
|
||||||
|
std::string name = entry.path().filename();
|
||||||
name = name.substr(0, name.length() - 4); // without extension
|
name = name.substr(0, name.length() - 4); // without extension
|
||||||
load(absFile, name);
|
load(absFile, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(d);
|
//closedir(d);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (numVertices != 3) {throw "this face is not a triangle!";}
|
// if (numVertices != 3) {throw "this face is not a triangle!";}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user