babylonjs-serializers 5.0.0-alpha.7 → 5.0.0-beta.2

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.
@@ -97,10 +97,10 @@ return /******/ (function(modules) { // webpackBootstrap
97
97
  /******/ ({
98
98
 
99
99
  /***/ "../../node_modules/tslib/tslib.es6.js":
100
- /*!***********************************************************!*\
101
- !*** C:/Repos/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
- \***********************************************************/
103
- /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
100
+ /*!*************************************************************!*\
101
+ !*** E:/Babylon/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
+ \*************************************************************/
103
+ /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
104
104
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
105
105
 
106
106
  "use strict";
@@ -119,6 +119,7 @@ __webpack_require__.r(__webpack_exports__);
119
119
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
120
120
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
121
121
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
122
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArray", function() { return __spreadArray; });
122
123
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
123
124
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
124
125
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
@@ -152,6 +153,8 @@ var extendStatics = function(d, b) {
152
153
  };
153
154
 
154
155
  function __extends(d, b) {
156
+ if (typeof b !== "function" && b !== null)
157
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
155
158
  extendStatics(d, b);
156
159
  function __() { this.constructor = d; }
157
160
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -274,19 +277,31 @@ function __read(o, n) {
274
277
  return ar;
275
278
  }
276
279
 
280
+ /** @deprecated */
277
281
  function __spread() {
278
282
  for (var ar = [], i = 0; i < arguments.length; i++)
279
283
  ar = ar.concat(__read(arguments[i]));
280
284
  return ar;
281
285
  }
282
286
 
287
+ /** @deprecated */
283
288
  function __spreadArrays() {
284
289
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
285
290
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
286
291
  for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
287
292
  r[k] = a[j];
288
293
  return r;
289
- };
294
+ }
295
+
296
+ function __spreadArray(to, from, pack) {
297
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
298
+ if (ar || !(i in from)) {
299
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
300
+ ar[i] = from[i];
301
+ }
302
+ }
303
+ return to.concat(ar || Array.prototype.slice.call(from));
304
+ }
290
305
 
291
306
  function __await(v) {
292
307
  return this instanceof __await ? (this.v = v, this) : new __await(v);
@@ -341,19 +356,17 @@ function __importDefault(mod) {
341
356
  return (mod && mod.__esModule) ? mod : { default: mod };
342
357
  }
343
358
 
344
- function __classPrivateFieldGet(receiver, privateMap) {
345
- if (!privateMap.has(receiver)) {
346
- throw new TypeError("attempted to get private field on non-instance");
347
- }
348
- return privateMap.get(receiver);
359
+ function __classPrivateFieldGet(receiver, state, kind, f) {
360
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
361
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
362
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
349
363
  }
350
364
 
351
- function __classPrivateFieldSet(receiver, privateMap, value) {
352
- if (!privateMap.has(receiver)) {
353
- throw new TypeError("attempted to set private field on non-instance");
354
- }
355
- privateMap.set(receiver, value);
356
- return value;
365
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
366
+ if (kind === "m") throw new TypeError("Private method is not writable");
367
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
368
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
369
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
357
370
  }
358
371
 
359
372
 
@@ -438,6 +451,8 @@ var OBJExport = /** @class */ (function () {
438
451
  OBJExport.OBJ = function (mesh, materials, matlibname, globalposition) {
439
452
  var output = [];
440
453
  var v = 1;
454
+ // keep track of uv index in case mixed meshes are passed in
455
+ var textureV = 1;
441
456
  if (materials) {
442
457
  if (!matlibname) {
443
458
  matlibname = 'mat';
@@ -448,11 +463,12 @@ var OBJExport = /** @class */ (function () {
448
463
  output.push("g object" + j);
449
464
  output.push("o object_" + j);
450
465
  //Uses the position of the item in the scene, to the file (this back to normal in the end)
451
- var lastMatrix = null;
466
+ var inverseTransform = null;
452
467
  if (globalposition) {
453
- var newMatrix = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"].Translation(mesh[j].position.x, mesh[j].position.y, mesh[j].position.z);
454
- lastMatrix = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"].Translation(-(mesh[j].position.x), -(mesh[j].position.y), -(mesh[j].position.z));
455
- mesh[j].bakeTransformIntoVertices(newMatrix);
468
+ var transform = mesh[j].computeWorldMatrix(true);
469
+ inverseTransform = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"]();
470
+ transform.invertToRef(inverseTransform);
471
+ mesh[j].bakeTransformIntoVertices(transform);
456
472
  }
457
473
  //TODO: submeshes (groups)
458
474
  //TODO: smoothing groups (s 1, s off);
@@ -471,7 +487,8 @@ var OBJExport = /** @class */ (function () {
471
487
  var trunkNormals = g.getVerticesData('normal');
472
488
  var trunkUV = g.getVerticesData('uv');
473
489
  var trunkFaces = g.getIndices();
474
- var curV = 0;
490
+ var currentV = 0;
491
+ var currentTextureV = 0;
475
492
  if (!trunkVerts || !trunkFaces) {
476
493
  babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Tools"].Warn("There are no position vertices or indices on the mesh!");
477
494
  continue;
@@ -485,7 +502,7 @@ var OBJExport = /** @class */ (function () {
485
502
  else {
486
503
  output.push("v " + trunkVerts[i] + " " + trunkVerts[i + 1] + " " + -trunkVerts[i + 2]);
487
504
  }
488
- curV++;
505
+ currentV++;
489
506
  }
490
507
  if (trunkNormals != null) {
491
508
  for (i = 0; i < trunkNormals.length; i += 3) {
@@ -495,23 +512,26 @@ var OBJExport = /** @class */ (function () {
495
512
  if (trunkUV != null) {
496
513
  for (i = 0; i < trunkUV.length; i += 2) {
497
514
  output.push("vt " + trunkUV[i] + " " + trunkUV[i + 1]);
515
+ currentTextureV++;
498
516
  }
499
517
  }
500
518
  for (i = 0; i < trunkFaces.length; i += 3) {
501
519
  var indices = [String(trunkFaces[i + 2] + v), String(trunkFaces[i + 1] + v), String(trunkFaces[i] + v)];
520
+ var textureIndices = [String(trunkFaces[i + 2] + textureV), String(trunkFaces[i + 1] + textureV), String(trunkFaces[i] + textureV)];
502
521
  var blanks = ["", "", ""];
503
522
  var facePositions = indices;
504
- var faceUVs = trunkUV != null ? indices : blanks;
523
+ var faceUVs = trunkUV != null ? textureIndices : blanks;
505
524
  var faceNormals = trunkNormals != null ? indices : blanks;
506
525
  output.push("f " + facePositions[0] + "/" + faceUVs[0] + "/" + faceNormals[0] +
507
526
  " " + facePositions[1] + "/" + faceUVs[1] + "/" + faceNormals[1] +
508
527
  " " + facePositions[2] + "/" + faceUVs[2] + "/" + faceNormals[2]);
509
528
  }
510
529
  //back de previous matrix, to not change the original mesh in the scene
511
- if (globalposition && lastMatrix) {
512
- mesh[j].bakeTransformIntoVertices(lastMatrix);
530
+ if (globalposition && inverseTransform) {
531
+ mesh[j].bakeTransformIntoVertices(inverseTransform);
513
532
  }
514
- v += curV;
533
+ v += currentV;
534
+ textureV += currentTextureV;
515
535
  }
516
536
  var text = output.join("\n");
517
537
  return (text);
@@ -764,6 +784,113 @@ var KHR_lights_punctual = /** @class */ (function () {
764
784
  _glTFExporter__WEBPACK_IMPORTED_MODULE_1__["_Exporter"].RegisterExtension(NAME, function (exporter) { return new KHR_lights_punctual(exporter); });
765
785
 
766
786
 
787
+ /***/ }),
788
+
789
+ /***/ "./glTF/2.0/Extensions/KHR_materials_clearcoat.ts":
790
+ /*!********************************************************!*\
791
+ !*** ./glTF/2.0/Extensions/KHR_materials_clearcoat.ts ***!
792
+ \********************************************************/
793
+ /*! exports provided: KHR_materials_clearcoat */
794
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
795
+
796
+ "use strict";
797
+ __webpack_require__.r(__webpack_exports__);
798
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return KHR_materials_clearcoat; });
799
+ /* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "./glTF/2.0/glTFExporter.ts");
800
+ /* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrBaseMaterial */ "babylonjs/Maths/math.vector");
801
+ /* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
802
+
803
+
804
+
805
+ var NAME = "KHR_materials_clearcoat";
806
+ /**
807
+ * @hidden
808
+ */
809
+ var KHR_materials_clearcoat = /** @class */ (function () {
810
+ function KHR_materials_clearcoat(exporter) {
811
+ /** Name of this extension */
812
+ this.name = NAME;
813
+ /** Defines whether this extension is enabled */
814
+ this.enabled = true;
815
+ /** Defines whether this extension is required */
816
+ this.required = false;
817
+ this._wasUsed = false;
818
+ this._exporter = exporter;
819
+ }
820
+ KHR_materials_clearcoat.prototype.dispose = function () {
821
+ };
822
+ Object.defineProperty(KHR_materials_clearcoat.prototype, "wasUsed", {
823
+ /** @hidden */
824
+ get: function () {
825
+ return this._wasUsed;
826
+ },
827
+ enumerable: false,
828
+ configurable: true
829
+ });
830
+ KHR_materials_clearcoat.prototype.postExportMaterialAdditionalTextures = function (context, node, babylonMaterial) {
831
+ var additionalTextures = [];
832
+ if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__["PBRBaseMaterial"]) {
833
+ if (babylonMaterial.clearCoat.isEnabled) {
834
+ if (babylonMaterial.clearCoat.texture) {
835
+ additionalTextures.push(babylonMaterial.clearCoat.texture);
836
+ }
837
+ if (!babylonMaterial.clearCoat.useRoughnessFromMainTexture && babylonMaterial.clearCoat.textureRoughness) {
838
+ additionalTextures.push(babylonMaterial.clearCoat.textureRoughness);
839
+ }
840
+ if (babylonMaterial.clearCoat.bumpTexture) {
841
+ additionalTextures.push(babylonMaterial.clearCoat.bumpTexture);
842
+ }
843
+ return additionalTextures;
844
+ }
845
+ }
846
+ return [];
847
+ };
848
+ KHR_materials_clearcoat.prototype.postExportMaterialAsync = function (context, node, babylonMaterial) {
849
+ var _this = this;
850
+ return new Promise(function (resolve, reject) {
851
+ if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__["PBRBaseMaterial"]) {
852
+ if (!babylonMaterial.clearCoat.isEnabled) {
853
+ resolve(node);
854
+ return;
855
+ }
856
+ _this._wasUsed = true;
857
+ node.extensions = node.extensions || {};
858
+ var clearCoatTextureInfo = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.texture);
859
+ var clearCoatTextureRoughnessInfo = void 0;
860
+ if (babylonMaterial.clearCoat.useRoughnessFromMainTexture) {
861
+ clearCoatTextureRoughnessInfo = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.texture);
862
+ }
863
+ else {
864
+ clearCoatTextureRoughnessInfo = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.textureRoughness);
865
+ }
866
+ if (babylonMaterial.clearCoat.isTintEnabled) {
867
+ babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Clear Color tint is not supported for glTF export. Ignoring for: " + babylonMaterial.name);
868
+ }
869
+ if (babylonMaterial.clearCoat.remapF0OnInterfaceChange) {
870
+ babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Clear Color F0 remapping is not supported for glTF export. Ignoring for: " + babylonMaterial.name);
871
+ }
872
+ var clearCoatNormalTextureInfo = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.bumpTexture);
873
+ var clearCoatInfo_1 = {
874
+ clearcoatFactor: babylonMaterial.clearCoat.intensity,
875
+ clearcoatTexture: clearCoatTextureInfo !== null && clearCoatTextureInfo !== void 0 ? clearCoatTextureInfo : undefined,
876
+ clearcoatRoughnessFactor: babylonMaterial.clearCoat.roughness,
877
+ clearcoatRoughnessTexture: clearCoatTextureRoughnessInfo !== null && clearCoatTextureRoughnessInfo !== void 0 ? clearCoatTextureRoughnessInfo : undefined,
878
+ clearcoatNormalTexture: clearCoatNormalTextureInfo !== null && clearCoatNormalTextureInfo !== void 0 ? clearCoatNormalTextureInfo : undefined,
879
+ hasTextures: function () {
880
+ return clearCoatInfo_1.clearcoatTexture !== null || clearCoatInfo_1.clearcoatRoughnessTexture !== null || clearCoatInfo_1.clearcoatRoughnessTexture !== null;
881
+ }
882
+ };
883
+ node.extensions[NAME] = clearCoatInfo_1;
884
+ }
885
+ resolve(node);
886
+ });
887
+ };
888
+ return KHR_materials_clearcoat;
889
+ }());
890
+
891
+ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__["_Exporter"].RegisterExtension(NAME, function (exporter) { return new KHR_materials_clearcoat(exporter); });
892
+
893
+
767
894
  /***/ }),
768
895
 
769
896
  /***/ "./glTF/2.0/Extensions/KHR_materials_sheen.ts":
@@ -793,14 +920,10 @@ var KHR_materials_sheen = /** @class */ (function () {
793
920
  this.enabled = true;
794
921
  /** Defines whether this extension is required */
795
922
  this.required = false;
796
- /** Reference to the glTF exporter */
797
- this._textureInfos = [];
798
- this._exportedTextures = [];
799
923
  this._wasUsed = false;
924
+ this._exporter = exporter;
800
925
  }
801
926
  KHR_materials_sheen.prototype.dispose = function () {
802
- this._textureInfos = [];
803
- this._exportedTextures = [];
804
927
  };
805
928
  Object.defineProperty(KHR_materials_sheen.prototype, "wasUsed", {
806
929
  /** @hidden */
@@ -810,23 +933,9 @@ var KHR_materials_sheen = /** @class */ (function () {
810
933
  enumerable: false,
811
934
  configurable: true
812
935
  });
813
- KHR_materials_sheen.prototype._getTextureIndex = function (babylonTexture) {
814
- var textureIndex = this._exportedTextures.indexOf(babylonTexture);
815
- if (textureIndex === -1 && babylonTexture.reservedDataStore) {
816
- textureIndex = this._exportedTextures.indexOf(babylonTexture.reservedDataStore.source);
817
- }
818
- return textureIndex;
819
- };
820
- KHR_materials_sheen.prototype.postExportTexture = function (context, textureInfo, babylonTexture) {
821
- var textureIndex = this._getTextureIndex(babylonTexture);
822
- if (textureIndex > -1) {
823
- this._textureInfos[textureIndex] = textureInfo;
824
- }
825
- };
826
936
  KHR_materials_sheen.prototype.postExportMaterialAdditionalTextures = function (context, node, babylonMaterial) {
827
937
  if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__["PBRMaterial"]) {
828
938
  if (babylonMaterial.sheen.isEnabled && babylonMaterial.sheen.texture) {
829
- this._exportedTextures.push(babylonMaterial.sheen.texture);
830
939
  return [babylonMaterial.sheen.texture];
831
940
  }
832
941
  }
@@ -835,7 +944,7 @@ var KHR_materials_sheen = /** @class */ (function () {
835
944
  KHR_materials_sheen.prototype.postExportMaterialAsync = function (context, node, babylonMaterial) {
836
945
  var _this = this;
837
946
  return new Promise(function (resolve, reject) {
838
- var _a;
947
+ var _a, _b, _c, _d;
839
948
  if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__["PBRMaterial"]) {
840
949
  if (!babylonMaterial.sheen.isEnabled) {
841
950
  resolve(node);
@@ -845,29 +954,23 @@ var KHR_materials_sheen = /** @class */ (function () {
845
954
  if (node.extensions == null) {
846
955
  node.extensions = {};
847
956
  }
848
- var sheenInfo = {
957
+ var sheenInfo_1 = {
849
958
  sheenColorFactor: babylonMaterial.sheen.color.asArray(),
850
- sheenRoughnessFactor: (_a = babylonMaterial.sheen.roughness) !== null && _a !== void 0 ? _a : 0
959
+ sheenRoughnessFactor: (_a = babylonMaterial.sheen.roughness) !== null && _a !== void 0 ? _a : 0,
960
+ hasTextures: function () {
961
+ return sheenInfo_1.sheenColorTexture !== null || sheenInfo_1.sheenRoughnessTexture !== null;
962
+ }
851
963
  };
852
964
  if (babylonMaterial.sheen.texture) {
853
- var textureIndex = _this._getTextureIndex(babylonMaterial.sheen.texture);
854
- if (textureIndex > -1) {
855
- sheenInfo.sheenColorTexture = _this._textureInfos[textureIndex];
856
- }
965
+ sheenInfo_1.sheenColorTexture = (_b = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.sheen.texture)) !== null && _b !== void 0 ? _b : undefined;
857
966
  }
858
967
  if (babylonMaterial.sheen.textureRoughness && !babylonMaterial.sheen.useRoughnessFromMainTexture) {
859
- var textureIndex = _this._getTextureIndex(babylonMaterial.sheen.textureRoughness);
860
- if (textureIndex > -1) {
861
- sheenInfo.sheenRoughnessTexture = _this._textureInfos[textureIndex];
862
- }
968
+ sheenInfo_1.sheenRoughnessTexture = (_c = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.sheen.textureRoughness)) !== null && _c !== void 0 ? _c : undefined;
863
969
  }
864
970
  else if (babylonMaterial.sheen.texture && babylonMaterial.sheen.useRoughnessFromMainTexture) {
865
- var textureIndex = _this._getTextureIndex(babylonMaterial.sheen.texture);
866
- if (textureIndex > -1) {
867
- sheenInfo.sheenRoughnessTexture = _this._textureInfos[textureIndex];
868
- }
971
+ sheenInfo_1.sheenRoughnessTexture = (_d = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.sheen.texture)) !== null && _d !== void 0 ? _d : undefined;
869
972
  }
870
- node.extensions[NAME] = sheenInfo;
973
+ node.extensions[NAME] = sheenInfo_1;
871
974
  }
872
975
  resolve(node);
873
976
  });
@@ -1106,7 +1209,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_1__["_Exporter"].RegisterExtension(NAME,
1106
1209
  /*!**************************************!*\
1107
1210
  !*** ./glTF/2.0/Extensions/index.ts ***!
1108
1211
  \**************************************/
1109
- /*! exports provided: KHR_texture_transform, KHR_lights_punctual, KHR_materials_sheen, KHR_materials_unlit */
1212
+ /*! exports provided: KHR_texture_transform, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_unlit */
1110
1213
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1111
1214
 
1112
1215
  "use strict";
@@ -1117,16 +1220,20 @@ __webpack_require__.r(__webpack_exports__);
1117
1220
  /* harmony import */ var _KHR_lights_punctual__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./KHR_lights_punctual */ "./glTF/2.0/Extensions/KHR_lights_punctual.ts");
1118
1221
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _KHR_lights_punctual__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
1119
1222
 
1120
- /* harmony import */ var _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./KHR_materials_sheen */ "./glTF/2.0/Extensions/KHR_materials_sheen.ts");
1121
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_2__["KHR_materials_sheen"]; });
1223
+ /* harmony import */ var _KHR_materials_clearcoat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./KHR_materials_clearcoat */ "./glTF/2.0/Extensions/KHR_materials_clearcoat.ts");
1224
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return _KHR_materials_clearcoat__WEBPACK_IMPORTED_MODULE_2__["KHR_materials_clearcoat"]; });
1225
+
1226
+ /* harmony import */ var _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./KHR_materials_sheen */ "./glTF/2.0/Extensions/KHR_materials_sheen.ts");
1227
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_3__["KHR_materials_sheen"]; });
1122
1228
 
1123
- /* harmony import */ var _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./KHR_materials_unlit */ "./glTF/2.0/Extensions/KHR_materials_unlit.ts");
1124
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_3__["KHR_materials_unlit"]; });
1229
+ /* harmony import */ var _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./KHR_materials_unlit */ "./glTF/2.0/Extensions/KHR_materials_unlit.ts");
1230
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_4__["KHR_materials_unlit"]; });
1125
1231
 
