Add colorspace extension to texture options. Fixes #184

This commit is contained in:
Syoyo Fujita
2018-09-14 13:42:27 +09:00
parent 803b65b8a0
commit 1cdfd786d8
4 changed files with 47 additions and 0 deletions

View File

@@ -825,6 +825,25 @@ TEST_CASE("multiple-group-names", "[group]") {
REQUIRE(0 == shapes[1].name.compare("back cube")); // multiple whitespaces are aggregated as single white space.
}
TEST_CASE("colorspace", "[Issue184]") {
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/colorspace-issue-184.obj", gMtlBasePath);
if (!err.empty()) {
std::cerr << err << std::endl;
}
REQUIRE(true == ret);
REQUIRE(1 == shapes.size());
REQUIRE(1 == materials.size());
REQUIRE(0 == materials[0].diffuse_texopt.colorspace.compare("sRGB"));
REQUIRE(0 == materials[0].specular_texopt.colorspace.size());
REQUIRE(0 == materials[0].bump_texopt.colorspace.compare("linear"));
}
// Fuzzer test.
// Just check if it does not crash.
// Disable by default since Windows filesystem can't create filename of afl testdata