summaryrefslogtreecommitdiff
path: root/gfx/models/obj_loader.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-01-30 20:36:42 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-04 19:29:49 +0000
commitbde4a9f40bb4af39270a124d5ef9571a83305d0a (patch)
tree536719df20d8f18d4c40e893c2f93b4fa45fb2d5 /gfx/models/obj_loader.cpp
parentAdd some tests over collection (diff)
downloadilt-bde4a9f40bb4af39270a124d5ef9571a83305d0a.tar.bz2
ilt-bde4a9f40bb4af39270a124d5ef9571a83305d0a.tar.xz
ilt-bde4a9f40bb4af39270a124d5ef9571a83305d0a.zip
Restructure to allow a resource path and testing
Diffstat (limited to 'gfx/models/obj_loader.cpp')
-rw-r--r--gfx/models/obj_loader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/gfx/models/obj_loader.cpp b/gfx/models/obj_loader.cpp
index 7611a2c..75ab251 100644
--- a/gfx/models/obj_loader.cpp
+++ b/gfx/models/obj_loader.cpp
@@ -3,6 +3,7 @@
#include <fstream>
#include <map>
#include <memory>
+#include <resource.h>
#include <stdexcept>
#include <utility>
@@ -12,12 +13,12 @@ static inline unsigned int ParseOBJIndexValue(const std::string & token, unsigne
static inline float ParseOBJFloatValue(const std::string & token, unsigned int start, unsigned int end);
static inline std::vector<std::string> SplitString(const std::string & s, char delim);
-OBJModel::OBJModel(const std::string & fileName)
+OBJModel::OBJModel(const std::filesystem::path & fileName)
{
hasUVs = false;
hasNormals = false;
std::ifstream file;
- file.open(fileName.c_str());
+ file.open(Resource::mapPath(fileName).c_str());
std::string line;
if (file.is_open()) {
@@ -55,7 +56,7 @@ OBJModel::OBJModel(const std::string & fileName)
}
}
else {
- throw std::runtime_error {"Unable to load mesh: " + fileName};
+ throw std::runtime_error {"Unable to load mesh: " + fileName.string()};
}
}