1126
1232
 
1127
1233
 
1128
1234
 
1129
1235
 
1236
+
1130
1237
 
1131
1238
 
1132
1239
  /***/ }),
@@ -1455,7 +1562,8 @@ var _GLTFAnimation = /** @class */ (function () {
1455
1562
  animationKeys.push(morphTargetAnimation.getKeys()[i]);
1456
1563
  }
1457
1564
  else {
1458
- animationKeys.push({ frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,
1565
+ animationKeys.push({
1566
+ frame: animationGroup.from + (animationGroupFrameDiff / numAnimationKeys) * i,
1459
1567
  value: morphTarget.influence,
1460
1568
  inTangent: sampleAnimationKeys[0].inTangent ? 0 : undefined,
1461
1569
  outTangent: sampleAnimationKeys[0].outTangent ? 0 : undefined
@@ -2035,7 +2143,7 @@ var GLTFData = /** @class */ (function () {
2035
2143
  else if (endsWith(key, ".gltf")) {
2036
2144
  mimeType = { type: "model/gltf+json" };
2037
2145
  }
2038
- else if (endsWith(key, ".jpeg" || false)) {
2146
+ else if (endsWith(key, ".jpeg") || endsWith(key, ".jpg")) {
2039
2147
  mimeType = { type: "image/jpeg" /* JPEG */ };
2040
2148
  }
2041
2149
  else if (endsWith(key, ".png")) {
@@ -2084,9 +2192,6 @@ __webpack_require__.r(__webpack_exports__);
2084
2192
 
2085
2193
 
2086
2194
 
2087
-
2088
-
2089
-
2090
2195
  /**
2091
2196
  * Converts Babylon Scene into glTF 2.0.
2092
2197
  * @hidden
@@ -2609,7 +2714,7 @@ var _Exporter = /** @class */ (function () {
2609
2714
  }
2610
2715
  case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].ColorKind: {
2611
2716
  var meshMaterial = babylonTransformNode.material;
2612
- var convertToLinear = meshMaterial ? (meshMaterial instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["StandardMaterial"]) : true;
2717
+ var convertToLinear = meshMaterial ? (meshMaterial.getClassName() === "StandardMaterial") : true;
2613
2718
  var vertexData = stride === 3 ? new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Color3"]() : new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Color4"]();
2614
2719
  for (var k = 0, length_5 = meshAttributeArray.length / stride; k < length_5; ++k) {
2615
2720
  index = k * stride;
@@ -2935,7 +3040,14 @@ var _Exporter = /** @class */ (function () {
2935
3040
  var headerLength = 12;
2936
3041
  var chunkLengthPrefix = 8;
2937
3042
  var jsonLength = jsonText.length;
3043
+ var encodedJsonText;
2938
3044
  var imageByteLength = 0;
3045
+ // make use of TextEncoder when available
3046
+ if (typeof TextEncoder !== "undefined") {
3047
+ var encoder = new TextEncoder();
3048
+ encodedJsonText = encoder.encode(jsonText);
3049
+ jsonLength = encodedJsonText.length;
3050
+ }
2939
3051
  for (var i = 0; i < _this._orderedImageData.length; ++i) {
2940
3052
  imageByteLength += _this._orderedImageData[i].data.byteLength;
2941
3053
  }
@@ -2956,8 +3068,22 @@ var _Exporter = /** @class */ (function () {
2956
3068
  jsonChunkBufferView.setUint32(4, 0x4E4F534A, true);
2957
3069
  //json chunk bytes
2958
3070
  var jsonData = new Uint8Array(jsonChunkBuffer, chunkLengthPrefix);
2959
- for (var i = 0; i < jsonLength; ++i) {
2960
- jsonData[i] = jsonText.charCodeAt(i);
3071
+ // if TextEncoder was available, we can simply copy the encoded array
3072
+ if (encodedJsonText) {
3073
+ jsonData.set(encodedJsonText);
3074
+ }
3075
+ else {
3076
+ var blankCharCode = "_".charCodeAt(0);
3077
+ for (var i = 0; i < jsonLength; ++i) {
3078
+ var charCode = jsonText.charCodeAt(i);
3079
+ // if the character doesn't fit into a single UTF-16 code unit, just put a blank character
3080
+ if (charCode != jsonText.codePointAt(i)) {
3081
+ jsonData[i] = blankCharCode;
3082
+ }
3083
+ else {
3084
+ jsonData[i] = charCode;
3085
+ }
3086
+ }
2961
3087
  }
2962
3088
  //json padding
2963
3089
  var jsonPaddingView = new Uint8Array(jsonChunkBuffer, chunkLengthPrefix + jsonLength);
@@ -3307,7 +3433,7 @@ var _Exporter = /** @class */ (function () {
3307
3433
  this._materials.push(material);
3308
3434
  materialIndex = this._materials.length - 1;
3309
3435
  }
3310
- else if (babylonMaterial instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["MultiMaterial"]) {
3436
+ else if (babylonMaterial.getClassName() === "MultiMaterial") {
3311
3437
  var subMaterial = babylonMaterial.subMaterials[submesh.materialIndex];
3312
3438
  if (subMaterial) {
3313
3439
  babylonMaterial = subMaterial;
@@ -3324,8 +3450,8 @@ var _Exporter = /** @class */ (function () {
3324
3450
  for (var _d = 0, attributeData_2 = attributeData; _d < attributeData_2.length; _d++) {
3325
3451
  var attribute = attributeData_2[_d];
3326
3452
  var attributeKind = attribute.kind;
3327
- if (attributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UVKind || attributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind) {
3328
- if (glTFMaterial && !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {
3453
+ if ((attributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UVKind || attributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind) && !this._options.exportUnusedUVs) {
3454
+ if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {
3329
3455
  continue;
3330
3456
  }
3331
3457
  }
@@ -3392,10 +3518,8 @@ var _Exporter = /** @class */ (function () {
3392
3518
  }
3393
3519
  }
3394
3520
  mesh.primitives.push(meshPrimitive);
3395
- var promise = this._extensionsPostExportMeshPrimitiveAsync("postExport", meshPrimitive, submesh, binaryWriter);
3396
- if (promise) {
3397
- promises.push();
3398
- }
3521
+ this._extensionsPostExportMeshPrimitiveAsync("postExport", meshPrimitive, submesh, binaryWriter);
3522
+ promises.push();
3399
3523
  }
3400
3524
  }
3401
3525
  }
@@ -3415,13 +3539,8 @@ var _Exporter = /** @class */ (function () {
3415
3539
  }
3416
3540
  // Transform
3417
3541
  var matrix = node.getWorldMatrix();
3418
- var matrixToLeftHanded = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Compose(this._convertToRightHandedSystem ? new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Vector3"](-1, 1, 1) : babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Vector3"].One(), babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Quaternion"].Identity(), babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Vector3"].Zero());
3419
- var matrixProduct = matrix.multiply(matrixToLeftHanded);
3420
- var matrixIdentity = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Matrix"].IdentityReadOnly;
3421
- for (var i = 0; i < 16; i++) {
3422
- if (Math.abs(matrixProduct.m[i] - matrixIdentity.m[i]) > babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Epsilon"]) {
3423
- return false;
3424
- }
3542
+ if (matrix.determinant() === 1) {
3543
+ return false;
3425
3544
  }
3426
3545
  // Geometry
3427
3546
  if ((node instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Mesh"] && node.geometry !== null) ||
@@ -3447,7 +3566,7 @@ var _Exporter = /** @class */ (function () {
3447
3566
  var glTFNodeIndex;
3448
3567
  var glTFNode;
3449
3568
  var directDescendents;
3450
- var nodes = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArrays"])(babylonScene.transformNodes, babylonScene.meshes, babylonScene.lights);
3569
+ var nodes = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArray"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArray"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArray"])([], babylonScene.transformNodes, true), babylonScene.meshes, true), babylonScene.lights, true);
3451
3570
  var rootNodesToLeftHanded = [];
3452
3571
  this._convertToRightHandedSystem = !babylonScene.useRightHandedSystem;
3453
3572
  this._convertToRightHandedSystemMap = {};
@@ -3473,8 +3592,9 @@ var _Exporter = /** @class */ (function () {
3473
3592
  });
3474
3593
  }
3475
3594
  });
3476
- return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(babylonScene.materials, "image/png" /* PNG */, true).then(function () {
3477
- return _this.createNodeMapAndAnimationsAsync(babylonScene, nodes, binaryWriter).then(function (nodeMap) {
3595
+ var _a = this.getExportNodes(nodes), exportNodes = _a[0], exportMaterials = _a[1];
3596
+ return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* PNG */, true).then(function () {
3597
+ return _this.createNodeMapAndAnimationsAsync(babylonScene, exportNodes, binaryWriter).then(function (nodeMap) {
3478
3598
  return _this.createSkinsAsync(babylonScene, nodeMap, binaryWriter).then(function (skinMap) {
3479
3599
  _this._nodeMap = nodeMap;
3480
3600
  _this._totalByteLength = binaryWriter.getByteOffset();
@@ -3539,6 +3659,41 @@ var _Exporter = /** @class */ (function () {
3539
3659
  });
3540
3660
  });
3541
3661
  };
3662
+ /**
3663
+ * Getting the nodes and materials that would be exported.
3664
+ * @param nodes Babylon transform nodes
3665
+ * @returns Array of nodes which would be exported.
3666
+ * @returns Set of materials which would be exported.
3667
+ */
3668
+ _Exporter.prototype.getExportNodes = function (nodes) {
3669
+ var exportNodes = [];
3670
+ var exportMaterials = new Set();
3671
+ for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
3672
+ var babylonNode = nodes_2[_i];
3673
+ if (!this._options.shouldExportNode || this._options.shouldExportNode(babylonNode)) {
3674
+ exportNodes.push(babylonNode);
3675
+ if (babylonNode.getClassName() === "Mesh") {
3676
+ var mesh = babylonNode;
3677
+ if (mesh.material) {
3678
+ exportMaterials.add(mesh.material);
3679
+ }
3680
+ }
3681
+ else {
3682
+ var meshes = babylonNode.getChildMeshes(false);
3683
+ for (var _a = 0, meshes_1 = meshes; _a < meshes_1.length; _a++) {
3684
+ var mesh = meshes_1[_a];
3685
+ if (mesh.material) {
3686
+ exportMaterials.add(mesh.material);
3687
+ }
3688
+ }
3689
+ }
3690
+ }
3691
+ else {
3692
+ "Excluding node " + babylonNode.name;
3693
+ }
3694
+ }
3695
+ return [exportNodes, exportMaterials];
3696
+ };
3542
3697
  /**
3543
3698
  * Creates a mapping of Node unique id to node index and handles animations
3544
3699
  * @param babylonScene Babylon Scene
@@ -3558,41 +3713,35 @@ var _Exporter = /** @class */ (function () {
3558
3713
  };
3559
3714
  var idleGLTFAnimations = [];
3560
3715
  var _loop_1 = function (babylonNode) {
3561
- if (!this_1._options.shouldExportNode || this_1._options.shouldExportNode(babylonNode)) {
3562
- promiseChain = promiseChain.then(function () {
3563
- var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
3564
- return _this.createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem, nodeMap).then(function (node) {
3565
- var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap);
3566
- if (promise == null) {
3567
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node " + babylonNode.name);
3568
- return Promise.resolve();
3569
- }
3570
- else {
3571
- return promise.then(function (node) {
3572
- if (!node) {
3573
- return;
3574
- }
3575
- _this._nodes.push(node);
3576
- nodeIndex = _this._nodes.length - 1;
3577
- nodeMap[babylonNode.uniqueId] = nodeIndex;
3578
- if (!babylonScene.animationGroups.length) {
3579
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate);
3580
- if (babylonNode.animations.length) {
3581
- _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate);
3582
- }
3716
+ promiseChain = promiseChain.then(function () {
3717
+ var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
3718
+ return _this.createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem, nodeMap).then(function (node) {
3719
+ var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap);
3720
+ if (promise == null) {
3721
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node " + babylonNode.name);
3722
+ return Promise.resolve();
3723
+ }
3724
+ else {
3725
+ return promise.then(function (node) {
3726
+ if (!node) {
3727
+ return;
3728
+ }
3729
+ _this._nodes.push(node);
3730
+ nodeIndex = _this._nodes.length - 1;
3731
+ nodeMap[babylonNode.uniqueId] = nodeIndex;
3732
+ if (!babylonScene.animationGroups.length) {
3733
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate);
3734
+ if (babylonNode.animations.length) {
3735
+ _glTFAnimation__WEBPACK_IMPORTED_MODULE_5__["_GLTFAnimation"]._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, convertToRightHandedSystem, _this._animationSampleRate);
3583
3736
  }
3584
- });
3585
- }
3586
- });
3737
+ }
3738
+ });
3739
+ }
3587
3740
  });
3588
- }
3589
- else {
3590
- "Excluding node " + babylonNode.name;
3591
- }
3741
+ });
3592
3742
  };
3593
- var this_1 = this;
3594
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
3595
- var babylonNode = nodes_2[_i];
3743
+ for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
3744
+ var babylonNode = nodes_3[_i];
3596
3745
  _loop_1(babylonNode);
3597
3746
  }
3598
3747
  return promiseChain.then(function () {
@@ -3661,59 +3810,54 @@ var _Exporter = /** @class */ (function () {
3661
3810
  * @returns Node mapping of unique id to index
3662
3811
  */
3663
3812
  _Exporter.prototype.createSkinsAsync = function (babylonScene, nodeMap, binaryWriter) {
3813
+ var _a;
3664
3814
  var promiseChain = Promise.resolve();
3665
3815
  var skinMap = {};
3666
- var _loop_2 = function (skeleton) {
3816
+ for (var _i = 0, _b = babylonScene.skeletons; _i < _b.length; _i++) {
3817
+ var skeleton = _b[_i];
3667
3818
  // create skin
3668
3819
  var skin = { joints: [] };
3669
3820
  var inverseBindMatrices = [];
3670
- var skeletonMesh = babylonScene.meshes.find(function (mesh) { mesh.skeleton === skeleton; });
3671
- skin.skeleton = skeleton.overrideMesh === null ? (skeletonMesh ? nodeMap[skeletonMesh.uniqueId] : undefined) : nodeMap[skeleton.overrideMesh.uniqueId];
3672
3821
  var boneIndexMap = {};
3673
- var boneIndexMax = -1;
3674
- var boneIndex = -1;
3675
- for (var _i = 0, _a = skeleton.bones; _i < _a.length; _i++) {
3676
- var bone = _a[_i];
3677
- boneIndex = bone.getIndex();
3678
- if (boneIndex > -1) {
3822
+ var maxBoneIndex = -1;
3823
+ for (var i = 0; i < skeleton.bones.length; ++i) {
3824
+ var bone = skeleton.bones[i];
3825
+ var boneIndex = (_a = bone.getIndex()) !== null && _a !== void 0 ? _a : i;
3826
+ if (boneIndex !== -1) {
3679
3827
  boneIndexMap[boneIndex] = bone;
3828
+ if (boneIndex > maxBoneIndex) {
3829
+ maxBoneIndex = boneIndex;
3830
+ }
3680
3831
  }
3681
- boneIndexMax = Math.max(boneIndexMax, boneIndex);
3682
3832
  }
3683
- for (var i = 0; i <= boneIndexMax; ++i) {
3684
- var bone = boneIndexMap[i];
3833
+ for (var boneIndex = 0; boneIndex <= maxBoneIndex; ++boneIndex) {
3834
+ var bone = boneIndexMap[boneIndex];
3835
+ inverseBindMatrices.push(bone.getInvertedAbsoluteTransform());
3685
3836
  var transformNode = bone.getTransformNode();
3686
3837
  if (transformNode) {
3687
- var boneMatrix = bone.getInvertedAbsoluteTransform();
3688
- if (this_2._convertToRightHandedSystem) {
3689
- _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedMatrixFromRef(boneMatrix);
3690
- }
3691
- inverseBindMatrices.push(boneMatrix);
3692
3838
  skin.joints.push(nodeMap[transformNode.uniqueId]);
3693
3839
  }
3840
+ else {
3841
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Exporting a bone without a linked transform node is currently unsupported");
3842
+ }
3694
3843
  }
3695
3844
  // create buffer view for inverse bind matrices
3696
3845
  var byteStride = 64; // 4 x 4 matrix of 32 bit float
3697
3846
  var byteLength = inverseBindMatrices.length * byteStride;
3698
3847
  var bufferViewOffset = binaryWriter.getByteOffset();
3699
- var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateBufferView(0, bufferViewOffset, byteLength, byteStride, "InverseBindMatrices" + " - " + skeleton.name);
3700
- this_2._bufferViews.push(bufferView);
3701
- var bufferViewIndex = this_2._bufferViews.length - 1;
3848
+ var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateBufferView(0, bufferViewOffset, byteLength, undefined, "InverseBindMatrices" + " - " + skeleton.name);
3849
+ this._bufferViews.push(bufferView);
3850
+ var bufferViewIndex = this._bufferViews.length - 1;
3702
3851
  var bindMatrixAccessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._CreateAccessor(bufferViewIndex, "InverseBindMatrices" + " - " + skeleton.name, "MAT4" /* MAT4 */, 5126 /* FLOAT */, inverseBindMatrices.length, null, null, null);
3703
- var inverseBindAccessorIndex = this_2._accessors.push(bindMatrixAccessor) - 1;
3852
+ var inverseBindAccessorIndex = this._accessors.push(bindMatrixAccessor) - 1;
3704
3853
  skin.inverseBindMatrices = inverseBindAccessorIndex;
3705
- this_2._skins.push(skin);
3706
- skinMap[skeleton.uniqueId] = this_2._skins.length - 1;
3854
+ this._skins.push(skin);
3855
+ skinMap[skeleton.uniqueId] = this._skins.length - 1;
3707
3856
  inverseBindMatrices.forEach(function (mat) {
3708
3857
  mat.m.forEach(function (cell) {
3709
3858
  binaryWriter.setFloat32(cell);
3710
3859
  });
3711
3860
  });
3712
- };
3713
- var this_2 = this;
3714
- for (var _i = 0, _a = babylonScene.skeletons; _i < _a.length; _i++) {
3715
- var skeleton = _a[_i];
3716
- _loop_2(skeleton);
3717
3861
  }
3718
3862
  return promiseChain.then(function () {
3719
3863
  return skinMap;
@@ -3960,8 +4104,6 @@ __webpack_require__.r(__webpack_exports__);
3960
4104
 
3961
4105
 
3962
4106
 
3963
-
3964
-
3965
4107
  /**
3966
4108
  * Utility methods for working with glTF material conversion properties. This class should only be used internally
3967
4109
  * @hidden
@@ -3992,24 +4134,24 @@ var _GLTFMaterialExporter = /** @class */ (function () {
3992
4134
  * @param mimeType texture mime type
3993
4135
  * @param images array of images
3994
4136
  * @param textures array of textures
3995
- * @param materials array of materials
4137
+ * @param materials set of materials
3996
4138
  * @param imageData mapping of texture names to base64 textures
3997
4139
  * @param hasTextureCoords specifies if texture coordinates are present on the material
3998
4140
  */
3999
- _GLTFMaterialExporter.prototype._convertMaterialsToGLTFAsync = function (babylonMaterials, mimeType, hasTextureCoords) {
4141
+ _GLTFMaterialExporter.prototype._convertMaterialsToGLTFAsync = function (exportMaterials, mimeType, hasTextureCoords) {
4142
+ var _this = this;
4000
4143
  var promises = [];
4001
- for (var _i = 0, babylonMaterials_1 = babylonMaterials; _i < babylonMaterials_1.length; _i++) {
4002
- var babylonMaterial = babylonMaterials_1[_i];
4003
- if (babylonMaterial instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["StandardMaterial"]) {
4004
- promises.push(this._convertStandardMaterialAsync(babylonMaterial, mimeType, hasTextureCoords));
4144
+ exportMaterials.forEach(function (material) {
4145
+ if (material.getClassName() === "StandardMaterial") {
4146
+ promises.push(_this._convertStandardMaterialAsync(material, mimeType, hasTextureCoords));
4005
4147
  }
4006
- else if (babylonMaterial instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["PBRBaseMaterial"]) {
4007
- promises.push(this._convertPBRMaterialAsync(babylonMaterial, mimeType, hasTextureCoords));
4148
+ else if (material.getClassName().indexOf("PBR") !== -1) {
4149
+ promises.push(_this._convertPBRMaterialAsync(material, mimeType, hasTextureCoords));
4008
4150
  }
4009
4151
  else {
4010
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Unsupported material type: " + babylonMaterial.name);
4152
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Unsupported material type: " + material.name);
4011
4153
  }
4012
- }
4154
+ });
4013
4155
  return Promise.all(promises).then(function () { });
4014
4156
  };
4015
4157
  /**
@@ -4041,6 +4183,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4041
4183
  * @returns boolean specifying if texture parameters are present
4042
4184
  */
4043
4185
  _GLTFMaterialExporter.prototype._hasTexturesPresent = function (material) {
4186
+ var _a;
4044
4187
  if (material.emissiveTexture || material.normalTexture || material.occlusionTexture) {
4045
4188
  return true;
4046
4189
  }
@@ -4050,8 +4193,25 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4050
4193
  return true;
4051
4194
  }
4052
4195
  }
4196
+ if (material.extensions) {
4197
+ for (var extension in material.extensions) {
4198
+ var extensionObject = material.extensions[extension];
4199
+ if (extensionObject) {
4200
+ return (_a = extensionObject.hasTextures) === null || _a === void 0 ? void 0 : _a.call(extensionObject);
4201
+ }
4202
+ }
4203
+ }
4053
4204
  return false;
4054
4205
  };
4206
+ _GLTFMaterialExporter.prototype._getTextureInfo = function (babylonTexture) {
4207
+ if (babylonTexture) {
4208
+ var textureUid = babylonTexture.uid;
4209
+ if (textureUid in this._textureMap) {
4210
+ return this._textureMap[textureUid];
4211
+ }
4212
+ }
4213
+ return null;
4214
+ };
4055
4215
  /**
4056
4216
  * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
4057
4217
  * @param babylonStandardMaterial
@@ -4438,10 +4598,11 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4438
4598
  * @returns pbr metallic roughness interface or null
4439
4599
  */
4440
4600
  _GLTFMaterialExporter.prototype._convertSpecularGlossinessTexturesToMetallicRoughnessAsync = function (diffuseTexture, specularGlossinessTexture, factors, mimeType) {
4601
+ var _a;
4441
4602
  return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
4442
4603
  var promises, scene, resizedTextures, diffuseSize, diffuseBuffer, specularGlossinessBuffer, width, height, diffusePixels, specularPixels, byteLength, metallicRoughnessBuffer, baseColorBuffer, strideSize, maxBaseColor, maxMetallic, maxRoughness, h, w, offset, diffuseColor, specularColor, glossiness, specularGlossiness, metallicRoughness, metallicRoughnessFactors_1, writeOutMetallicRoughnessTexture, writeOutBaseColorTexture, h, w, destinationOffset, linearBaseColorPixel, sRGBBaseColorPixel, metallicRoughnessPixel, promise, promise;
4443
- return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
4444
- switch (_a.label) {
4604
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
4605
+ switch (_b.label) {
4445
4606
  case 0:
4446
4607
  promises = [];
4447
4608
  if (!(diffuseTexture || specularGlossinessTexture)) {
@@ -4450,17 +4611,17 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4450
4611
  scene = diffuseTexture ? diffuseTexture.getScene() : specularGlossinessTexture ? specularGlossinessTexture.getScene() : null;
4451
4612
  if (!scene) return [3 /*break*/, 3];
4452
4613
  resizedTextures = this._resizeTexturesToSameDimensions(diffuseTexture, specularGlossinessTexture, scene);
4453
- diffuseSize = resizedTextures.texture1.getSize();
4614
+ diffuseSize = (_a = resizedTextures.texture1) === null || _a === void 0 ? void 0 : _a.getSize();
4454
4615
  diffuseBuffer = void 0;
4455
4616
  specularGlossinessBuffer = void 0;
4456
4617
  width = diffuseSize.width;
4457
4618
  height = diffuseSize.height;
4458
4619
  return [4 /*yield*/, resizedTextures.texture1.readPixels()];
4459
4620
  case 1:
4460
- diffusePixels = _a.sent();
4621
+ diffusePixels = _b.sent();
4461
4622
  return [4 /*yield*/, resizedTextures.texture2.readPixels()];
4462
4623
  case 2:
4463
- specularPixels = _a.sent();
4624
+ specularPixels = _b.sent();
4464
4625
  if (diffusePixels) {
4465
4626
  diffuseBuffer = this._convertPixelArrayToFloat32(diffusePixels);
4466
4627
  }
@@ -4612,24 +4773,24 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4612
4773
  */
4613
4774
  _GLTFMaterialExporter.prototype._convertMetalRoughFactorsToMetallicRoughnessAsync = function (babylonPBRMaterial, mimeType, glTFPbrMetallicRoughness, hasTextureCoords) {
4614
4775
  var promises = [];
4615
- var baseColor = babylonPBRMaterial.albedoColor || babylonPBRMaterial.baseColor;
4616
- var metallic = babylonPBRMaterial.metallic || babylonPBRMaterial.metallic;
4617
- var roughness = babylonPBRMaterial.roughness || babylonPBRMaterial.roughness;
4776
+ var baseColor = babylonPBRMaterial._albedoColor;
4777
+ var metallic = babylonPBRMaterial._metallic;
4778
+ var roughness = babylonPBRMaterial._roughness;
4618
4779
  var metallicRoughness = {
4619
4780
  baseColor: baseColor,
4620
4781
  metallic: metallic,
4621
4782
  roughness: roughness
4622
4783
  };
4623
4784
  if (hasTextureCoords) {
4624
- var albedoTexture = babylonPBRMaterial.albedoTexture || babylonPBRMaterial.baseTexture;
4785
+ var albedoTexture = babylonPBRMaterial._albedoTexture;
4625
4786
  if (albedoTexture) {
4626
- promises.push(this._exportTextureAsync(babylonPBRMaterial.albedoTexture, mimeType).then(function (glTFTexture) {
4787
+ promises.push(this._exportTextureAsync(babylonPBRMaterial._albedoTexture, mimeType).then(function (glTFTexture) {
4627
4788
  if (glTFTexture) {
4628
4789
  glTFPbrMetallicRoughness.baseColorTexture = glTFTexture;
4629
4790
  }
4630
4791
  }));
4631
4792
  }
4632
- var metallicTexture = babylonPBRMaterial.metallicTexture || babylonPBRMaterial.metallicRoughnessTexture;
4793
+ var metallicTexture = babylonPBRMaterial._metallicTexture;
4633
4794
  if (metallicTexture) {
4634
4795
  promises.push(this._exportTextureAsync(metallicTexture, mimeType).then(function (glTFTexture) {
4635
4796
  if (glTFTexture) {
@@ -4752,23 +4913,25 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4752
4913
  return Promise.resolve().then(function () {
4753
4914
  var samplers = _this._exporter._samplers;
4754
4915
  var textures = _this._exporter._textures;
4755
- var diffuseColor = babylonPBRMaterial.albedoColor || babylonPBRMaterial.diffuseColor || babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Color3"].White();
4756
- var specularColor = babylonPBRMaterial.reflectivityColor || babylonPBRMaterial.specularColor || babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Color3"].White();
4757
- var glossiness = babylonPBRMaterial.microSurface || babylonPBRMaterial.glossiness || 1;
4916
+ var diffuseColor = babylonPBRMaterial._albedoColor;
4917
+ var specularColor = babylonPBRMaterial._reflectivityColor;
4918
+ var glossiness = babylonPBRMaterial._microSurface;
4758
4919
  var specGloss = {
4759
4920
  diffuseColor: diffuseColor,
4760
4921
  specularColor: specularColor,
4761
4922
  glossiness: glossiness,
4762
4923
  };
4763
4924
  var samplerIndex = null;
4764
- var albedoTexture = babylonPBRMaterial.albedoTexture || babylonPBRMaterial.diffuseTexture;
4765
- var reflectivityTexture = babylonPBRMaterial.reflectivityTexture || babylonPBRMaterial.specularGlossinessTexture;
4766
- var sampler = _this._getGLTFTextureSampler(albedoTexture);
4767
- if (sampler.magFilter != null && sampler.minFilter != null && sampler.wrapS != null && sampler.wrapT != null) {
4768
- samplers.push(sampler);
4769
- samplerIndex = samplers.length - 1;
4770
- }
4771
- var useMicrosurfaceFromReflectivityMapAlpha = babylonPBRMaterial.useMicroSurfaceFromReflectivityMapAlpha || babylonPBRMaterial.useMicroSurfaceFromReflectivityMapAlpha;
4925
+ var albedoTexture = babylonPBRMaterial._albedoTexture;
4926
+ var reflectivityTexture = babylonPBRMaterial._reflectivityTexture;
4927
+ if (albedoTexture) {
4928
+ var sampler = _this._getGLTFTextureSampler(albedoTexture);
4929
+ if (sampler.magFilter != null && sampler.minFilter != null && sampler.wrapS != null && sampler.wrapT != null) {
4930
+ samplers.push(sampler);
4931
+ samplerIndex = samplers.length - 1;
4932
+ }
4933
+ }
4934
+ var useMicrosurfaceFromReflectivityMapAlpha = babylonPBRMaterial._useMicroSurfaceFromReflectivityMapAlpha;
4772
4935
  if (reflectivityTexture && !useMicrosurfaceFromReflectivityMapAlpha) {
4773
4936
  return Promise.reject("_ConvertPBRMaterial: Glossiness values not included in the reflectivity texture are currently not supported");
4774
4937
  }
@@ -4812,7 +4975,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4812
4975
  };
4813
4976
  var useMetallicRoughness = babylonPBRMaterial.isMetallicWorkflow();
4814
4977
  if (useMetallicRoughness) {
4815
- var albedoColor = babylonPBRMaterial.albedoColor || babylonPBRMaterial.diffuseColor || babylonPBRMaterial.baseColor;
4978
+ var albedoColor = babylonPBRMaterial._albedoColor;
4816
4979
  var alpha = babylonPBRMaterial.alpha;
4817
4980
  if (albedoColor) {
4818
4981
  glTFPbrMetallicRoughness.baseColorFactor = [
@@ -4853,13 +5016,13 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4853
5016
  glTFPbrMetallicRoughness.roughnessFactor = metallicRoughness.roughness;
4854
5017
  }
4855
5018
  if (babylonPBRMaterial.backFaceCulling != null && !babylonPBRMaterial.backFaceCulling) {
4856
- if (!(babylonPBRMaterial.twoSidedLighting || babylonPBRMaterial.doubleSided)) {
5019
+ if (!babylonPBRMaterial._twoSidedLighting) {
4857
5020
  babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn(babylonPBRMaterial.name + ": Back-face culling enabled and two-sided lighting disabled is not supported in glTF.");
4858
5021
  }
4859
5022
  glTFMaterial.doubleSided = true;
4860
5023
  }
4861
5024
  if (hasTextureCoords) {
4862
- var bumpTexture_1 = babylonPBRMaterial.bumpTexture || babylonPBRMaterial.normalTexture;
5025
+ var bumpTexture_1 = babylonPBRMaterial._bumpTexture;
4863
5026
  if (bumpTexture_1) {
4864
5027
  var promise = this._exportTextureAsync(bumpTexture_1, mimeType).then(function (glTFTexture) {
4865
5028
  if (glTFTexture) {
@@ -4871,7 +5034,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4871
5034
  });
4872
5035
  promises.push(promise);
4873
5036
  }
4874
- var ambientTexture = babylonPBRMaterial.ambientTexture || babylonPBRMaterial.occlusionTexture;
5037
+ var ambientTexture = babylonPBRMaterial._ambientTexture;
4875
5038
  if (ambientTexture) {
4876
5039
  var promise = this._exportTextureAsync(ambientTexture, mimeType).then(function (glTFTexture) {
4877
5040
  if (glTFTexture) {
@@ -4880,7 +5043,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4880
5043
  texCoord: glTFTexture.texCoord
4881
5044
  };
4882
5045
  glTFMaterial.occlusionTexture = occlusionTexture;
4883
- var ambientTextureStrength = babylonPBRMaterial.ambientTextureStrength || babylonPBRMaterial.occlusionStrength;
5046
+ var ambientTextureStrength = babylonPBRMaterial._ambientTextureStrength;
4884
5047
  if (ambientTextureStrength) {
4885
5048
  occlusionTexture.strength = ambientTextureStrength;
4886
5049
  }
@@ -4888,7 +5051,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4888
5051
  });
4889
5052
  promises.push(promise);
4890
5053
  }
4891
- var emissiveTexture = babylonPBRMaterial.emissiveTexture || babylonPBRMaterial.emissiveTexture;
5054
+ var emissiveTexture = babylonPBRMaterial._emissiveTexture;
4892
5055
  if (emissiveTexture) {
4893
5056
  var promise = this._exportTextureAsync(emissiveTexture, mimeType).then(function (glTFTexture) {
4894
5057
  if (glTFTexture) {
@@ -4898,7 +5061,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4898
5061
  promises.push(promise);
4899
5062
  }
4900
5063
  }
4901
- var emissiveColor = babylonPBRMaterial.emissiveColor || babylonPBRMaterial.emissiveColor;
5064
+ var emissiveColor = babylonPBRMaterial._emissiveColor;
4902
5065
  if (!_GLTFMaterialExporter.FuzzyEquals(emissiveColor, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Color3"].Black(), _GLTFMaterialExporter._Epsilon)) {
4903
5066
  glTFMaterial.emissiveFactor = emissiveColor.asArray();
4904
5067
  }
@@ -5341,10 +5504,6 @@ var _GLTFUtilities = /** @class */ (function () {
5341
5504
  tangent.z /= length;
5342
5505
  }
5343
5506
  };
5344
- _GLTFUtilities._GetRightHandedMatrixFromRef = function (matrix) {
5345
- var m = matrix.m;
5346
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"].FromValuesToRef(m[0], m[1], -m[2], m[3], m[4], m[5], -m[6], m[7], -m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15], matrix);
5347
- };
5348
5507
  _GLTFUtilities._GetDataAccessorElementCount = function (accessorType) {
5349
5508
  switch (accessorType) {
5350
5509
  case "MAT2" /* MAT2 */:
@@ -5374,7 +5533,7 @@ var _GLTFUtilities = /** @class */ (function () {
5374
5533
  /*!***************************!*\
5375
5534
  !*** ./glTF/2.0/index.ts ***!
5376
5535
  \***************************/
5377
- /*! exports provided: _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_sheen, KHR_materials_unlit */
5536
+ /*! exports provided: _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_unlit */
5378
5537
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5379
5538
 
5380
5539
  "use strict";
@@ -5402,14 +5561,16 @@ __webpack_require__.r(__webpack_exports__);
5402
5561
  /* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./glTFUtilities */ "./glTF/2.0/glTFUtilities.ts");
5403
5562
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__["_GLTFUtilities"]; });
5404
5563
 
5405
- /* harmony import */ var _Extensions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Extensions */ "./glTF/2.0/Extensions/index.ts");
5406
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _Extensions__WEBPACK_IMPORTED_MODULE_7__["KHR_texture_transform"]; });
5564
+ /* harmony import */ var _Extensions_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Extensions/index */ "./glTF/2.0/Extensions/index.ts");
5565
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_7__["KHR_texture_transform"]; });
5566
+
5567
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_7__["KHR_lights_punctual"]; });
5407
5568
 
5408
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _Extensions__WEBPACK_IMPORTED_MODULE_7__["KHR_lights_punctual"]; });
5569
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_7__["KHR_materials_clearcoat"]; });
5409
5570
 
5410
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _Extensions__WEBPACK_IMPORTED_MODULE_7__["KHR_materials_sheen"]; });
5571
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_7__["KHR_materials_sheen"]; });
5411
5572
 
5412
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _Extensions__WEBPACK_IMPORTED_MODULE_7__["KHR_materials_unlit"]; });
5573
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_7__["KHR_materials_unlit"]; });
5413
5574
 
5414
5575
 
5415
5576
 
@@ -5433,12 +5594,12 @@ __webpack_require__.r(__webpack_exports__);
5433
5594
  "use strict";
5434
5595
  __webpack_require__.r(__webpack_exports__);
5435
5596
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "textureTransformPixelShader", function() { return textureTransformPixelShader; });
5436
- /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Maths/math.vector");
5437
- /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
5597
+ /* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Maths/math.vector");
5598
+ /* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
5438
5599
 
5439
5600
  var name = 'textureTransformPixelShader';
5440
- var shader = "precision highp float;\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 textureTransformMat;\nvoid main(void) {\nvec2 uvTransformed=(textureTransformMat*vec4(vUV.xy,1,1)).xy;\ngl_FragColor=texture2D(textureSampler,uvTransformed);\n}";
5441
- babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
5601
+ var shader = "precision highp float;\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 textureTransformMat;\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 uvTransformed=(textureTransformMat*vec4(vUV.xy,1,1)).xy;\ngl_FragColor=texture2D(textureSampler,uvTransformed);\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
5602
+ babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__["ShaderStore"].ShadersStore[name] = shader;
5442
5603
  /** @hidden */
5443
5604
  var textureTransformPixelShader = { name: name, shader: shader };
5444
5605
 
@@ -5465,7 +5626,7 @@ var __IGLTFExporterExtension = 0; // I am here to allow dts to be created
5465
5626
  /*!***********************!*\
5466
5627
  !*** ./glTF/index.ts ***!
5467
5628
  \***********************/
5468
- /*! exports provided: __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_sheen, KHR_materials_unlit */
5629
+ /*! exports provided: __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_unlit */
5469
5630
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5470
5631
 
5471
5632
  "use strict";
@@ -5473,30 +5634,32 @@ __webpack_require__.r(__webpack_exports__);
5473
5634
  /* harmony import */ var _glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFFileExporter */ "./glTF/glTFFileExporter.ts");
5474
5635
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtension", function() { return _glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__["__IGLTFExporterExtension"]; });
5475
5636
 
5476
- /* harmony import */ var _2_0__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./2.0 */ "./glTF/2.0/index.ts");
5477
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFAnimation", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["_GLTFAnimation"]; });
5637
+ /* harmony import */ var _2_0_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./2.0/index */ "./glTF/2.0/index.ts");
5638
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFAnimation", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["_GLTFAnimation"]; });
5478
5639
 
5479
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTFData", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["GLTFData"]; });
5640
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTFData", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["GLTFData"]; });
5480
5641
 
5481
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_Exporter", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["_Exporter"]; });
5642
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_Exporter", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["_Exporter"]; });
5482
5643
 
5483
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_BinaryWriter", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["_BinaryWriter"]; });
5644
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_BinaryWriter", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["_BinaryWriter"]; });
5484
5645
 
5485
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtensionV2", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["__IGLTFExporterExtensionV2"]; });
5646
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtensionV2", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["__IGLTFExporterExtensionV2"]; });
5486
5647
 
5487
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFMaterialExporter", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["_GLTFMaterialExporter"]; });
5648
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFMaterialExporter", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["_GLTFMaterialExporter"]; });
5488
5649
 
5489
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTF2Export", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["GLTF2Export"]; });
5650
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTF2Export", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["GLTF2Export"]; });
5490
5651
 
5491
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]; });
5652
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]; });
5492
5653
 
5493
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["KHR_texture_transform"]; });
5654
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["KHR_texture_transform"]; });
5494
5655
 
5495
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
5656
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
5496
5657
 
5497
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_sheen"]; });
5658
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_clearcoat"]; });
5498
5659
 
5499
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _2_0__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_unlit"]; });
5660
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_sheen"]; });
5661
+
5662
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _2_0_index__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_unlit"]; });
5500
5663
 
5501
5664
 
5502
5665
 
@@ -5508,43 +5671,45 @@ __webpack_require__.r(__webpack_exports__);
5508
5671
  /*!******************!*\
5509
5672
  !*** ./index.ts ***!
5510
5673
  \******************/
5511
- /*! exports provided: OBJExport, __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_sheen, KHR_materials_unlit, STLExport */
5674
+ /*! exports provided: OBJExport, __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_unlit, STLExport */
5512
5675
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5513
5676
 
5514
5677
  "use strict";
5515
5678
  __webpack_require__.r(__webpack_exports__);
5516
- /* harmony import */ var _OBJ__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OBJ */ "./OBJ/index.ts");
5517
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OBJExport", function() { return _OBJ__WEBPACK_IMPORTED_MODULE_0__["OBJExport"]; });
5679
+ /* harmony import */ var _OBJ_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OBJ/index */ "./OBJ/index.ts");
5680
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OBJExport", function() { return _OBJ_index__WEBPACK_IMPORTED_MODULE_0__["OBJExport"]; });
5681
+
5682
+ /* harmony import */ var _glTF_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTF/index */ "./glTF/index.ts");
5683
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtension", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["__IGLTFExporterExtension"]; });
5518
5684
 
5519
- /* harmony import */ var _glTF__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTF */ "./glTF/index.ts");
5520
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtension", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["__IGLTFExporterExtension"]; });
5685
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFAnimation", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["_GLTFAnimation"]; });
5521
5686
 
5522
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFAnimation", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["_GLTFAnimation"]; });
5687
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTFData", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["GLTFData"]; });
5523
5688
 
5524
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTFData", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["GLTFData"]; });
5689
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_Exporter", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["_Exporter"]; });
5525
5690
 
5526
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_Exporter", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["_Exporter"]; });
5691
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_BinaryWriter", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["_BinaryWriter"]; });
5527
5692
 
5528
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_BinaryWriter", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["_BinaryWriter"]; });
5693
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtensionV2", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["__IGLTFExporterExtensionV2"]; });
5529
5694
 
5530
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtensionV2", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["__IGLTFExporterExtensionV2"]; });
5695
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFMaterialExporter", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["_GLTFMaterialExporter"]; });
5531
5696
 
5532
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFMaterialExporter", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["_GLTFMaterialExporter"]; });
5697
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTF2Export", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["GLTF2Export"]; });
5533
5698
 
5534
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTF2Export", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["GLTF2Export"]; });
5699
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]; });
5535
5700
 
5536
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]; });
5701
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["KHR_texture_transform"]; });
5537
5702
 
5538
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["KHR_texture_transform"]; });
5703
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
5539
5704
 
5540
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
5705
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_clearcoat"]; });
5541
5706
 
5542
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_sheen"]; });
5707
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_sheen"]; });
5543
5708
 
5544
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _glTF__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_unlit"]; });
5709
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _glTF_index__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_unlit"]; });
5545
5710
 
5546
- /* harmony import */ var _stl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stl */ "./stl/index.ts");
5547
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "STLExport", function() { return _stl__WEBPACK_IMPORTED_MODULE_2__["STLExport"]; });
5711
+ /* harmony import */ var _stl_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stl/index */ "./stl/index.ts");
5712
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "STLExport", function() { return _stl_index__WEBPACK_IMPORTED_MODULE_2__["STLExport"]; });
5548
5713
 
5549
5714
 
5550
5715
 
@@ -5557,7 +5722,7 @@ __webpack_require__.r(__webpack_exports__);
5557
5722
  /*!******************************************!*\
5558
5723
  !*** ./legacy/legacy-glTF2Serializer.ts ***!
5559
5724
  \******************************************/
5560
- /*! exports provided: __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_sheen, KHR_materials_unlit */
5725
+ /*! exports provided: __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_unlit */
5561
5726
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5562
5727
 
5563
5728
  "use strict";
@@ -5565,33 +5730,35 @@ __webpack_require__.r(__webpack_exports__);
5565
5730
  /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTF/glTFFileExporter */ "./glTF/glTFFileExporter.ts");
5566
5731
  /* harmony import */ var _glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTF/2.0/glTFData */ "./glTF/2.0/glTFData.ts");
5567
5732
  /* harmony import */ var _glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../glTF/2.0/glTFSerializer */ "./glTF/2.0/glTFSerializer.ts");
5568
- /* harmony import */ var _glTF_2_0_Extensions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../glTF/2.0/Extensions */ "./glTF/2.0/Extensions/index.ts");
5569
- /* harmony import */ var _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../glTF/2.0 */ "./glTF/2.0/index.ts");
5733
+ /* harmony import */ var _glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../glTF/2.0/Extensions/index */ "./glTF/2.0/Extensions/index.ts");
5734
+ /* harmony import */ var _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../glTF/2.0/index */ "./glTF/2.0/index.ts");
5570
5735
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtension", function() { return _glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__["__IGLTFExporterExtension"]; });
5571
5736
 
5572
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFAnimation", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["_GLTFAnimation"]; });
5737
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFAnimation", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["_GLTFAnimation"]; });
5573
5738
 
5574
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTFData", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["GLTFData"]; });
5739
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTFData", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["GLTFData"]; });
5575
5740
 
5576
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_Exporter", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["_Exporter"]; });
5741
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_Exporter", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["_Exporter"]; });
5577
5742
 
5578
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_BinaryWriter", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["_BinaryWriter"]; });
5743
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_BinaryWriter", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["_BinaryWriter"]; });
5579
5744
 
5580
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtensionV2", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["__IGLTFExporterExtensionV2"]; });
5745
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtensionV2", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["__IGLTFExporterExtensionV2"]; });
5581
5746
 
5582
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFMaterialExporter", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["_GLTFMaterialExporter"]; });
5747
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFMaterialExporter", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["_GLTFMaterialExporter"]; });
5583
5748
 
5584
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTF2Export", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["GLTF2Export"]; });
5749
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GLTF2Export", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["GLTF2Export"]; });
5585
5750
 
5586
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["_GLTFUtilities"]; });
5751
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["_GLTFUtilities"]; });
5587
5752
 
