babylonjs-serializers 6.6.0 → 6.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  exports["babylonjs-serializers"] = factory(require("babylonjs"));
8
8
  else
9
9
  root["SERIALIZERS"] = factory(root["BABYLON"]);
10
- })((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (__WEBPACK_EXTERNAL_MODULE_core_Maths_math_vector__) => {
10
+ })((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (__WEBPACK_EXTERNAL_MODULE_core_Meshes_mesh__) => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ "use strict";
13
13
  /******/ var __webpack_modules__ = ({
@@ -358,7 +358,7 @@ __webpack_require__.r(__webpack_exports__);
358
358
  /* harmony export */ "EXT_mesh_gpu_instancing": () => (/* binding */ EXT_mesh_gpu_instancing)
359
359
  /* harmony export */ });
360
360
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
361
- /* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Buffers/buffer */ "core/Maths/math.vector");
361
+ /* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Buffers/buffer */ "core/Meshes/mesh");
362
362
  /* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__);
363
363
 
364
364
 
@@ -507,12 +507,9 @@ __webpack_require__.r(__webpack_exports__);
507
507
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
508
508
  /* harmony export */ "KHR_lights_punctual": () => (/* binding */ KHR_lights_punctual)
509
509
  /* harmony export */ });
510
- /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/logger */ "core/Maths/math.vector");
510
+ /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/logger */ "core/Meshes/mesh");
511
511
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
512
512
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
513
- /* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
514
-
515
-
516
513
 
517
514
 
518
515
 
@@ -565,57 +562,48 @@ var KHR_lights_punctual = /** @class */ (function () {
565
562
  var _this = this;
566
563
  return new Promise(function (resolve) {
567
564
  if (node && babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.ShadowLight) {
568
- var babylonLight = babylonNode;
569
565
  var light = void 0;
570
- var lightType = babylonLight.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_POINTLIGHT
566
+ var lightType = babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_POINTLIGHT
571
567
  ? "point" /* KHRLightsPunctual_LightType.POINT */
572
- : babylonLight.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_DIRECTIONALLIGHT
568
+ : babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_DIRECTIONALLIGHT
573
569
  ? "directional" /* KHRLightsPunctual_LightType.DIRECTIONAL */
574
- : babylonLight.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_SPOTLIGHT
570
+ : babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_SPOTLIGHT
575
571
  ? "spot" /* KHRLightsPunctual_LightType.SPOT */
576
572
  : null;
577
573
  if (lightType == null) {
578
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light ").concat(babylonLight.name, " is not supported in ").concat(NAME));
574
+ core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light ").concat(babylonNode.name, " is not supported in ").concat(NAME));
579
575
  }
580
576
  else {
581
- var lightPosition = babylonLight.position.clone();
582
- var convertToRightHandedSystem = _this._exporter._convertToRightHandedSystemMap[babylonNode.uniqueId];
583
- if (!lightPosition.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero())) {
584
- if (convertToRightHandedSystem) {
585
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedPositionVector3FromRef(lightPosition);
586
- }
587
- node.translation = lightPosition.asArray();
577
+ if (!babylonNode.position.equalsToFloats(0, 0, 0)) {
578
+ node.translation = babylonNode.position.asArray();
588
579
  }
589
580
  if (lightType !== "point" /* KHRLightsPunctual_LightType.POINT */) {
590
- var localAxis = babylonLight.direction;
591
- var yaw = -Math.atan2(localAxis.z * (_this._exporter._babylonScene.useRightHandedSystem ? -1 : 1), localAxis.x) + Math.PI / 2;
581
+ var localAxis = babylonNode.direction;
582
+ var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
592
583
  var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
593
584
  var pitch = -Math.atan2(localAxis.y, len);
594
- var lightRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw, pitch, 0);
595
- if (convertToRightHandedSystem) {
596
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedQuaternionFromRef(lightRotationQuaternion);
597
- }
598
- if (!lightRotationQuaternion.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity())) {
585
+ var lightRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw + Math.PI, pitch, 0);
586
+ if (!core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(lightRotationQuaternion)) {
599
587
  node.rotation = lightRotationQuaternion.asArray();
600
588
  }
601
589
  }
602
- if (babylonLight.falloffType !== core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.FALLOFF_GLTF) {
603
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light falloff for ").concat(babylonLight.name, " does not match the ").concat(NAME, " specification!"));
590
+ if (babylonNode.falloffType !== core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.FALLOFF_GLTF) {
591
+ core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light falloff for ").concat(babylonNode.name, " does not match the ").concat(NAME, " specification!"));
604
592
  }
605
593
  light = {
606
594
  type: lightType,
607
595
  };
608
- if (!babylonLight.diffuse.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White())) {
609
- light.color = babylonLight.diffuse.asArray();
596
+ if (!babylonNode.diffuse.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White())) {
597
+ light.color = babylonNode.diffuse.asArray();
610
598
  }
611
- if (babylonLight.intensity !== 1.0) {
612
- light.intensity = babylonLight.intensity;
599
+ if (babylonNode.intensity !== 1.0) {
600
+ light.intensity = babylonNode.intensity;
613
601
  }
614
- if (babylonLight.range !== Number.MAX_VALUE) {
615
- light.range = babylonLight.range;
602
+ if (babylonNode.range !== Number.MAX_VALUE) {
603
+ light.range = babylonNode.range;
616
604
  }
617
605
  if (lightType === "spot" /* KHRLightsPunctual_LightType.SPOT */) {
618
- var babylonSpotLight = babylonLight;
606
+ var babylonSpotLight = babylonNode;
619
607
  if (babylonSpotLight.angle !== Math.PI / 2.0) {
620
608
  if (light.spot == null) {
621
609
  light.spot = {};
@@ -629,11 +617,9 @@ var KHR_lights_punctual = /** @class */ (function () {
629
617
  light.spot.innerConeAngle = babylonSpotLight.innerAngle / 2.0;
630
618
  }
631
619
  }
632
- if (_this._lights == null) {
633
- _this._lights = {
634
- lights: [],
635
- };
636
- }
620
+ _this._lights || (_this._lights = {
621
+ lights: [],
622
+ });
637
623
  _this._lights.lights.push(light);
638
624
  var lightReference = {
639
625
  light: _this._lights.lights.length - 1,
@@ -643,52 +629,41 @@ var KHR_lights_punctual = /** @class */ (function () {
643
629
  if (parentBabylonNode && parentBabylonNode.getChildren().length == 1) {
644
630
  var parentNode = _this._exporter._nodes[nodeMap[parentBabylonNode.uniqueId]];
645
631
  if (parentNode) {
646
- var parentNodeLocalMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0];
647
- var parentInvertNodeLocalMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[1];
648
- var parentNodeLocalTranslation = parentNode.translation
649
- ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(parentNode.translation[0], parentNode.translation[1], parentNode.translation[2])
650
- : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();
651
- var parentNodeLocalRotation = parentNode.rotation
652
- ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion(parentNode.rotation[0], parentNode.rotation[1], parentNode.rotation[2], parentNode.rotation[3])
653
- : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity();
654
- var parentNodeLocalScale = parentNode.scale ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(parentNode.scale[0], parentNode.scale[1], parentNode.scale[2]) : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.One();
655
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(parentNodeLocalScale, parentNodeLocalRotation, parentNodeLocalTranslation, parentNodeLocalMatrix);
656
- parentNodeLocalMatrix.invertToRef(parentInvertNodeLocalMatrix);
657
- // Convert light local matrix to local matrix relative to grandparent, facing -Z
658
- var lightLocalMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[2];
659
- var nodeLocalTranslation = node.translation ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(node.translation[0], node.translation[1], node.translation[2]) : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();
660
- // Undo directional light positional offset
661
- if (babylonLight instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.DirectionalLight) {
662
- nodeLocalTranslation.subtractInPlace(_this._exporter._babylonScene.useRightHandedSystem
663
- ? babylonLight.direction
664
- : _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedPositionVector3(babylonLight.direction));
632
+ var parentTranslation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0]);
633
+ var parentRotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(parentNode.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0]);
634
+ var parentScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.scale || [1, 1, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1]);
635
+ var parentMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(parentScale, parentRotation, parentTranslation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
636
+ var translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[2]);
637
+ var rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[1]);
638
+ var matrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.OneReadOnly, rotation, translation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[1]);
639
+ parentMatrix.multiplyToRef(matrix, matrix);
640
+ matrix.decompose(parentScale, parentRotation, parentTranslation);
641
+ if (parentTranslation.equalsToFloats(0, 0, 0)) {
642
+ delete parentNode.translation;
643
+ }
644
+ else {
645
+ parentNode.translation = parentTranslation.asArray();
646
+ }
647
+ if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(parentRotation)) {
648
+ delete parentNode.rotation;
665
649
  }
666
- var nodeLocalRotation = _this._exporter._babylonScene.useRightHandedSystem ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity() : new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion(0, 1, 0, 0);
667
- if (node.rotation) {
668
- nodeLocalRotation.multiplyInPlace(new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion(node.rotation[0], node.rotation[1], node.rotation[2], node.rotation[3]));
650
+ else {
651
+ parentNode.rotation = parentRotation.asArray();
652
+ }
653
+ if (parentScale.equalsToFloats(1, 1, 1)) {
654
+ delete parentNode.scale;
669
655
  }
670
- var nodeLocalScale = node.scale ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(node.scale[0], node.scale[1], node.scale[2]) : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.One();
671
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(nodeLocalScale, nodeLocalRotation, nodeLocalTranslation, lightLocalMatrix);
672
- lightLocalMatrix.multiplyToRef(parentInvertNodeLocalMatrix, lightLocalMatrix);
673
- var parentNewScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0];
674
- var parentNewRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0];
675
- var parentNewTranslation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1];
676
- lightLocalMatrix.decompose(parentNewScale, parentNewRotationQuaternion, parentNewTranslation);
677
- parentNode.scale = parentNewScale.asArray();
678
- parentNode.rotation = parentNewRotationQuaternion.asArray();
679
- parentNode.translation = parentNewTranslation.asArray();
680
- if (parentNode.extensions == null) {
681
- parentNode.extensions = {};
656
+ else {
657
+ parentNode.scale = parentScale.asArray();
682
658
  }
659
+ parentNode.extensions || (parentNode.extensions = {});
683
660
  parentNode.extensions[NAME] = lightReference;
684
661
  // Do not export the original node
685
662
  resolve(null);
686
663
  return;
687
664
  }
688
665
  }
689
- if (node.extensions == null) {
690
- node.extensions = {};
691
- }
666
+ node.extensions || (node.extensions = {});
692
667
  node.extensions[NAME] = lightReference;
693
668
  }
694
669
  }
@@ -714,7 +689,7 @@ __webpack_require__.r(__webpack_exports__);
714
689
  /* harmony export */ "KHR_materials_anisotropy": () => (/* binding */ KHR_materials_anisotropy)
715
690
  /* harmony export */ });
