Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions 9 tests/tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ static bool TestLoadObj(const char* filename, const char* basepath = NULL,
static bool TestLoadObjFromPreopenedFile(const char* filename,
const char* basepath = NULL,
bool readMaterials = true,
bool triangulate = true) {
bool triangulate = true,
bool allow_warnings = true) {
std::string fullFilename = std::string(basepath) + filename;
std::cout << "Loading " << fullFilename << std::endl;

Expand All @@ -270,6 +271,7 @@ static bool TestLoadObjFromPreopenedFile(const char* filename,

if (!warn.empty()) {
std::cout << "WARN: " << warn << std::endl;
if (!allow_warnings) return false;
}

if (!err.empty()) {
Expand Down Expand Up @@ -467,7 +469,8 @@ void test_stream_load() { TEST_CHECK(true == TestStreamLoadObj()); }
void test_stream_load_from_file_skipping_materials() {
TEST_CHECK(true == TestLoadObjFromPreopenedFile(
"../models/pbr-mat-ext.obj", gMtlBasePath,
/*readMaterials*/ false, /*triangulate*/ false));
/*readMaterials*/ false, /*triangulate*/ false,
/* allow_warnings */ false));
}

void test_stream_load_from_file_with_materials() {
Expand Down Expand Up @@ -1267,7 +1270,7 @@ void test_mtl_searchpaths_issue244() {
std::vector<tinyobj::material_t> materials;

// .mtl is located at ./assets/issue-244.mtl
#if _WIN32
#ifdef _WIN32
std::string search_paths("../;../models;./assets");
#else
std::string search_paths("../:../models:./assets");
Expand Down
2 changes: 2 additions & 0 deletions 2 tiny_obj_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2848,6 +2848,8 @@ bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,

// use mtl
if ((0 == strncmp(token, "usemtl", 6))) {
// Skip materials if we don't have a material reader.
if (!readMatFn) continue;
token += 6;
std::string namebuf = parseString(&token);

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.