5588
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["KHR_texture_transform"]; });
5753
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_texture_transform", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["KHR_texture_transform"]; });
5589
5754
 
5590
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["KHR_lights_punctual"]; });
5755
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["KHR_lights_punctual"]; });
5591
5756
 
5592
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["KHR_materials_sheen"]; });
5757
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["KHR_materials_clearcoat"]; });
5593
5758
 
5594
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__["KHR_materials_unlit"]; });
5759
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["KHR_materials_sheen"]; });
5760
+
5761
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__["KHR_materials_unlit"]; });
5595
5762
 
5596
5763
 
5597
5764
 
@@ -5622,16 +5789,16 @@ if (typeof globalObject !== "undefined") {
5622
5789
  BABYLON[key] = _glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__[key];
5623
5790
  keys.push(key);
5624
5791
  }
5625
- for (var key in _glTF_2_0_Extensions__WEBPACK_IMPORTED_MODULE_3__) {
5626
- BABYLON.GLTF2.Exporter.Extensions[key] = _glTF_2_0_Extensions__WEBPACK_IMPORTED_MODULE_3__[key];
5792
+ for (var key in _glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__) {
5793
+ BABYLON.GLTF2.Exporter.Extensions[key] = _glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__[key];
5627
5794
  keys.push(key);
5628
5795
  }
5629
- for (var key in _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__) {
5796
+ for (var key in _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__) {
5630
5797
  // Prevent Reassignment.
5631
5798
  if (keys.indexOf(key) > -1) {
5632
5799
  continue;
5633
5800
  }
5634
- BABYLON.GLTF2.Exporter[key] = _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__[key];
5801
+ BABYLON.GLTF2.Exporter[key] = _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__[key];
5635
5802
  }
5636
5803
  }
5637
5804
 
@@ -5650,8 +5817,8 @@ if (typeof globalObject !== "undefined") {
5650
5817
 
5651
5818
  "use strict";
5652
5819
  __webpack_require__.r(__webpack_exports__);
5653
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _OBJ__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../OBJ */ "./OBJ/index.ts");
5654
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OBJExport", function() { return _OBJ__WEBPACK_IMPORTED_MODULE_0__["OBJExport"]; });
5820
+ /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _OBJ_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../OBJ/index */ "./OBJ/index.ts");
5821
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OBJExport", function() { return _OBJ_index__WEBPACK_IMPORTED_MODULE_0__["OBJExport"]; });
5655
5822
 
