Selaa lähdekoodia

Continued revision to exporter fix, removed dependence on worldspace, due to export-time transformation to right hand coordinate system

Nicholas Barlow 6 vuotta sitten
vanhempi
commit
1ba7c1021e

+ 2 - 2
serializers/src/glTF/2.0/glTFExporter.ts

@@ -1195,8 +1195,8 @@ export class _Exporter {
                     if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
                         let sideOrientation = babylonMaterial.sideOrientation;
 
-                        // Only reverse the winding if we have a clockwise winding in a positive worldspace
-                        if (sideOrientation === Material.ClockWiseSideOrientation && babylonTransformNode.getWorldMatrix().determinant() > 0) {
+                        // Only reverse the winding if we have a clockwise winding
+``                      if (sideOrientation === Material.ClockWiseSideOrientation) {
                             let byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
                             if (byteOffset == null) { byteOffset = 0; }
                             let babylonIndices: Nullable<IndicesArray> = null;

BIN
tests/validation/ReferenceImages/glTFSerializerNegativeWorldMatrix.png


BIN
tests/validation/ReferenceImages/glTFSerializerNegativeWorldMatrix_Right.png


+ 11 - 0
tests/validation/config.json

@@ -375,6 +375,17 @@
       "referenceImage": "glTFSerializerTextureTransform.png"
     },
     {
+      "title": "GLTF Serializer with Negative World Matrix",
+      "playgroundId": "#KX53VK#23",
+      "referenceImage": "glTFSerializerNegativeWorldMatrix.png"
+    },
+    {
+      "title": "GLTF Serializer with Negative World Matrix (Right Handed)",
+      "playgroundId": "#KX53VK#23",
+      "replace": "useRightHandedSystem = false, useRightHandedSystem = true",
+      "referenceImage": "glTFSerializerNegativeWorldMatrix_Right.png"
+    },
+    {
       "title": "GLTF Texture Sampler",
       "playgroundId": "#a68vz0#16",
       "referenceImage": "gltfTextureSampler.png"