Commit: 26f721b51638f4a350e19c18406298f8cc57f453
Author: Aras Pranckevicius
Date:   Wed Jul 6 09:05:20 2022 +0300
Branches: master
https://developer.blender.org/rB26f721b51638f4a350e19c18406298f8cc57f453

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).

===================================================================

M       source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc

===================================================================

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));
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to