5656
5823
 
5657
5824
  /**
@@ -5660,8 +5827,8 @@ __webpack_require__.r(__webpack_exports__);
5660
5827
  */
5661
5828
  var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
5662
5829
  if (typeof globalObject !== "undefined") {
5663
- for (var serializer in _OBJ__WEBPACK_IMPORTED_MODULE_0__) {
5664
- globalObject.BABYLON[serializer] = _OBJ__WEBPACK_IMPORTED_MODULE_0__[serializer];
5830
+ for (var serializer in _OBJ_index__WEBPACK_IMPORTED_MODULE_0__) {
5831
+ globalObject.BABYLON[serializer] = _OBJ_index__WEBPACK_IMPORTED_MODULE_0__[serializer];
5665
5832
  }
5666
5833
  }
5667
5834
 
@@ -5679,8 +5846,8 @@ if (typeof globalObject !== "undefined") {
5679
5846
 
5680
5847
  "use strict";
5681
5848
  __webpack_require__.r(__webpack_exports__);
5682
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _stl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../stl */ "./stl/index.ts");
5683
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "STLExport", function() { return _stl__WEBPACK_IMPORTED_MODULE_0__["STLExport"]; });
5849
+ /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _stl_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../stl/index */ "./stl/index.ts");
5850
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "STLExport", function() { return _stl_index__WEBPACK_IMPORTED_MODULE_0__["STLExport"]; });
5684
5851
 
5685
5852
 
5686
5853
  /**
@@ -5689,8 +5856,8 @@ __webpack_require__.r(__webpack_exports__);
5689
5856
  */
5690
5857
  var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
5691
5858
  if (typeof globalObject !== "undefined") {
5692
- for (var serializer in _stl__WEBPACK_IMPORTED_MODULE_0__) {
5693
- globalObject.BABYLON[serializer] = _stl__WEBPACK_IMPORTED_MODULE_0__[serializer];
5859
+ for (var serializer in _stl_index__WEBPACK_IMPORTED_MODULE_0__) {
5860
+ globalObject.BABYLON[serializer] = _stl_index__WEBPACK_IMPORTED_MODULE_0__[serializer];
5694
5861
  }
5695
5862
  }
5696
5863
 
@@ -5703,7 +5870,7 @@ if (typeof globalObject !== "undefined") {
5703
5870
  /*!**************************!*\
5704
5871
  !*** ./legacy/legacy.ts ***!
5705
5872
  \**************************/
5706
- /*! exports provided: __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_sheen, KHR_materials_unlit, OBJExport, STLExport */
5873
+ /*! exports provided: __IGLTFExporterExtension, _GLTFAnimation, GLTFData, _Exporter, _BinaryWriter, __IGLTFExporterExtensionV2, _GLTFMaterialExporter, GLTF2Export, _GLTFUtilities, KHR_texture_transform, KHR_lights_punctual, KHR_materials_clearcoat, KHR_materials_sheen, KHR_materials_unlit, OBJExport, STLExport */
5707
5874
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5708
5875
 
5709
5876
  "use strict";
@@ -5732,6 +5899,8 @@ __webpack_require__.r(__webpack_exports__);
5732
5899
 
5733
5900
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
5734
5901
 
5902
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_clearcoat", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_clearcoat"]; });
5903
+
5735
5904
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_sheen"]; });
5736
5905
 
