MCPcopy Create free account
hub / github.com/Siv3D/OpenSiv3D / ParseFromFile

Method ParseFromFile

Siv3D/src/ThirdParty/tinyobjloader/tiny_obj_loader.h:3170–3192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3168}
3169
3170bool ObjReader::ParseFromFile(const std::string &filename,
3171 const ObjReaderConfig &config) {
3172 std::string mtl_search_path;
3173
3174 if (config.mtl_search_path.empty()) {
3175 //
3176 // split at last '/'(for unixish system) or '\\'(for windows) to get
3177 // the base directory of .obj file
3178 //
3179 size_t pos = filename.find_last_of("/\\");
3180 if (pos != std::string::npos) {
3181 mtl_search_path = filename.substr(0, pos);
3182 }
3183 } else {
3184 mtl_search_path = config.mtl_search_path;
3185 }
3186
3187 valid_ = LoadObj(&attrib_, &shapes_, &materials_, &warning_, &error_,
3188 filename.c_str(), mtl_search_path.c_str(),
3189 config.triangulate, config.vertex_color);
3190
3191 return valid_;
3192}
3193
3194bool ObjReader::ParseFromString(const std::string &obj_text,
3195 const std::string &mtl_text,

Callers 1

ModelDataMethod · 0.80

Calls 4

LoadObjFunction · 0.85
emptyMethod · 0.45
substrMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected