Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-07-06 09:05:20 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-07-06 09:05:20 +0300
commit26f721b51638f4a350e19c18406298f8cc57f453 (patch)
tree4695600f543cf7ac416ada32c2b5803fad06c216 /source/blender/io
parente58e023e1a3e10f4ff2557aedcd730b5dba23579 (diff)
OBJ: extend test coverage for parsing MTL scale/offsets (T89421)
The new OBJ/MTL importer was already handling case T89421 correctly, but there was no test coverage to prove it. Extend the tests to parse various forms of "-o" and "-s" (one, two, three numbers).
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc b/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc
index 068cdc0bf3a..5b909865d9b 100644
--- a/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc
@@ -158,7 +158,7 @@ TEST_F(obj_mtl_parser_test, all_objects)
TEST_F(obj_mtl_parser_test, materials)
{
- MTLMaterial mat[5];
+ MTLMaterial mat[6];
mat[0].name = "no_textures_red";
mat[0].Ka = {0.3f, 0.3f, 0.3f};
mat[0].Kd = {0.8f, 0.3f, 0.1f};
@@ -236,6 +236,20 @@ TEST_F(obj_mtl_parser_test, materials)
bump.scale = {3, 4, 5};
}
+ mat[5].name = "Parser_ScaleOffset_Test";
+ {
+ tex_map_XX &kd = mat[5].tex_map_of_type(eMTLSyntaxElement::map_Kd);
+ kd.translation = {2.5f, 0.0f, 0.0f};
+ kd.image_path = "OffsetOneValue.png";
+ tex_map_XX &ks = mat[5].tex_map_of_type(eMTLSyntaxElement::map_Ks);
+ ks.scale = {1.5f, 2.5f, 1.0f};
+ ks.translation = {3.5f, 4.5f, 0.0f};
+ ks.image_path = "ScaleOffsetBothTwovalues.png";
+ tex_map_XX &ns = mat[5].tex_map_of_type(eMTLSyntaxElement::map_Ns);
+ ns.scale = {0.5f, 1.0f, 1.0f};
+ ns.image_path = "ScaleOneValue.png";
+ }
+
check("materials.mtl", mat, ARRAY_SIZE(mat));
}