5737
5906
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_unlit"]; });
@@ -5777,8 +5946,8 @@ __webpack_require__.r(__webpack_exports__);
5777
5946
  "use strict";
5778
5947
  __webpack_require__.r(__webpack_exports__);
5779
5948
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STLExport", function() { return STLExport; });
5780
- /* harmony import */ var babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Meshes/buffer */ "babylonjs/Maths/math.vector");
5781
- /* harmony import */ var babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__);
5949
+ /* harmony import */ var babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Buffers/buffer */ "babylonjs/Maths/math.vector");
5950
+ /* harmony import */ var babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__);
5782
5951
 
5783
5952
 
5784
5953
  /**
@@ -5807,13 +5976,13 @@ var STLExport = /** @class */ (function () {
5807
5976
  var getFaceData = function (indices, vertices, i) {
5808
5977
  var id = [indices[i] * 3, indices[i + 1] * 3, indices[i + 2] * 3];
5809
5978
  var v = [
5810
- new babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[0]], vertices[id[0] + 2], vertices[id[0] + 1]),
5811
- new babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[1]], vertices[id[1] + 2], vertices[id[1] + 1]),
5812
- new babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[2]], vertices[id[2] + 2], vertices[id[2] + 1])
5979
+ new babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[0]], vertices[id[0] + 2], vertices[id[0] + 1]),
5980
+ new babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[1]], vertices[id[1] + 2], vertices[id[1] + 1]),
5981
+ new babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[2]], vertices[id[2] + 2], vertices[id[2] + 1])
5813
5982
  ];
5814
5983
  var p1p2 = v[0].subtract(v[1]);
5815
5984
  var p3p2 = v[2].subtract(v[1]);
5816
- var n = (babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Cross(p3p2, p1p2)).normalize();
5985
+ var n = (babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Cross(p3p2, p1p2)).normalize();
5817
5986
  return { v: v, n: n };
5818
5987
  };
5819
5988
  var writeVector = function (dataview, offset, vector, isLittleEndian) {
@@ -5849,7 +6018,7 @@ var STLExport = /** @class */ (function () {
5849
6018
  if (!doNotBakeTransform) {
5850
6019
  mesh.bakeCurrentTransformIntoVertices();
5851
6020
  }
5852
- var vertices = mesh.getVerticesData(babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["VertexBuffer"].PositionKind) || [];
6021
+ var vertices = mesh.getVerticesData(babylonjs_Buffers_buffer__WEBPACK_IMPORTED_MODULE_0__["VertexBuffer"].PositionKind) || [];
5853
6022
  var indices = mesh.getIndices() || [];
5854
6023
  for (var i_1 = 0; i_1 < indices.length; i_1 += 3) {
5855
6024
  var fd = getFaceData(indices, vertices, i_1);