716
691
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
717
- /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Maths/math.vector");
692
+ /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Meshes/mesh");
718
693
  /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
719
694
 
720
695
 
@@ -798,7 +773,7 @@ __webpack_require__.r(__webpack_exports__);
798
773
  /* harmony export */ "KHR_materials_clearcoat": () => (/* binding */ KHR_materials_clearcoat)
799
774
  /* harmony export */ });
800
775
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
801
- /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/tools */ "core/Maths/math.vector");
776
+ /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/tools */ "core/Meshes/mesh");
802
777
  /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
803
778
 
804
779
 
@@ -905,7 +880,7 @@ __webpack_require__.r(__webpack_exports__);
905
880
  /* harmony export */ "KHR_materials_emissive_strength": () => (/* binding */ KHR_materials_emissive_strength)
906
881
  /* harmony export */ });
907
882
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
908
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
883
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
909
884
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
910
885
 
911
886
 
@@ -974,7 +949,7 @@ __webpack_require__.r(__webpack_exports__);
974
949
  /* harmony export */ "KHR_materials_ior": () => (/* binding */ KHR_materials_ior)
975
950
  /* harmony export */ });
976
951
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
977
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
952
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
978
953
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
979
954
 
980
955
 
@@ -1043,7 +1018,7 @@ __webpack_require__.r(__webpack_exports__);
1043
1018
  /* harmony export */ "KHR_materials_iridescence": () => (/* binding */ KHR_materials_iridescence)
1044
1019
  /* harmony export */ });
1045
1020
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1046
- /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Maths/math.vector");
1021
+ /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Meshes/mesh");
1047
1022
  /* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
1048
1023
 
1049
1024
 
@@ -1134,7 +1109,7 @@ __webpack_require__.r(__webpack_exports__);
1134
1109
  /* harmony export */ "KHR_materials_sheen": () => (/* binding */ KHR_materials_sheen)
1135
1110
  /* harmony export */ });
1136
1111
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1137
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
1112
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
1138
1113
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
1139
1114
 
1140
1115
 
@@ -1224,7 +1199,7 @@ __webpack_require__.r(__webpack_exports__);
1224
1199
  /* harmony export */ "KHR_materials_specular": () => (/* binding */ KHR_materials_specular)
1225
1200
  /* harmony export */ });
1226
1201
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1227
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
1202
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
1228
1203
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
1229
1204
 
1230
1205
 
@@ -1326,7 +1301,7 @@ __webpack_require__.r(__webpack_exports__);
1326
1301
  /* harmony export */ "KHR_materials_transmission": () => (/* binding */ KHR_materials_transmission)
1327
1302
  /* harmony export */ });
1328
1303
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1329
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
1304
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
1330
1305
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
1331
1306
 
1332
1307
 
@@ -1419,7 +1394,7 @@ __webpack_require__.r(__webpack_exports__);
1419
1394
  /* harmony export */ "KHR_materials_unlit": () => (/* binding */ KHR_materials_unlit)
1420
1395
  /* harmony export */ });
1421
1396
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1422
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/standardMaterial */ "core/Maths/math.vector");
1397
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/standardMaterial */ "core/Meshes/mesh");
1423
1398
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
1424
1399
 
1425
1400
 
@@ -1487,7 +1462,7 @@ __webpack_require__.r(__webpack_exports__);
1487
1462
  /* harmony export */ "KHR_materials_volume": () => (/* binding */ KHR_materials_volume)
1488
1463
  /* harmony export */ });
1489
1464
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1490
- /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Maths/math.color */ "core/Maths/math.vector");
1465
+ /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Maths/math.color */ "core/Meshes/mesh");
1491
1466
  /* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
1492
1467
 
1493
1468
 
@@ -1591,7 +1566,7 @@ __webpack_require__.r(__webpack_exports__);
1591
1566
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1592
1567
  /* harmony export */ "KHR_texture_transform": () => (/* binding */ KHR_texture_transform)
1593
1568
  /* harmony export */ });
1594
- /* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Maths/math.vector");
1569
+ /* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Meshes/mesh");
1595
1570
  /* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__);
1596
1571
  /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
1597
1572
 
@@ -1748,7 +1723,7 @@ __webpack_require__.r(__webpack_exports__);
1748
1723
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1749
1724
  /* harmony export */ "_GLTFAnimation": () => (/* binding */ _GLTFAnimation)
1750
1725
  /* harmony export */ });
1751
- /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Lights/light */ "core/Maths/math.vector");
1726
+ /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Lights/light */ "core/Meshes/mesh");
1752
1727
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
1753
1728
  /* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
1754
1729
 
@@ -1799,32 +1774,30 @@ var _GLTFAnimation = /** @class */ (function () {
1799
1774
  * @param babylonTransformNode - BabylonJS mesh.
1800
1775
  * @param animation - animation.
1801
1776
  * @param animationChannelTargetPath - The target animation channel.
1802
- * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
1803
1777
  * @param useQuaternion - Specifies if quaternions are used.
1804
1778
  * @returns nullable IAnimationData
1805
1779
  */
1806
- _GLTFAnimation._CreateNodeAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion, animationSampleRate) {
1780
+ _GLTFAnimation._CreateNodeAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate) {
1807
1781
  if (this._IsTransformable(babylonTransformNode)) {
1808
1782
  var inputs = [];
1809
1783
  var outputs = [];
1810
1784
  var keyFrames = animation.getKeys();
1811
1785
  var minMaxKeyFrames = _GLTFAnimation._CalculateMinMaxKeyFrames(keyFrames);
1812
1786
  var interpolationOrBake = _GLTFAnimation._DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);
1813
- var frameDelta = minMaxKeyFrames.max - minMaxKeyFrames.min;
1814
1787
  var interpolation = interpolationOrBake.interpolationType;
1815
1788
  var shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;
1816
1789
  if (shouldBakeAnimation) {
1817
- _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);
1790
+ _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
1818
1791
  }
1819
1792
  else {
1820
1793
  if (interpolation === "LINEAR" /* AnimationSamplerInterpolation.LINEAR */ || interpolation === "STEP" /* AnimationSamplerInterpolation.STEP */) {
1821
- _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);
1794
+ _GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
1822
1795
  }
1823
1796
  else if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
1824
- _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion);
1797
+ _GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
1825
1798
  }
1826
1799
  else {
1827
- _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, convertToRightHandedSystem, useQuaternion);
1800
+ _GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
1828
1801
  }
1829
1802
  }
