Skip to content

Commit 7c7335c

Browse files
committed
Add test for parsing bump_multipler for normal map.
1 parent 3a9483c commit 7c7335c

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

models/norm-texopt.mtl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
newmtl default
2+
Ka 0 0 0
3+
Kd 0 0 0
4+
Ks 0 0 0
5+
Kt 0.1 0.2 0.3
6+
norm -bm 3 normalmap.jpg
7+

models/norm-texopt.obj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mtllib norm-texopt.mtl
2+
o Test
3+
v 1.864151 -1.219172 -5.532511
4+
v 0.575869 -0.666304 5.896140
5+
v 0.940448 1.000000 -1.971128
6+
usemtl default
7+
f 1 2 3

tests/tester.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,24 @@ TEST_CASE("g_ignored", "[Issue138]") {
625625

626626
}
627627

628+
TEST_CASE("norm_texopts", "[norm]") {
629+
tinyobj::attrib_t attrib;
630+
std::vector<tinyobj::shape_t> shapes;
631+
std::vector<tinyobj::material_t> materials;
632+
633+
std::string err;
634+
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/norm-texopt.obj", gMtlBasePath);
635+
636+
if (!err.empty()) {
637+
std::cerr << err << std::endl;
638+
}
639+
REQUIRE(true == ret);
640+
REQUIRE(1 == shapes.size());
641+
REQUIRE(1 == materials.size());
642+
REQUIRE(3.0 == Approx(materials[0].normal_texopt.bump_multiplier));
643+
644+
}
645+
628646
#if 0
629647
int
630648
main(

0 commit comments

Comments
 (0)