]> OCCT Git - occt.git/commitdiff
0031706: Data Exchange, RWGltf_CafReader - imports model with incorrect transformation
authorkgv <kgv@opencascade.com>
Fri, 28 Aug 2020 09:53:51 +0000 (12:53 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 28 Aug 2020 15:00:22 +0000 (18:00 +0300)
RWGltf_GltfJsonParser::bindNamedShape() - shape location is now multiplied not just overridden.

src/RWGltf/RWGltf_GltfJsonParser.cxx
tests/de_mesh/gltf_read/launchvehicle [new file with mode: 0644]

index 557297024e068e08b0fb184ed9d0b7f223431b74..77cda38e224bda722f4f345929f841421f56a7cd 100644 (file)
@@ -1827,7 +1827,14 @@ void RWGltf_GltfJsonParser::bindNamedShape (TopoDS_Shape& theShape,
 
   if (!theLoc.IsIdentity())
   {
-    theShape.Location (theLoc);
+    if (!theShape.Location().IsIdentity())
+    {
+      theShape.Location (theLoc * theShape.Location());
+    }
+    else
+    {
+      theShape.Location (theLoc);
+    }
   }
 
   TCollection_AsciiString aUserName;
diff --git a/tests/de_mesh/gltf_read/launchvehicle b/tests/de_mesh/gltf_read/launchvehicle
new file mode 100644 (file)
index 0000000..26b108f
--- /dev/null
@@ -0,0 +1,15 @@
+puts "========"
+puts "0031706: Data Exchange, RWGltf_CafReader - imports model with incorrect transformation"
+puts "========"
+
+ReadGltf D [locate_data_file bug31706_launchvehicle.glb]
+XGetOneShape s D
+checknbshapes s -face 9 -compound 13
+checktrinfo s -tri 47640 -nod 35270
+
+if { [XDumpLocation D 0:1:1:15:5] != "Transformation (3 rows * 4 columns matrix): (1,0,0,0) (0,1,0,-3350) (0,0,1,-2700)" } {
+  puts "Error: wrong location of D:Root/CentaurBody/Fairing1"
+}
+if { [XDumpLocation D 0:1:1:15:6] != "Transformation (3 rows * 4 columns matrix): (-1,-0,-1.50996e-07,0.000407689) (0,1,0,-3350) (1.50996e-07,0,-1,2700)" } {
+  puts "Error: wrong location of D:Root/CentaurBody/FairingFlipper_180_Y"
+}