1830
1803
  if (inputs.length && outputs.length) {
@@ -1893,10 +1866,9 @@ var _GLTFAnimation = /** @class */ (function () {
1893
1866
  * @param binaryWriter
1894
1867
  * @param bufferViews
1895
1868
  * @param accessors
1896
- * @param convertToRightHandedSystem
1897
1869
  * @param animationSampleRate
1898
1870
  */
1899
- _GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate, shouldExportAnimation) {
1871
+ _GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
1900
1872
  var glTFAnimation;
1901
1873
  if (_GLTFAnimation._IsTransformable(babylonNode)) {
1902
1874
  if (babylonNode.animations) {
@@ -1912,7 +1884,7 @@ var _GLTFAnimation = /** @class */ (function () {
1912
1884
  samplers: [],
1913
1885
  channels: [],
1914
1886
  };
1915
- _GLTFAnimation._AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
1887
+ _GLTFAnimation._AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
1916
1888
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
1917
1889
  idleGLTFAnimations.push(glTFAnimation);
1918
1890
  }
@@ -1932,10 +1904,9 @@ var _GLTFAnimation = /** @class */ (function () {
1932
1904
  * @param binaryWriter
1933
1905
  * @param bufferViews
1934
1906
  * @param accessors
1935
- * @param convertToRightHandedSystem
1936
1907
  * @param animationSampleRate
1937
1908
  */
1938
- _GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationSampleRate, shouldExportAnimation) {
1909
+ _GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
1939
1910
  var glTFAnimation;
1940
1911
  if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
1941
1912
  var morphTargetManager = babylonNode.morphTargetManager;
@@ -1969,7 +1940,7 @@ var _GLTFAnimation = /** @class */ (function () {
1969
1940
  samplers: [],
1970
1941
  channels: [],
1971
1942
  };
1972
- _GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate, morphTargetManager.numTargets);
1943
+ _GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager.numTargets);
1973
1944
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
1974
1945
  idleGLTFAnimations.push(glTFAnimation);
1975
1946
  }
@@ -1989,10 +1960,9 @@ var _GLTFAnimation = /** @class */ (function () {
1989
1960
  * @param binaryWriter
1990
1961
  * @param bufferViews
1991
1962
  * @param accessors
1992
- * @param convertToRightHandedSystemMap
1993
1963
  * @param animationSampleRate
1994
1964
  */
1995
- _GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, convertToRightHandedSystemMap, animationSampleRate, shouldExportAnimation) {
1965
+ _GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
1996
1966
  var _a;
1997
1967
  var glTFAnimation;
1998
1968
  if (babylonScene.animationGroups) {
@@ -2019,8 +1989,7 @@ var _GLTFAnimation = /** @class */ (function () {
2019
1989
  if (animationInfo) {
2020
1990
  var babylonTransformNode = this_1._IsTransformable(target) ? target : this_1._IsTransformable(target[0]) ? target[0] : null;
2021
1991
  if (babylonTransformNode) {
2022
- var convertToRightHandedSystem = convertToRightHandedSystemMap[babylonTransformNode.uniqueId];
2023
- _GLTFAnimation._AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
1992
+ _GLTFAnimation._AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
2024
1993
  }
2025
1994
  }
2026
1995
  }
@@ -2102,7 +2071,7 @@ var _GLTFAnimation = /** @class */ (function () {
2102
2071
  combinedAnimationGroup.setKeys(animationKeys);
2103
2072
  var animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
2104
2073
  if (animationInfo) {
2105
- _GLTFAnimation._AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, false, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
2074
+ _GLTFAnimation._AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
2106
2075
  }
2107
2076
  });
2108
2077
  if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {
@@ -2116,8 +2085,8 @@ var _GLTFAnimation = /** @class */ (function () {
2116
2085
  }
2117
2086
  }
2118
2087
  };
2119
- _GLTFAnimation._AddAnimation = function (name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, useQuaternion, animationSampleRate, morphAnimationChannels) {
2120
- var animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion, animationSampleRate);
2088
+ _GLTFAnimation._AddAnimation = function (name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, useQuaternion, animationSampleRate, morphAnimationChannels) {
2089
+ var animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate);
2121
2090
  var bufferView;
2122
2091
  var accessor;
2123
2092
  var keyframeAccessorIndex;
@@ -2201,10 +2170,9 @@ var _GLTFAnimation = /** @class */ (function () {
2201
2170
  * @param minMaxFrames
2202
2171
  * @param minMaxFrames.min
2203
2172
  * @param minMaxFrames.max
2204
- * @param convertToRightHandedSystem converts the values to right-handed
2205
2173
  * @param useQuaternion specifies if quaternions should be used
2206
2174
  */
2207
- _GLTFAnimation._CreateBakedAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, convertToRightHandedSystem, useQuaternion) {
2175
+ _GLTFAnimation._CreateBakedAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, useQuaternion) {
2208
2176
  var value;
2209
2177
  var quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity();
2210
2178
  var previousTime = null;
@@ -2258,7 +2226,7 @@ var _GLTFAnimation = /** @class */ (function () {
2258
2226
  loopMode: animation.loopMode,
2259
2227
  };
2260
2228
  value = animation._interpolate(f, state);
2261
- _GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion);
2229
+ _GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion);
2262
2230
  }
2263
2231
  }
2264
2232
  }
@@ -2266,23 +2234,17 @@ var _GLTFAnimation = /** @class */ (function () {
2266
2234
  minMaxFrames.max = maxUsedFrame;
2267
2235
  }
2268
2236
  };
2269
- _GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
2270
- var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2237
+ _GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion) {
2238
+ var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion);
2271
2239
  // handles single component x, y, z or w component animation by using a base property and animating over a component.
2272
2240
  var property = animation.targetProperty.split(".");
2273
- var componentName = property ? property[1] : ""; // x, y, or z component
2241
+ var componentName = property ? property[1] : ""; // x, y, z, or w component
2274
2242
  var value = useQuaternion ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
2275
2243
  switch (componentName) {
2276
- case "x": {
2277
- value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
2278
- break;
2279
- }
2280
- case "y": {
2281
- value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
2282
- break;
2283
- }
2244
+ case "x":
2245
+ case "y":
2284
2246
  case "z": {
2285
- value[componentName] = convertToRightHandedSystem && !useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
2247
+ value[componentName] = factor;
2286
2248
  break;
2287
2249
  }
2288
2250
  case "w": {
@@ -2295,7 +2257,7 @@ var _GLTFAnimation = /** @class */ (function () {
2295
2257
  }
2296
2258
  return value;
2297
2259
  };
2298
- _GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
2260
+ _GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion) {
2299
2261
  var cacheValue;
2300
2262
  inputs.push(time);
2301
2263
  if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
@@ -2303,7 +2265,7 @@ var _GLTFAnimation = /** @class */ (function () {
2303
2265
  return;
2304
2266
  }
2305
2267
  if (animation.dataType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
2306
- value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2268
+ value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
2307
2269
  }
2308
2270
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
2309
2271
  if (useQuaternion) {
@@ -2313,24 +2275,11 @@ var _GLTFAnimation = /** @class */ (function () {
2313
2275
  cacheValue = value;
2314
2276
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
2315
2277
  }
2316
- if (convertToRightHandedSystem) {
2317
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
2318
- if (!babylonTransformNode.parent) {
2319
- quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
2320
- }
2321
- }
2322
2278
  outputs.push(quaternionCache.asArray());
2323
2279
  }
2324
2280
  else {
2325
2281
  // scaling and position animation
2326
2282
  cacheValue = value;
2327
- if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */) {
2328
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
2329
- if (!babylonTransformNode.parent) {
2330
- cacheValue.x *= -1;
2331
- cacheValue.z *= -1;
2332
- }
2333
- }
2334
2283
  outputs.push(cacheValue.asArray());
2335
2284
  }
2336
2285
  };
@@ -2339,17 +2288,15 @@ var _GLTFAnimation = /** @class */ (function () {
2339
2288
  * @param babylonTransformNode BabylonJS mesh
2340
2289
  * @param animation BabylonJS animation
2341
2290
  * @param animationChannelTargetPath The target animation channel
2342
- * @param frameDelta The difference between the last and first frame of the animation
2343
2291
  * @param inputs Array to store the key frame times
2344
2292
  * @param outputs Array to store the key frame data
2345
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
2346
2293
  * @param useQuaternion Specifies if quaternions are used in the animation
2347
2294
  */
2348
- _GLTFAnimation._CreateLinearOrStepAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
2295
+ _GLTFAnimation._CreateLinearOrStepAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
2349
2296
  for (var _i = 0, _a = animation.getKeys(); _i < _a.length; _i++) {
2350
2297
  var keyFrame = _a[_i];
2351
2298
  inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
2352
- _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);
2299
+ _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
2353
2300
  }
2354
2301
  };
2355
2302
  /**
@@ -2360,42 +2307,31 @@ var _GLTFAnimation = /** @class */ (function () {
2360
2307
  * @param frameDelta The difference between the last and first frame of the animation
2361
2308
  * @param inputs Array to store the key frame times
2362
2309
  * @param outputs Array to store the key frame data
2363
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
2364
2310
  * @param useQuaternion Specifies if quaternions are used in the animation
2365
2311
  */
2366
- _GLTFAnimation._CreateCubicSplineAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, frameDelta, inputs, outputs, convertToRightHandedSystem, useQuaternion) {
2312
+ _GLTFAnimation._CreateCubicSplineAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
2367
2313
  animation.getKeys().forEach(function (keyFrame) {
2368
2314
  inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
2369
- _GLTFAnimation._AddSplineTangent(babylonTransformNode, _TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem);
2370
- _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion);
2371
- _GLTFAnimation._AddSplineTangent(babylonTransformNode, _TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem);
2315
+ _GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
2316
+ _GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
2317
+ _GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
2372
2318
  });
2373
2319
  };
2374
- _GLTFAnimation._GetBasePositionRotationOrScale = function (babylonTransformNode, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion) {
2320
+ _GLTFAnimation._GetBasePositionRotationOrScale = function (babylonTransformNode, animationChannelTargetPath, useQuaternion) {
2375
2321
  var basePositionRotationOrScale;
2376
2322
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
2377
2323
  if (useQuaternion) {
2378
2324
  var q = babylonTransformNode.rotationQuaternion;
2379
2325
  basePositionRotationOrScale = (q !== null && q !== void 0 ? q : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity()).asArray();
2380
- if (convertToRightHandedSystem) {
2381
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(basePositionRotationOrScale);
2382
- if (!babylonTransformNode.parent) {
2383
- basePositionRotationOrScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale)).asArray();
2384
- }
2385
- }
2386
2326
  }
2387
2327
  else {
2388
2328
  var r = babylonTransformNode.rotation;
2389
2329
  basePositionRotationOrScale = (r !== null && r !== void 0 ? r : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
2390
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalArray3FromRef(basePositionRotationOrScale);
2391
2330
  }
2392
2331
  }
2393
2332
  else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
2394
2333
  var p = babylonTransformNode.position;
2395
2334
  basePositionRotationOrScale = (p !== null && p !== void 0 ? p : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
2396
- if (convertToRightHandedSystem) {
2397
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionArray3FromRef(basePositionRotationOrScale);
2398
- }
2399
2335
  }
2400
2336
  else {
2401
2337
  // scale
@@ -2411,35 +2347,18 @@ var _GLTFAnimation = /** @class */ (function () {
2411
2347
  * @param outputs
2412
2348
  * @param animationChannelTargetPath
2413
2349
  * @param babylonTransformNode
2414
- * @param convertToRightHandedSystem
2415
2350
  * @param useQuaternion
2416
2351
  */
2417
- _GLTFAnimation._AddKeyframeValue = function (keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, convertToRightHandedSystem, useQuaternion) {
2418
- var value;
2352
+ _GLTFAnimation._AddKeyframeValue = function (keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion) {
2419
2353
  var newPositionRotationOrScale;
2420
2354
  var animationType = animation.dataType;
2421
2355
  if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_VECTOR3) {
2422
- value = keyFrame.value.asArray();
2356
+ var value = keyFrame.value.asArray();
2423
2357
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
2424
2358
  var array = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(value);
2425
2359
  var rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);
2426
- if (convertToRightHandedSystem) {
2427
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
2428
- if (!babylonTransformNode.parent) {
2429
- rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(rotationQuaternion);
2430
- }
2431
- }
2432
2360
  value = rotationQuaternion.asArray();
2433
2361
  }
2434
- else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
2435
- if (convertToRightHandedSystem) {
2436
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalArray3FromRef(value);
2437
- if (!babylonTransformNode.parent) {
2438
- value[0] *= -1;
2439
- value[2] *= -1;
2440
- }
2441
- }
2442
- }
2443
2362
  outputs.push(value); // scale vector.
2444
2363
  }
2445
2364
  else if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
@@ -2448,42 +2367,20 @@ var _GLTFAnimation = /** @class */ (function () {
2448
2367
  }
2449
2368
  else {
2450
2369
  // handles single component x, y, z or w component animation by using a base property and animating over a component.
2451
- newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, convertToRightHandedSystem, useQuaternion);
2370
+ newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
2452
2371
  if (newPositionRotationOrScale) {
2453
2372
  if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
2454
2373
  var posRotScale = useQuaternion
2455
2374
  ? newPositionRotationOrScale
2456
2375
  : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();
2457
- if (convertToRightHandedSystem) {
2458
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(posRotScale);
2459
- if (!babylonTransformNode.parent) {
2460
- posRotScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(posRotScale);
2461
- }
2462
- }
2463
2376
  outputs.push(posRotScale.asArray());
2464
2377
  }
2465
- else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
2466
- if (convertToRightHandedSystem) {
2467
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalVector3FromRef(newPositionRotationOrScale);
2468
- if (!babylonTransformNode.parent) {
2469
- newPositionRotationOrScale.x *= -1;
2470
- newPositionRotationOrScale.z *= -1;
2471
- }
2472
- }
2473
- }
2474
2378
  outputs.push(newPositionRotationOrScale.asArray());
2475
2379
  }
2476
2380
  }
2477
2381
  }
2478
2382
  else if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_QUATERNION) {
2479
- value = keyFrame.value.normalize().asArray();
2480
- if (convertToRightHandedSystem) {
2481
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(value);
2482
- if (!babylonTransformNode.parent) {
2483
- value = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(value)).asArray();
2484
- }
2485
- }
2486
- outputs.push(value);
2383
+ outputs.push(keyFrame.value.normalize().asArray());
2487
2384
  }
2488
2385
  else {
2489
2386
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported key frame values for animation!");
@@ -2551,9 +2448,8 @@ var _GLTFAnimation = /** @class */ (function () {
2551
2448
  * @param keyFrame The key frame with the animation data
2552
2449
  * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
2553
2450
  * @param useQuaternion Specifies if quaternions are used
2554
- * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
2555
2451
  */
2556
- _GLTFAnimation._AddSplineTangent = function (babylonTransformNode, tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, frameDelta, useQuaternion, convertToRightHandedSystem) {
2452
+ _GLTFAnimation._AddSplineTangent = function (tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, useQuaternion) {
2557
2453
  var tangent;
2558
2454
  var tangentValue = tangentType === _TangentType.INTANGENT ? keyFrame.inTangent : keyFrame.outTangent;
2559
2455
  if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
@@ -2566,12 +2462,6 @@ var _GLTFAnimation = /** @class */ (function () {
2566
2462
  var array = tangentValue;
2567
2463
  tangent = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();
2568
2464
  }
2569
- if (convertToRightHandedSystem) {
2570
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(tangent);
2571
- if (!babylonTransformNode.parent) {
2572
- tangent = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(tangent)).asArray();
2573
- }
2574
- }
2575
2465
  }
2576
2466
  else {
2577
2467
  tangent = [0, 0, 0, 0];
@@ -2588,15 +2478,6 @@ var _GLTFAnimation = /** @class */ (function () {
2588
2478
  else {
2589
2479
  if (tangentValue) {
2590
2480
  tangent = tangentValue.asArray();
2591
- if (convertToRightHandedSystem) {
2592
- if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
2593
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionArray3FromRef(tangent);
2594
- if (!babylonTransformNode.parent) {
2595
- tangent[0] *= -1; // x
2596
- tangent[2] *= -1; // z
2597
- }
2598
- }
2599
- }
2600
2481
  }
2601
2482
  else {
2602
2483
  tangent = [0, 0, 0];
@@ -2704,7 +2585,7 @@ __webpack_require__.r(__webpack_exports__);
2704
2585
  /* harmony export */ "_Exporter": () => (/* binding */ _Exporter)
2705
2586
  /* harmony export */ });
2706
2587
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
2707
- /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/multiMaterial */ "core/Maths/math.vector");
2588
+ /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/multiMaterial */ "core/Meshes/mesh");
2708
2589
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
2709
2590
  /* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFMaterialExporter.js");
2710
2591
  /* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
@@ -2731,6 +2612,54 @@ __webpack_require__.r(__webpack_exports__);
2731
2612
 
2732
2613
  // Matrix that converts handedness on the X-axis.
2733
2614
  var convertHandednessMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Matrix.Compose(new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(-1, 1, 1), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.Identity(), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero());
2615
+ function isNoopNode(node, useRightHandedSystem) {
2616
+ if (!(node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode)) {
2617
+ return false;
2618
+ }
2619
+ // Transform
2620
+ if (useRightHandedSystem) {
2621
+ var matrix = node.getWorldMatrix();
2622
+ if (!matrix.isIdentity()) {
2623
+ return false;
2624
+ }
2625
+ }
2626
+ else {
2627
+ var matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
2628
+ if (!matrix.isIdentity()) {
2629
+ return false;
2630
+ }
2631
+ }
2632
+ // Geometry
2633
+ if ((node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh && node.geometry) || (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh && node.sourceMesh.geometry)) {
2634
+ return false;
2635
+ }
2636
+ return true;
2637
+ }
2638
+ function convertNodeHandedness(node) {
2639
+ var translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector3[0]);
2640
+ var rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Quaternion[0]);
2641
+ var scale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArrayToRef(node.scale || [1, 1, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector3[1]);
2642
+ var matrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Matrix.ComposeToRef(scale, rotation, translation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]).multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
2643
+ matrix.decompose(scale, rotation, translation);
2644
+ if (translation.equalsToFloats(0, 0, 0)) {
2645
+ delete node.translation;
2646
+ }
2647
+ else {
2648
+ node.translation = translation.asArray();
2649
+ }
2650
+ if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.IsIdentity(rotation)) {
2651
+ delete node.rotation;
2652
+ }
2653
+ else {
2654
+ node.rotation = rotation.asArray();
2655
+ }
2656
+ if (scale.equalsToFloats(1, 1, 1)) {
2657
+ delete node.scale;
2658
+ }
2659
+ else {
2660
+ node.scale = scale.asArray();
2661
+ }
2662
+ }
2734
2663
  /**
2735
2664
  * Converts Babylon Scene into glTF 2.0.
2736
2665
  * @internal
@@ -2742,10 +2671,6 @@ var _Exporter = /** @class */ (function () {
2742
2671
  * @param options Options to modify the behavior of the exporter
2743
2672
  */
2744
2673
  function _Exporter(babylonScene, options) {
2745
- /*
2746
- * Specifies if root Babylon empty nodes that act as a coordinate space transform should be included in export
2747
- */
2748
- this._includeCoordinateSystemConversionNodes = false;
2749
2674
  this._extensions = {};
2750
2675
  this._glTF = {
2751
2676
  asset: { generator: "Babylon.js v".concat(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Engine.Version), version: "2.0" },
@@ -2771,8 +2696,7 @@ var _Exporter = /** @class */ (function () {
2771
2696
  this._imageData = {};
2772
2697
  this._orderedImageData = [];
2773
2698
  this._options = options || {};
2774
- this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
2775
- this._includeCoordinateSystemConversionNodes = options && options.includeCoordinateSystemConversionNodes ? true : false;
2699
+ this._animationSampleRate = this._options.animationSampleRate || 1 / 60;
2776
2700
  this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__._GLTFMaterialExporter(this);
2777
2701
  this._loadExtensions();
2778
2702
  }
@@ -2951,28 +2875,24 @@ var _Exporter = /** @class */ (function () {
2951
2875
  * clock-wise during export to glTF
2952
2876
  * @param submesh BabylonJS submesh
2953
2877
  * @param primitiveMode Primitive mode of the mesh
2954
- * @param sideOrientation the winding order of the submesh
2955
2878
  * @param vertexBufferKind The type of vertex attribute
2956
2879
  * @param meshAttributeArray The vertex attribute data
2957
2880
  * @param byteOffset The offset to the binary data
2958
2881
  * @param binaryWriter The binary data for the glTF file
2959
- * @param convertToRightHandedSystem Converts the values to right-handed
2960
2882
  */
2961
- _Exporter.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
2962
- if (convertToRightHandedSystem && sideOrientation === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation) {
2963
- switch (primitiveMode) {
2964
- case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleFillMode: {
2965
- this._reorderTriangleFillMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem);
2966
- break;
2967
- }
2968
- case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleStripDrawMode: {
2969
- this._reorderTriangleStripDrawMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem);
2970
- break;
2971
- }
2972
- case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleFanDrawMode: {
2973
- this._reorderTriangleFanMode(submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem);
2974
- break;
2975
- }
2883
+ _Exporter.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
2884
+ switch (primitiveMode) {
2885
+ case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleFillMode: {
2886
+ this._reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
2887
+ break;
2888
+ }
2889
+ case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleStripDrawMode: {
2890
+ this._reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
2891
+ break;
2892
+ }
2893
+ case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleFanDrawMode: {
2894
+ this._reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
2895
+ break;
2976
2896
  }
2977
2897
  }
2978
2898
  };
@@ -2980,15 +2900,12 @@ var _Exporter = /** @class */ (function () {
2980
2900
  * Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
2981
2901
  * clock-wise during export to glTF
2982
2902
  * @param submesh BabylonJS submesh
2983
- * @param primitiveMode Primitive mode of the mesh
2984
- * @param sideOrientation the winding order of the submesh
2985
2903
  * @param vertexBufferKind The type of vertex attribute
2986
2904
  * @param meshAttributeArray The vertex attribute data
2987
2905
  * @param byteOffset The offset to the binary data
2988
2906
  * @param binaryWriter The binary data for the glTF file
2989
- * @param convertToRightHandedSystem Converts the values to right-handed
2990
2907
  */
2991
- _Exporter.prototype._reorderTriangleFillMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
2908
+ _Exporter.prototype._reorderTriangleFillMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
2992
2909
  var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
2993
2910
  if (vertexBuffer) {
2994
2911
  var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
@@ -3049,7 +2966,7 @@ var _Exporter = /** @class */ (function () {
3049
2966
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
3050
2967
  }
3051
2968
  }
3052
- this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
2969
+ this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
3053
2970
  }
3054
2971
  }
3055
2972
  else {
@@ -3060,15 +2977,12 @@ var _Exporter = /** @class */ (function () {
3060
2977
  * Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
3061
2978
  * clock-wise during export to glTF
3062
2979
  * @param submesh BabylonJS submesh
3063
- * @param primitiveMode Primitive mode of the mesh
3064
- * @param sideOrientation the winding order of the submesh
3065
2980
  * @param vertexBufferKind The type of vertex attribute
3066
2981
  * @param meshAttributeArray The vertex attribute data
3067
2982
  * @param byteOffset The offset to the binary data
3068
2983
  * @param binaryWriter The binary data for the glTF file
3069
- * @param convertToRightHandedSystem Converts the values to right-handed
3070
2984
  */
3071
- _Exporter.prototype._reorderTriangleStripDrawMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
2985
+ _Exporter.prototype._reorderTriangleStripDrawMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
3072
2986
  var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
3073
2987
  if (vertexBuffer) {
3074
2988
  var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
@@ -3110,7 +3024,7 @@ var _Exporter = /** @class */ (function () {
3110
3024
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
3111
3025
  }
3112
3026
  }
3113
- this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
3027
+ this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, binaryWriter);
3114
3028
  }
3115
3029
  else {
3116
3030
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
@@ -3120,15 +3034,12 @@ var _Exporter = /** @class */ (function () {
3120
3034
  * Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
3121
3035
  * clock-wise during export to glTF
3122
3036
  * @param submesh BabylonJS submesh
3123
- * @param primitiveMode Primitive mode of the mesh
3124
- * @param sideOrientation the winding order of the submesh
3125
3037
  * @param vertexBufferKind The type of vertex attribute
3126
3038
  * @param meshAttributeArray The vertex attribute data
3127
3039
  * @param byteOffset The offset to the binary data
3128
3040
  * @param binaryWriter The binary data for the glTF file
3129
- * @param convertToRightHandedSystem Converts the values to right-handed
3130
3041
  */
3131
- _Exporter.prototype._reorderTriangleFanMode = function (submesh, primitiveMode, sideOrientation, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter, convertToRightHandedSystem) {
3042
+ _Exporter.prototype._reorderTriangleFanMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
3132
3043
  var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
3133
3044
  if (vertexBuffer) {
3134
3045
  var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
@@ -3172,7 +3083,7 @@ var _Exporter = /** @class */ (function () {
3172
3083
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
3173
3084
  }
3174
3085
  }
3175
- this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
3086
+ this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
3176
3087
  }
3177
3088
  else {
3178
3089
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
@@ -3183,29 +3094,11 @@ var _Exporter = /** @class */ (function () {
3183
3094
  * @param vertices The vertices to write to the binary writer
3184
3095
  * @param byteOffset The offset into the binary writer to overwrite binary data
3185
3096
  * @param vertexAttributeKind The vertex attribute type
3186
- * @param meshAttributeArray The vertex attribute data
3187
3097
  * @param binaryWriter The writer containing the binary data
3188
- * @param convertToRightHandedSystem Converts the values to right-handed
3189
3098
  */
3190
- _Exporter.prototype._writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem) {
3099
+ _Exporter.prototype._writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind, binaryWriter) {
3191
3100
  for (var _i = 0, vertices_1 = vertices; _i < vertices_1.length; _i++) {
3192
3101
  var vertex = vertices_1[_i];
3193
- if (convertToRightHandedSystem && !(vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.ColorKind) && !(vertex instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector2)) {
3194
- if (vertex instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3) {
3195
- if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind) {
3196
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(vertex);
3197
- }
3198
- else if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind) {
3199
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(vertex);
3200
- }
3201
- else {
3202
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported vertex attribute kind!");
3203
- }
3204
- }
3205
- else {
3206
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(vertex);
3207
- }
3208
- }
3209
3102
  if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind) {
3210
3103
  vertex.normalize();
3211
3104
  }
@@ -3227,10 +3120,9 @@ var _Exporter = /** @class */ (function () {
3227
3120
  * @param meshAttributeArray Array containing the attribute data
3228
3121
  * @param stride Specifies the space between data
3229
3122
  * @param binaryWriter The buffer to write the binary data to
3230
- * @param convertToRightHandedSystem Converts the values to right-handed
3231
3123
  * @param babylonTransformNode
3232
3124
  */
3233
- _Exporter.prototype._writeAttributeData = function (vertexBufferKind, attributeComponentKind, meshAttributeArray, stride, binaryWriter, convertToRightHandedSystem, babylonTransformNode) {
3125
+ _Exporter.prototype._writeAttributeData = function (vertexBufferKind, attributeComponentKind, meshAttributeArray, stride, binaryWriter, babylonTransformNode) {
3234
3126
  var vertexAttributes = [];
3235
3127
  var index;
3236
3128
  switch (vertexBufferKind) {
@@ -3238,9 +3130,6 @@ var _Exporter = /** @class */ (function () {
3238
3130
  for (var k = 0, length_2 = meshAttributeArray.length / stride; k < length_2; ++k) {
3239
3131
  index = k * stride;
3240
3132
  var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
3241
- if (convertToRightHandedSystem) {
3242
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(vertexData);
3243
- }
3244
3133
  vertexAttributes.push(vertexData.asArray());
3245
3134
  }
3246
3135
  break;
@@ -3249,11 +3138,7 @@ var _Exporter = /** @class */ (function () {
3249
3138
  for (var k = 0, length_3 = meshAttributeArray.length / stride; k < length_3; ++k) {
3250
3139
  index = k * stride;
3251
3140
  var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
3252
- if (convertToRightHandedSystem) {
3253
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(vertexData);
3254
- }
3255
- vertexData.normalize();
3256
- vertexAttributes.push(vertexData.asArray());
3141
+ vertexAttributes.push(vertexData.normalize().asArray());
3257
3142
  }
3258
3143
  break;
3259
3144
  }
@@ -3261,9 +3146,6 @@ var _Exporter = /** @class */ (function () {
3261
3146
  for (var k = 0, length_4 = meshAttributeArray.length / stride; k < length_4; ++k) {
3262
3147
  index = k * stride;
3263
3148
  var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector4.FromArray(meshAttributeArray, index);
3264
- if (convertToRightHandedSystem) {
3265
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(vertexData);
3266
- }
3267
3149
  _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
3268
3150
  vertexAttributes.push(vertexData.asArray());
3269
3151
  }
@@ -3296,7 +3178,8 @@ var _Exporter = /** @class */ (function () {
3296
3178
  case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UV2Kind: {
3297
3179
  for (var k = 0, length_6 = meshAttributeArray.length / stride; k < length_6; ++k) {
3298
3180
  index = k * stride;
3299
- vertexAttributes.push(convertToRightHandedSystem ? [meshAttributeArray[index], meshAttributeArray[index + 1]] : [meshAttributeArray[index], meshAttributeArray[index + 1]]);
3181
+ var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector2.FromArray(meshAttributeArray, index);
3182
+ vertexAttributes.push(vertexData.asArray());
3300
3183
  }
3301
3184
  break;
3302
3185
  }
@@ -3365,10 +3248,9 @@ var _Exporter = /** @class */ (function () {
3365
3248
  * @param morphTargetAttributeArray
3366
3249
  * @param stride Specifies the space between data
3367
3250
  * @param binaryWriter The buffer to write the binary data to
3368
- * @param convertToRightHandedSystem Converts the values to right-handed
3369
3251
  * @param minMax
3370
3252
  */
3371
- _Exporter.prototype.writeMorphTargetAttributeData = function (vertexBufferKind, attributeComponentKind, meshPrimitive, morphTarget, meshAttributeArray, morphTargetAttributeArray, stride, binaryWriter, convertToRightHandedSystem, minMax) {
3253
+ _Exporter.prototype.writeMorphTargetAttributeData = function (vertexBufferKind, attributeComponentKind, meshPrimitive, meshAttributeArray, morphTargetAttributeArray, stride, binaryWriter, minMax) {
3372
3254
  var vertexAttributes = [];
3373
3255
  var index;
3374
3256
  var difference = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3();
@@ -3380,9 +3262,6 @@ var _Exporter = /** @class */ (function () {
3380
3262
  var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
3381
3263
  var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index);
3382
3264
  difference = morphData.subtractToRef(vertexData, difference);
3383
- if (convertToRightHandedSystem) {
3384
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(difference);
3385
- }
3386
3265
  if (minMax) {
3387
3266
  minMax.min.copyFromFloats(Math.min(difference.x, minMax.min.x), Math.min(difference.y, minMax.min.y), Math.min(difference.z, minMax.min.z));
3388
3267
  minMax.max.copyFromFloats(Math.max(difference.x, minMax.max.x), Math.max(difference.y, minMax.max.y), Math.max(difference.z, minMax.max.z));
@@ -3394,14 +3273,9 @@ var _Exporter = /** @class */ (function () {
3394
3273
  case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind: {
3395
3274
  for (var k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
3396
3275
  index = meshPrimitive.indexStart + k * stride;
3397
- var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
3398
- vertexData.normalize();
3399
- var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index);
3400
- morphData.normalize();
3276
+ var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index).normalize();
3277
+ var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index).normalize();
3401
3278
  difference = morphData.subtractToRef(vertexData, difference);
3402
- if (convertToRightHandedSystem) {
3403
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(difference);
3404
- }
3405
3279
  vertexAttributes.push(difference.asArray());
3406
3280
  }
3407
3281
  break;
@@ -3414,9 +3288,6 @@ var _Exporter = /** @class */ (function () {
3414
3288
  var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector4.FromArray(morphTargetAttributeArray, index);
3415
3289
  _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._NormalizeTangentFromRef(morphData);
3416
3290
  difference4 = morphData.subtractToRef(vertexData, difference4);
3417
- if (convertToRightHandedSystem) {
3418
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(difference4);
3419
- }
3420
3291
  vertexAttributes.push([difference4.x, difference4.y, difference4.z]);
3421
3292
  }
3422
3293
  break;
@@ -3578,7 +3449,7 @@ var _Exporter = /** @class */ (function () {
3578
3449
  _Exporter.prototype._generateBinaryAsync = function () {
3579
3450
  var _this = this;
3580
3451
  var binaryWriter = new _BinaryWriter(4);
3581
- return this._createSceneAsync(this._babylonScene, binaryWriter).then(function () {
3452
+ return this._createSceneAsync(binaryWriter).then(function () {
3582
3453
  if (_this._localEngine) {
3583
3454
  _this._localEngine.dispose();
3584
3455
  }
@@ -3697,16 +3568,13 @@ var _Exporter = /** @class */ (function () {
3697
3568
  * Sets the TRS for each node
3698
3569
  * @param node glTF Node for storing the transformation data
3699
3570
  * @param babylonTransformNode Babylon mesh used as the source for the transformation data
3700
- * @param convertToRightHandedSystem Converts the values to right-handed
3701
3571
  */
3702
- _Exporter.prototype._setNodeTransformation = function (node, babylonTransformNode, convertToRightHandedSystem) {
3572
+ _Exporter.prototype._setNodeTransformation = function (node, babylonTransformNode) {
3703
3573
  if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {
3704
3574
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Pivot points are not supported in the glTF serializer");
3705
3575
  }
3706
3576
  if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {
3707
- node.translation = convertToRightHandedSystem
3708
- ? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3(babylonTransformNode.position).asArray()
3709
- : babylonTransformNode.position.asArray();
3577
+ node.translation = babylonTransformNode.position.asArray();
3710
3578
  }
3711
3579
  if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {
3712
3580
  node.scale = babylonTransformNode.scaling.asArray();
@@ -3716,21 +3584,15 @@ var _Exporter = /** @class */ (function () {
3716
3584
  rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
3717
3585
  }
3718
3586
  if (!core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.IsIdentity(rotationQuaternion)) {
3719
- if (convertToRightHandedSystem) {
3720
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
3721
- }
3722
3587
  node.rotation = rotationQuaternion.normalize().asArray();
3723
3588
  }
3724
3589
  };
3725
- _Exporter.prototype._setCameraTransformation = function (node, babylonCamera, convertToRightHandedSystem) {
3590
+ _Exporter.prototype._setCameraTransformation = function (node, babylonCamera) {
3726
3591
  if (!babylonCamera.position.equalsToFloats(0, 0, 0)) {
3727
- node.translation = convertToRightHandedSystem ? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3(babylonCamera.position).asArray() : babylonCamera.position.asArray();
3592
+ node.translation = babylonCamera.position.asArray();
3728
3593
  }
3729
3594
  var rotationQuaternion = babylonCamera.rotationQuaternion; // we target the local transformation if one.
3730
3595
  if (rotationQuaternion && !core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.IsIdentity(rotationQuaternion)) {
3731
- if (convertToRightHandedSystem) {
3732
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
3733
- }
3734
3596
  node.rotation = rotationQuaternion.normalize().asArray();
3735
3597
  }
3736
3598
  };
@@ -3750,9 +3612,8 @@ var _Exporter = /** @class */ (function () {
3750
3612
  * @param babylonTransformNode The Babylon mesh to get the vertices data from
3751
3613
  * @param binaryWriter The buffer to write the bufferview data to
3752
3614
  * @param byteStride
3753
- * @param convertToRightHandedSystem Converts the values to right-handed
3754
3615
  */
3755
- _Exporter.prototype._createBufferViewKind = function (kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride, convertToRightHandedSystem) {
3616
+ _Exporter.prototype._createBufferViewKind = function (kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride) {
3756
3617
  var bufferMesh = babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh
3757
3618
  ? babylonTransformNode
3758
3619
  : babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh
@@ -3766,7 +3627,7 @@ var _Exporter = /** @class */ (function () {
3766
3627
  var byteLength = vertexData.length * typeByteLength;
3767
3628
  var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + " - " + bufferMesh.name);
3768
3629
  this._bufferViews.push(bufferView);
3769
- this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter, convertToRightHandedSystem, babylonTransformNode);
3630
+ this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter, babylonTransformNode);
3770
3631
  }
3771
3632
  }
3772
3633
  };
@@ -3776,9 +3637,8 @@ var _Exporter = /** @class */ (function () {
3776
3637
  * @param meshPrimitive
3777
3638
  * @param babylonMorphTarget the morph target to be exported
3778
3639
  * @param binaryWriter The buffer to write the bufferview data to
3779
- * @param convertToRightHandedSystem Converts the values to right-handed
3780
3640
  */
3781
- _Exporter.prototype._setMorphTargetAttributes = function (babylonSubMesh, meshPrimitive, babylonMorphTarget, binaryWriter, convertToRightHandedSystem) {
3641
+ _Exporter.prototype._setMorphTargetAttributes = function (babylonSubMesh, meshPrimitive, babylonMorphTarget, binaryWriter) {
3782
3642
  if (babylonMorphTarget) {
3783
3643
  if (!meshPrimitive.targets) {
3784
3644
  meshPrimitive.targets = [];
@@ -3797,7 +3657,7 @@ var _Exporter = /** @class */ (function () {
3797
3657
  var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "NORMAL", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
3798
3658
  this._accessors.push(accessor);
3799
3659
  target.NORMAL = this._accessors.length - 1;
3800
- this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, babylonMorphTarget, vertexNormals, morphNormals, byteStride / 4, binaryWriter, convertToRightHandedSystem);
3660
+ this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexNormals, morphNormals, byteStride / 4, binaryWriter);
3801
3661
  }
3802
3662
  if (babylonMorphTarget.hasPositions) {
3803
3663
  var vertexPositions = mesh.getVerticesData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind, undefined, undefined, true);
@@ -3812,7 +3672,7 @@ var _Exporter = /** @class */ (function () {
3812
3672
  var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "POSITION", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
3813
3673
  this._accessors.push(accessor);
3814
3674
  target.POSITION = this._accessors.length - 1;
3815
- this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, babylonMorphTarget, vertexPositions, morphPositions, byteStride / 4, binaryWriter, convertToRightHandedSystem, minMax);
3675
+ this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexPositions, morphPositions, byteStride / 4, binaryWriter, minMax);
3816
3676
  accessor.min = minMax.min.asArray();
3817
3677
  accessor.max = minMax.max.asArray();
3818
3678
  }
@@ -3828,7 +3688,7 @@ var _Exporter = /** @class */ (function () {
3828
3688
  var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "TANGENT", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
3829
3689
  this._accessors.push(accessor);
3830
3690
  target.TANGENT = this._accessors.length - 1;
3831
- this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, babylonMorphTarget, vertexTangents, morphTangents, byteStride / 4, binaryWriter, convertToRightHandedSystem);
3691
+ this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexTangents, morphTangents, byteStride / 4, binaryWriter);
3832
3692
  }
3833
3693
  meshPrimitive.targets.push(target);
3834
3694
  }
@@ -3948,10 +3808,8 @@ var _Exporter = /** @class */ (function () {
3948
3808
  * @param mesh glTF Mesh object to store the primitive attribute information
3949
3809
  * @param babylonTransformNode Babylon mesh to get the primitive attribute data from
3950
3810
  * @param binaryWriter Buffer to write the attribute data to
3951
- * @param convertToRightHandedSystem Converts the values to right-handed
3952
3811
  */
3953
- _Exporter.prototype._setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter, convertToRightHandedSystem) {
3954
- var _a;
3812
+ _Exporter.prototype._setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter) {
3955
3813
  var promises = [];
3956
3814
  var bufferMesh = null;
3957
3815
  var bufferView;
@@ -3992,7 +3850,7 @@ var _Exporter = /** @class */ (function () {
3992
3850
  if (attribute.byteStride === 12) {
3993
3851
  attribute.accessorType = "VEC3" /* AccessorType.VEC3 */;
3994
3852
  }
3995
- this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride, convertToRightHandedSystem);
3853
+ this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride);
3996
3854
  attribute.bufferViewIndex = this._bufferViews.length - 1;
3997
3855
  vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;
3998
3856
  }
@@ -4011,8 +3869,8 @@ var _Exporter = /** @class */ (function () {
4011
3869
  }
4012
3870
  if (bufferMesh.subMeshes) {
4013
3871
  // go through all mesh primitives (submeshes)
4014
- for (var _b = 0, _c = bufferMesh.subMeshes; _b < _c.length; _b++) {
4015
- var submesh = _c[_b];
3872
+ for (var _a = 0, _b = bufferMesh.subMeshes; _a < _b.length; _a++) {
3873
+ var submesh = _b[_a];
4016
3874
  var babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;
4017
3875
  var materialIndex = null;
4018
3876
  if (babylonMaterial) {
@@ -4043,8 +3901,8 @@ var _Exporter = /** @class */ (function () {
4043
3901
  var glTFMaterial = materialIndex != null ? this._materials[materialIndex] : null;
4044
3902
  var meshPrimitive = { attributes: {} };
4045
3903
  this._setPrimitiveMode(meshPrimitive, primitiveMode);
4046
- for (var _d = 0, attributeData_2 = attributeData; _d < attributeData_2.length; _d++) {
4047
- var attribute = attributeData_2[_d];
3904
+ for (var _c = 0, attributeData_2 = attributeData; _c < attributeData_2.length; _c++) {
3905
+ var attribute = attributeData_2[_c];
4048
3906
  var attributeKind = attribute.kind;
4049
3907
  if ((attributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UVKind || attributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UV2Kind) && !this._options.exportUnusedUVs) {
4050
3908
  if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {
@@ -4061,7 +3919,7 @@ var _Exporter = /** @class */ (function () {
4061
3919
  // check to see if bufferviewindex has a numeric value assigned.
4062
3920
  minMax = { min: null, max: null };
4063
3921
  if (attributeKind == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind) {
4064
- minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride, convertToRightHandedSystem);
3922
+ minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride);
4065
3923
  }
4066
3924
  var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, attribute.accessorComponentType, vertexData.length / stride, 0, minMax.min, minMax.max);
4067
3925
  this._accessors.push(accessor);
@@ -4078,10 +3936,7 @@ var _Exporter = /** @class */ (function () {
4078
3936
  }
4079
3937
  if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
4080
3938
  var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
4081
- if ((sideOrientation == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation && this._babylonScene.useRightHandedSystem) ||
4082
- (sideOrientation == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation &&
4083
- convertToRightHandedSystem &&
4084
- bufferMesh.overrideMaterialSideOrientation !== ((_a = bufferMesh.material) === null || _a === void 0 ? void 0 : _a.sideOrientation))) {
3939
+ if (sideOrientation === (this._babylonScene.useRightHandedSystem ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.CounterClockWiseSideOrientation)) {
4085
3940
  var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
4086
3941
  if (byteOffset == null) {
4087
3942
  byteOffset = 0;
@@ -4094,15 +3949,12 @@ var _Exporter = /** @class */ (function () {
4094
3949
  this._reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter);
4095
3950
  }
4096
3951
  else {
4097
- for (var _e = 0, attributeData_3 = attributeData; _e < attributeData_3.length; _e++) {
4098
- var attribute = attributeData_3[_e];
3952
+ for (var _d = 0, attributeData_3 = attributeData; _d < attributeData_3.length; _d++) {
3953
+ var attribute = attributeData_3[_d];
4099
3954
  var vertexData = bufferMesh.getVerticesData(attribute.kind, undefined, undefined, true);
4100
3955
  if (vertexData) {
4101
- var byteOffset_1 = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset;
4102
- if (!byteOffset_1) {
4103
- byteOffset_1 = 0;
4104
- }
4105
- this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, sideOrientation, attribute.kind, vertexData, byteOffset_1, binaryWriter, convertToRightHandedSystem);
3956
+ var byteOffset_1 = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset || 0;
3957
+ this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, attribute.kind, vertexData, byteOffset_1, binaryWriter);
4106
3958
  }
4107
3959
  }
4108
3960
  }
@@ -4113,7 +3965,7 @@ var _Exporter = /** @class */ (function () {
4113
3965
  var target = void 0;
4114
3966
  for (var i = 0; i < morphTargetManager.numTargets; ++i) {
4115
3967
  target = morphTargetManager.getTarget(i);
4116
- this._setMorphTargetAttributes(submesh, meshPrimitive, target, binaryWriter, convertToRightHandedSystem);
3968
+ this._setMorphTargetAttributes(submesh, meshPrimitive, target, binaryWriter);
4117
3969
  }
4118
3970
  }
4119
3971
  mesh.primitives.push(meshPrimitive);
@@ -4126,80 +3978,44 @@ var _Exporter = /** @class */ (function () {
4126
3978
  /* do nothing */
4127
3979
  });
4128
3980
  };
4129
- /**
4130
- * Check if the node is used to convert its descendants from a right handed coordinate system to the Babylon scene's coordinate system.
4131
- * @param node The node to check
4132
- * @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
4133
- */
4134
- _Exporter.prototype._isBabylonCoordinateSystemConvertingNode = function (node) {
4135
- if (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode) {
4136
- // Transform
4137
- var matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
4138
- if (!matrix.isIdentity()) {
4139
- return false;
4140
- }
4141
- // Geometry
4142
- if ((node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh && node.geometry !== null) || (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh && node.sourceMesh.geometry !== null)) {
4143
- return false;
4144
- }
4145
- return true;
4146
- }
4147
- return false;
4148
- };
4149
3981
  /**
4150
3982
  * Creates a glTF scene based on the array of meshes
4151
3983
  * Returns the the total byte offset
4152
3984
  * @param babylonScene Babylon scene to get the mesh data from
4153
3985
  * @param binaryWriter Buffer to write binary data to
4154
3986
  */
4155
- _Exporter.prototype._createSceneAsync = function (babylonScene, binaryWriter) {
3987
+ _Exporter.prototype._createSceneAsync = function (binaryWriter) {
4156
3988
  var _this = this;
3989
+ var _a;
4157
3990
  var scene = { nodes: [] };
4158
3991
  var glTFNodeIndex;
4159
3992
  var glTFNode;
4160
3993
  var directDescendents;
4161
- var nodes = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)([], babylonScene.transformNodes, true), babylonScene.meshes, true), babylonScene.lights, true), babylonScene.cameras, true);
4162
- var rootNodesToLeftHanded = [];
4163
- this._convertToRightHandedSystem = !babylonScene.useRightHandedSystem;
4164
- this._convertToRightHandedSystemMap = {};
3994
+ var nodes = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)([], this._babylonScene.transformNodes, true), this._babylonScene.meshes, true), this._babylonScene.lights, true), this._babylonScene.cameras, true);
3995
+ var removedRootNodes = new Set();
4165
3996
  // Scene metadata
4166
- if (babylonScene.metadata) {
3997
+ if (this._babylonScene.metadata) {
4167
3998
  if (this._options.metadataSelector) {
4168
- scene.extras = this._options.metadataSelector(babylonScene.metadata);
3999
+ scene.extras = this._options.metadataSelector(this._babylonScene.metadata);
4169
4000
  }
4170
- else if (babylonScene.metadata.gltf) {
4171
- scene.extras = babylonScene.metadata.gltf.extras;
4001
+ else if (this._babylonScene.metadata.gltf) {
4002
+ scene.extras = this._babylonScene.metadata.gltf.extras;
4172
4003
  }
4173
4004
  }
4174
- // Set default values for all nodes
4175
- babylonScene.rootNodes.forEach(function (rootNode) {
4176
- _this._convertToRightHandedSystemMap[rootNode.uniqueId] = _this._convertToRightHandedSystem;
4177
- rootNode.getDescendants(false).forEach(function (descendant) {
4178
- _this._convertToRightHandedSystemMap[descendant.uniqueId] = _this._convertToRightHandedSystem;
4179
- });
4180
- });
4181
- // Check if root nodes converting to left-handed are present
4182
- babylonScene.rootNodes.forEach(function (rootNode) {
4183
- if (_this._includeCoordinateSystemConversionNodes) {
4184
- return;
4185
- }
4186
- if (_this._isBabylonCoordinateSystemConvertingNode(rootNode)) {
4187
- rootNodesToLeftHanded.push(rootNode);
4188
- // Exclude the node from list of nodes to export
4189
- var indexRootNode = nodes.indexOf(rootNode);
4190
- if (indexRootNode !== -1) {
4191
- // should always be true
4192
- nodes.splice(indexRootNode, 1);
4005
+ // Remove no-op root nodes
4006
+ if (((_a = this._options.removeNoopRootNodes) !== null && _a !== void 0 ? _a : true) && !this._options.includeCoordinateSystemConversionNodes) {
4007
+ for (var _i = 0, _b = this._babylonScene.rootNodes; _i < _b.length; _i++) {
4008
+ var rootNode = _b[_i];
4009
+ if (isNoopNode(rootNode, this._babylonScene.useRightHandedSystem)) {
4010
+ removedRootNodes.add(rootNode);
4011
+ // Exclude the node from list of nodes to export
4012
+ nodes.splice(nodes.indexOf(rootNode), 1);
4193
4013
  }
4194
- // Cancel conversion to right handed system
4195
- rootNode.getDescendants(false).forEach(function (descendant) {
4196
- _this._convertToRightHandedSystemMap[descendant.uniqueId] = false;
4197
- });
4198
4014
  }
4199
- });
4015
+ }
4200
4016
  // Export babylon cameras to glTFCamera
4201
4017
  var cameraMap = new Map();
4202
- babylonScene.cameras.forEach(function (camera) {
4018
+ this._babylonScene.cameras.forEach(function (camera) {
4203
4019
  if (!_this._options.shouldExportNode || _this._options.shouldExportNode(camera)) {
4204
4020
  var glTFCamera = {
4205
4021
  type: camera.mode === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera.PERSPECTIVE_CAMERA ? "perspective" /* CameraType.PERSPECTIVE */ : "orthographic" /* CameraType.ORTHOGRAPHIC */,
@@ -4229,10 +4045,10 @@ var _Exporter = /** @class */ (function () {
4229
4045
  _this._cameras.push(glTFCamera);
4230
4046
  }
4231
4047
  });
4232
- var _a = this._getExportNodes(nodes), exportNodes = _a[0], exportMaterials = _a[1];
4048
+ var _c = this._getExportNodes(nodes), exportNodes = _c[0], exportMaterials = _c[1];
4233
4049
  return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* ImageMimeType.PNG */, true).then(function () {
4234
- return _this._createNodeMapAndAnimationsAsync(babylonScene, exportNodes, binaryWriter).then(function (nodeMap) {
4235
- return _this._createSkinsAsync(babylonScene, nodeMap, binaryWriter).then(function (skinMap) {
4050
+ return _this._createNodeMapAndAnimationsAsync(exportNodes, binaryWriter).then(function (nodeMap) {
4051
+ return _this._createSkinsAsync(nodeMap, binaryWriter).then(function (skinMap) {
4236
4052
  _this._nodeMap = nodeMap;
4237
4053
  _this._totalByteLength = binaryWriter.getByteOffset();
4238
4054
  if (_this._totalByteLength == undefined) {
@@ -4255,28 +4071,20 @@ var _Exporter = /** @class */ (function () {
4255
4071
  if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera) {
4256
4072
  glTFNode.camera = cameraMap.get(babylonNode);
4257
4073
  }
4258
- if (!babylonNode.parent || rootNodesToLeftHanded.indexOf(babylonNode.parent) !== -1) {
4259
- if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
4260
- core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Log("Omitting " + babylonNode.name + " from scene.");
4074
+ if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
4075
+ core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Log("Omitting " + babylonNode.name + " from scene.");
4076
+ }
4077
+ else {
4078
+ if (!babylonNode.parent && !_this._babylonScene.useRightHandedSystem) {
4079
+ convertNodeHandedness(glTFNode);
4261
4080
  }
4262
- else {
4263
- var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
4264
- if (convertToRightHandedSystem) {
4265
- if (glTFNode.translation) {
4266
- glTFNode.translation[2] *= -1;
4267
- glTFNode.translation[0] *= -1;
4268
- }
4269
- glTFNode.rotation = glTFNode.rotation
4270
- ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray(glTFNode.rotation)).asArray()
4271
- : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([0, 1, 0, 0]).asArray();
4272
- }
4081
+ if (!babylonNode.parent || removedRootNodes.has(babylonNode.parent)) {
4273
4082
  scene.nodes.push(glTFNodeIndex);
4274
4083
  }
4275
4084
  }
4276
4085
  if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh) {
4277
- var babylonMesh = babylonNode;
4278
- if (babylonMesh.skeleton) {
4279
- glTFNode.skin = skinMap[babylonMesh.skeleton.uniqueId];
4086
+ if (babylonNode.skeleton) {
4087
+ glTFNode.skin = skinMap[babylonNode.skeleton.uniqueId];
4280
4088
  }
4281
4089
  }
4282
4090
  directDescendents = babylonNode.getDescendants(true);
@@ -4338,12 +4146,11 @@ var _Exporter = /** @class */ (function () {
4338
4146
  };
4339
4147
  /**
4340
4148
  * Creates a mapping of Node unique id to node index and handles animations
4341
- * @param babylonScene Babylon Scene
4342
4149
  * @param nodes Babylon transform nodes
4343
4150
  * @param binaryWriter Buffer to write binary data to
4344
4151
  * @returns Node mapping of unique id to index
4345
4152
  */
4346
- _Exporter.prototype._createNodeMapAndAnimationsAsync = function (babylonScene, nodes, binaryWriter) {
4153
+ _Exporter.prototype._createNodeMapAndAnimationsAsync = function (nodes, binaryWriter) {
4347
4154
  var _this = this;
4348
4155
  var promiseChain = Promise.resolve();
4349
4156
  var nodeMap = {};
@@ -4356,8 +4163,7 @@ var _Exporter = /** @class */ (function () {
4356
4163
  var idleGLTFAnimations = [];
4357
4164
  var _loop_1 = function (babylonNode) {
4358
4165
  promiseChain = promiseChain.then(function () {
4359
- var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
4360
- return _this._createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem).then(function (node) {
4166
+ return _this._createNodeAsync(babylonNode, binaryWriter).then(function (node) {
4361
4167
  var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap, binaryWriter);
4362
4168
  if (promise == null) {
4363
4169
  core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Not exporting node ".concat(babylonNode.name));
@@ -4371,10 +4177,10 @@ var _Exporter = /** @class */ (function () {
4371
4177
  _this._nodes.push(node);
4372
4178
  nodeIndex = _this._nodes.length - 1;
4373
4179
  nodeMap[babylonNode.uniqueId] = nodeIndex;
4374
- if (!babylonScene.animationGroups.length) {
4375
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate, _this._options.shouldExportAnimation);
4180
+ if (!_this._babylonScene.animationGroups.length) {
4181
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
4376
4182
  if (babylonNode.animations.length) {
4377
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate, _this._options.shouldExportAnimation);
4183
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
4378
4184
  }
4379
4185
  }
4380
4186
  });
@@ -4395,8 +4201,8 @@ var _Exporter = /** @class */ (function () {
4395
4201
  _this._animations.push(idleGLTFAnimation);
4396
4202
  }
4397
4203
  });
4398
- if (babylonScene.animationGroups.length) {
4399
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(babylonScene, _this._animations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._convertToRightHandedSystemMap, _this._animationSampleRate, _this._options.shouldExportAnimation);
4204
+ if (_this._babylonScene.animationGroups.length) {
4205
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(_this._babylonScene, _this._animations, nodeMap, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
4400
4206
  }
4401
4207
  return nodeMap;
4402
4208
  });
@@ -4405,10 +4211,9 @@ var _Exporter = /** @class */ (function () {
4405
4211
  * Creates a glTF node from a Babylon mesh
4406
4212
  * @param babylonNode Source Babylon mesh
4407
4213
  * @param binaryWriter Buffer for storing geometry data
4408
- * @param convertToRightHandedSystem Converts the values to right-handed
4409
4214
  * @returns glTF node
4410
4215
  */
4411
- _Exporter.prototype._createNodeAsync = function (babylonNode, binaryWriter, convertToRightHandedSystem) {
4216
+ _Exporter.prototype._createNodeAsync = function (babylonNode, binaryWriter) {
4412
4217
  var _this = this;
4413
4218
  return Promise.resolve().then(function () {
4414
4219
  // create node to hold translation/rotation/scale and the mesh
@@ -4420,7 +4225,7 @@ var _Exporter = /** @class */ (function () {
4420
4225
  }
4421
4226
  if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode) {
4422
4227
  // Set transformation
4423
- _this._setNodeTransformation(node, babylonNode, convertToRightHandedSystem);
4228
+ _this._setNodeTransformation(node, babylonNode);
4424
4229
  if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh) {
4425
4230
  var morphTargetManager = babylonNode.morphTargetManager;
4426
4231
  if (morphTargetManager && morphTargetManager.numTargets > 0) {
@@ -4430,7 +4235,7 @@ var _Exporter = /** @class */ (function () {
4430
4235
  }
4431
4236
  }
4432
4237
  }
4433
- return _this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter, convertToRightHandedSystem).then(function () {
4238
+ return _this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter).then(function () {
4434
4239
  if (mesh.primitives.length) {
4435
4240
  _this._meshes.push(mesh);
4436
4241
  node.mesh = _this._meshes.length - 1;
@@ -4439,7 +4244,7 @@ var _Exporter = /** @class */ (function () {
4439
4244
  });
4440
4245
  }
4441
4246
  else if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera) {
4442
- _this._setCameraTransformation(node, babylonNode, convertToRightHandedSystem);
4247
+ _this._setCameraTransformation(node, babylonNode);
4443
4248
  return node;
4444
4249
  }
4445
4250
  else {
@@ -4454,11 +4259,11 @@ var _Exporter = /** @class */ (function () {
4454
4259
  * @param binaryWriter Buffer to write binary data to
4455
4260
  * @returns Node mapping of unique id to index
4456
4261
  */
4457
- _Exporter.prototype._createSkinsAsync = function (babylonScene, nodeMap, binaryWriter) {
4262
+ _Exporter.prototype._createSkinsAsync = function (nodeMap, binaryWriter) {
4458
4263
  var _a;
4459
4264
  var promiseChain = Promise.resolve();
4460
4265
  var skinMap = {};
4461
- for (var _i = 0, _b = babylonScene.skeletons; _i < _b.length; _i++) {
4266
+ for (var _i = 0, _b = this._babylonScene.skeletons; _i < _b.length; _i++) {
4462
4267
  var skeleton = _b[_i];
4463
4268
  if (skeleton.bones.length <= 0) {
4464
4269
  continue;
@@ -4787,7 +4592,7 @@ __webpack_require__.r(__webpack_exports__);
4787
4592
  /* harmony export */ "_GLTFMaterialExporter": () => (/* binding */ _GLTFMaterialExporter)
4788
4593
  /* harmony export */ });
4789
4594
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
4790
- /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/dumpTools */ "core/Maths/math.vector");
4595
+ /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/dumpTools */ "core/Meshes/mesh");
4791
4596
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
4792
4597
 
4793
4598
 
@@ -5891,7 +5696,7 @@ __webpack_require__.r(__webpack_exports__);
5891
5696
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5892
5697
  /* harmony export */ "_GLTFUtilities": () => (/* binding */ _GLTFUtilities)
5893
5698
  /* harmony export */ });
5894
- /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/Maths/math.vector");
5699
+ /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/Meshes/mesh");
5895
5700
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
5896
5701
 
5897
5702
  /**
@@ -5952,10 +5757,9 @@ var _GLTFUtilities = /** @class */ (function () {
5952
5757
  * @param positions Positions array of a mesh
5953
5758
  * @param vertexStart Starting vertex offset to calculate min and max values
5954
5759
  * @param vertexCount Number of vertices to check for min and max values
5955
- * @param convertToRightHandedSystem
5956
5760
  * @returns min number array and max number array
5957
5761
  */
5958
- _GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount, convertToRightHandedSystem) {
5762
+ _GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount) {
5959
5763
  var min = [Infinity, Infinity, Infinity];
5960
5764
  var max = [-Infinity, -Infinity, -Infinity];
5961
5765
  var positionStrideSize = 3;
@@ -5966,9 +5770,6 @@ var _GLTFUtilities = /** @class */ (function () {
5966
5770
  for (var i = vertexStart, length_1 = vertexStart + vertexCount; i < length_1; ++i) {
5967
5771
  indexOffset = positionStrideSize * i;
5968
5772
  position = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(positions, indexOffset);
5969
- if (convertToRightHandedSystem) {
5970
- _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);
5971
- }
5972
5773
  vector = position.asArray();
5973
5774
  for (var j = 0; j < positionStrideSize; ++j) {
5974
5775
  var num = vector[j];
@@ -5984,82 +5785,6 @@ var _GLTFUtilities = /** @class */ (function () {
5984
5785
  }
5985
5786
  return { min: min, max: max };
5986
5787
  };
5987
- /**
5988
- * Converts a new right-handed Vector3
5989
- * @param vector vector3 array
5990
- * @returns right-handed Vector3
5991
- */
5992
- _GLTFUtilities._GetRightHandedPositionVector3 = function (vector) {
5993
- return new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(vector.x, vector.y, -vector.z);
5994
- };
5995
- /**
5996
- * Converts a Vector3 to right-handed
5997
- * @param vector Vector3 to convert to right-handed
5998
- */
5999
- _GLTFUtilities._GetRightHandedPositionVector3FromRef = function (vector) {
6000
- vector.z *= -1;
6001
- };
6002
- /**
6003
- * Converts a three element number array to right-handed
6004
- * @param vector number array to convert to right-handed
6005
- */
6006
- _GLTFUtilities._GetRightHandedPositionArray3FromRef = function (vector) {
6007
- vector[2] *= -1;
6008
- };
6009
- /**
6010
- * Converts a new right-handed Vector3
6011
- * @param vector vector3 array
6012
- * @returns right-handed Vector3
6013
- */
6014
- _GLTFUtilities._GetRightHandedNormalVector3 = function (vector) {
6015
- return new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(vector.x, vector.y, -vector.z);
6016
- };
6017
- /**
6018
- * Converts a Vector3 to right-handed
6019
- * @param vector Vector3 to convert to right-handed
6020
- */
6021
- _GLTFUtilities._GetRightHandedNormalVector3FromRef = function (vector) {
6022
- vector.z *= -1;
6023
- };
6024
- /**
6025
- * Converts a three element number array to right-handed
6026
- * @param vector number array to convert to right-handed
6027
- */
6028
- _GLTFUtilities._GetRightHandedNormalArray3FromRef = function (vector) {
6029
- vector[2] *= -1;
6030
- };
6031
- /**
6032
- * Converts a Vector4 to right-handed
6033
- * @param vector Vector4 to convert to right-handed
6034
- */
6035
- _GLTFUtilities._GetRightHandedVector4FromRef = function (vector) {
6036
- vector.z *= -1;
6037
- vector.w *= -1;
6038
- };
6039
- /**
6040
- * Converts a Vector4 to right-handed
6041
- * @param vector Vector4 to convert to right-handed
6042
- */
6043
- _GLTFUtilities._GetRightHandedArray4FromRef = function (vector) {
6044
- vector[2] *= -1;
6045
- vector[3] *= -1;
6046
- };
6047
- /**
6048
- * Converts a Quaternion to right-handed
6049
- * @param quaternion Source quaternion to convert to right-handed
6050
- */
6051
- _GLTFUtilities._GetRightHandedQuaternionFromRef = function (quaternion) {
6052
- quaternion.x *= -1;
6053
- quaternion.y *= -1;
6054
- };
6055
- /**
6056
- * Converts a Quaternion to right-handed
6057
- * @param quaternion Source quaternion to convert to right-handed
6058
- */
6059
- _GLTFUtilities._GetRightHandedQuaternionArrayFromRef = function (quaternion) {
6060
- quaternion[0] *= -1;
6061
- quaternion[1] *= -1;
6062
- };
6063
5788
  _GLTFUtilities._NormalizeTangentFromRef = function (tangent) {
6064
5789
  var length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);
6065
5790
  if (length > 0) {
@@ -6245,13 +5970,13 @@ if (typeof globalObject !== "undefined") {
6245
5970
 
6246
5971
  /***/ }),
6247
5972
 
6248
- /***/ "core/Maths/math.vector":
5973
+ /***/ "core/Meshes/mesh":
6249
5974
  /*!****************************************************************************************************!*\
6250
5975
  !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
6251
5976
  \****************************************************************************************************/
6252
5977
  /***/ ((module) => {
6253
5978
 
6254
- module.exports = __WEBPACK_EXTERNAL_MODULE_core_Maths_math_vector__;
5979
+ module.exports = __WEBPACK_EXTERNAL_MODULE_core_Meshes_mesh__;
6255
5980
 
6256
5981
  /***/ })
6257
5982