Skip to content

Commit 59faa2d

Browse files
committed
minor update of obj
1 parent 7a361c1 commit 59faa2d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/runtime/mesh/ObjFile.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ struct ObjIndexHash {
2323

2424
TriMesh load(const Path& path, const std::optional<size_t>& shape_index)
2525
{
26+
std::fstream stream(path, std::ios::in | std::ios::binary);
27+
if (!stream) {
28+
IG_LOG(L_ERROR) << "Given file '" << path << "' can not be opened." << std::endl;
29+
return TriMesh{};
30+
}
31+
2632
tinyobj::attrib_t attrib;
2733
std::vector<tinyobj::shape_t> shapes;
2834
std::vector<tinyobj::material_t> materials;
2935

3036
std::string warn;
3137
std::string err;
3238

33-
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, path.generic_string().c_str());
39+
const bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, &stream, nullptr, true, false);
3440

3541
if (!warn.empty())
3642
IG_LOG(L_WARNING) << "ObjFile " << path << ": " << warn << std::endl;

0 commit comments

Comments
 (0)