babylonjs-serializers 5.0.0-alpha.6 → 5.0.0-alpha.63

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:/Dev/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, __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; });
@@ -147,11 +148,13 @@ PERFORMANCE OF THIS SOFTWARE.
147
148
  var extendStatics = function(d, b) {
148
149
  extendStatics = Object.setPrototypeOf ||
149
150
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
150
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
151
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
151
152
  return extendStatics(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 __());
@@ -241,8 +244,8 @@ var __createBinding = Object.create ? (function(o, m, k, k2) {
241
244
  o[k2] = m[k];
242
245
  });
243
246
 
244
- function __exportStar(m, exports) {
245
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
247
+ function __exportStar(m, o) {
248
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
246
249
  }
247
250
 
248
251
  function __values(o) {
@@ -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);
@@ -332,7 +347,7 @@ var __setModuleDefault = Object.create ? (function(o, v) {
332
347
  function __importStar(mod) {
333
348
  if (mod && mod.__esModule) return mod;
334
349
  var result = {};
335
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
350
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
336
351
  __setModuleDefault(result, mod);
337
352
  return result;
338
353
  }
@@ -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
  }
@@ -4909,7 +5072,6 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4909
5072
  return this._finishMaterial(promises, glTFMaterial, babylonPBRMaterial, mimeType);
4910
5073
  };
4911
5074
  _GLTFMaterialExporter.prototype.getPixelsFromTexture = function (babylonTexture) {
4912
- // TODO WEBGPU remove the as unknown cast once using the new babylonjs package to compile the glTF material exporter
4913
5075
  var pixels = babylonTexture.textureType === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURETYPE_UNSIGNED_INT ? babylonTexture.readPixels() : babylonTexture.readPixels();
4914
5076
  return pixels;
4915
5077
  };
@@ -5342,10 +5504,6 @@ var _GLTFUtilities = /** @class */ (function () {
5342
5504
  tangent.z /= length;
5343
5505
  }
5344
5506
  };
5345
- _GLTFUtilities._GetRightHandedMatrixFromRef = function (matrix) {
5346
- var m = matrix.m;
5347
- 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);
5348
- };
5349
5507
  _GLTFUtilities._GetDataAccessorElementCount = function (accessorType) {
5350
5508
  switch (accessorType) {
5351
5509
  case "MAT2" /* MAT2 */:
@@ -5375,7 +5533,7 @@ var _GLTFUtilities = /** @class */ (function () {
5375
5533
  /*!***************************!*\
5376
5534
  !*** ./glTF/2.0/index.ts ***!
5377
5535
  \***************************/
5378
- /*! 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 */
5379
5537
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5380
5538
 
5381
5539
  "use strict";
@@ -5403,14 +5561,16 @@ __webpack_require__.r(__webpack_exports__);
5403
5561
  /* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./glTFUtilities */ "./glTF/2.0/glTFUtilities.ts");
5404
5562
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_GLTFUtilities", function() { return _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__["_GLTFUtilities"]; });
5405
5563
 
5406
- /* harmony import */ var _Extensions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Extensions */ "./glTF/2.0/Extensions/index.ts");
5407
- /* 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"]; });
5408
5568
 
5409
- /* 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"]; });
5410
5570
 
5411
- /* 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"]; });
5412
5572
 
5413
- /* 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"]; });
5414
5574
 
5415
5575
 
5416
5576
 
@@ -5434,12 +5594,12 @@ __webpack_require__.r(__webpack_exports__);
5434
5594
  "use strict";
5435
5595
  __webpack_require__.r(__webpack_exports__);
5436
5596
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "textureTransformPixelShader", function() { return textureTransformPixelShader; });
5437
- /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Maths/math.vector");
5438
- /* 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__);
5439
5599
 
5440
5600
  var name = 'textureTransformPixelShader';
5441
5601
  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}";
5442
- babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
5602
+ babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__["ShaderStore"].ShadersStore[name] = shader;
5443
5603
  /** @hidden */
5444
5604
  var textureTransformPixelShader = { name: name, shader: shader };
5445
5605
 
@@ -5466,7 +5626,7 @@ var __IGLTFExporterExtension = 0; // I am here to allow dts to be created
5466
5626
  /*!***********************!*\
5467
5627
  !*** ./glTF/index.ts ***!
5468
5628
  \***********************/
5469
- /*! 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 */
5470
5630
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5471
5631
 
5472
5632
  "use strict";
@@ -5474,30 +5634,32 @@ __webpack_require__.r(__webpack_exports__);
5474
5634
  /* harmony import */ var _glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFFileExporter */ "./glTF/glTFFileExporter.ts");
5475
5635
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtension", function() { return _glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__["__IGLTFExporterExtension"]; });
5476
5636
 
5477
- /* harmony import */ var _2_0__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./2.0 */ "./glTF/2.0/index.ts");
5478
- /* 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"]; });
5479
5639
 
5480
- /* 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"]; });
5481
5641
 
5482
- /* 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"]; });
5483
5643
 
5484
- /* 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"]; });
5485
5645
 
5486
- /* 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"]; });
5487
5647
 
5488
- /* 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"]; });
5489
5649
 
5490
- /* 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"]; });
5491
5651
 
5492
- /* 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"]; });
5493
5653
 
5494
- /* 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"]; });
5495
5655
 
5496
- /* 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"]; });
5497
5657
 
5498
- /* 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"]; });
5499
5659
 
5500
- /* 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"]; });
5501
5663
 
5502
5664
 
5503
5665
 
@@ -5509,43 +5671,45 @@ __webpack_require__.r(__webpack_exports__);
5509
5671
  /*!******************!*\
5510
5672
  !*** ./index.ts ***!
5511
5673
  \******************/
5512
- /*! 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 */
5513
5675
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5514
5676
 
5515
5677
  "use strict";
5516
5678
  __webpack_require__.r(__webpack_exports__);
5517
- /* harmony import */ var _OBJ__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OBJ */ "./OBJ/index.ts");
5518
- /* 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"]; });
5519
5684
 
5520
- /* harmony import */ var _glTF__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTF */ "./glTF/index.ts");
5521
- /* 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"]; });
5522
5686
 
5523
- /* 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"]; });
5524
5688
 
5525
- /* 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"]; });
5526
5690
 
5527
- /* 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"]; });
5528
5692
 
5529
- /* 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"]; });
5530
5694
 
5531
- /* 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"]; });
5532
5696
 
5533
- /* 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"]; });
5534
5698
 
5535
- /* 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"]; });
5536
5700
 
5537
- /* 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"]; });
5538
5702
 
5539
- /* 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"]; });
5540
5704
 
5541
- /* 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"]; });
5542
5706
 
5543
- /* 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"]; });
5544
5708
 
5545
- /* 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"]; });
5546
5710
 
5547
- /* harmony import */ var _stl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stl */ "./stl/index.ts");
5548
- /* 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"]; });
5549
5713
 
5550
5714
 
5551
5715
 
@@ -5558,7 +5722,7 @@ __webpack_require__.r(__webpack_exports__);
5558
5722
  /*!******************************************!*\
5559
5723
  !*** ./legacy/legacy-glTF2Serializer.ts ***!
5560
5724
  \******************************************/
5561
- /*! 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 */
5562
5726
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5563
5727
 
5564
5728
  "use strict";
@@ -5566,33 +5730,35 @@ __webpack_require__.r(__webpack_exports__);
5566
5730
  /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTF/glTFFileExporter */ "./glTF/glTFFileExporter.ts");
5567
5731
  /* harmony import */ var _glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTF/2.0/glTFData */ "./glTF/2.0/glTFData.ts");
5568
5732
  /* harmony import */ var _glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../glTF/2.0/glTFSerializer */ "./glTF/2.0/glTFSerializer.ts");
5569
- /* harmony import */ var _glTF_2_0_Extensions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../glTF/2.0/Extensions */ "./glTF/2.0/Extensions/index.ts");
5570
- /* 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");
5571
5735
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "__IGLTFExporterExtension", function() { return _glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__["__IGLTFExporterExtension"]; });
5572
5736
 
5573
- /* 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"]; });
5574
5738
 
5575
- /* 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"]; });
5576
5740
 
5577
- /* 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"]; });
5578
5742
 
5579
- /* 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"]; });
5580
5744
 
5581
- /* 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"]; });
5582
5746
 
5583
- /* 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"]; });
5584
5748
 
5585
- /* 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"]; });
5586
5750
 
5587
- /* 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"]; });
5588
5752
 
5589
- /* 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"]; });
5590
5754
 
5591
- /* 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"]; });
5592
5756
 
5593
- /* 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"]; });
5594
5758
 
5595
- /* 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"]; });
5596
5762
 
5597
5763
 
5598
5764
 
@@ -5623,16 +5789,16 @@ if (typeof globalObject !== "undefined") {
5623
5789
  BABYLON[key] = _glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__[key];
5624
5790
  keys.push(key);
5625
5791
  }
5626
- for (var key in _glTF_2_0_Extensions__WEBPACK_IMPORTED_MODULE_3__) {
5627
- 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];
5628
5794
  keys.push(key);
5629
5795
  }
5630
- for (var key in _glTF_2_0__WEBPACK_IMPORTED_MODULE_4__) {
5796
+ for (var key in _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__) {
5631
5797
  // Prevent Reassignment.
5632
5798
  if (keys.indexOf(key) > -1) {
5633
5799
  continue;
5634
5800
  }
5635
- 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];
5636
5802
  }
5637
5803
  }
5638
5804
 
@@ -5651,8 +5817,8 @@ if (typeof globalObject !== "undefined") {
5651
5817
 
5652
5818
  "use strict";
5653
5819
  __webpack_require__.r(__webpack_exports__);
5654
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _OBJ__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../OBJ */ "./OBJ/index.ts");
5655
- /* 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"]; });
5656
5822
 
5657
5823
 
5658
5824
  /**
@@ -5661,8 +5827,8 @@ __webpack_require__.r(__webpack_exports__);
5661
5827
  */
5662
5828
  var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
5663
5829
  if (typeof globalObject !== "undefined") {
5664
- for (var serializer in _OBJ__WEBPACK_IMPORTED_MODULE_0__) {
5665
- 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];
5666
5832
  }
5667
5833
  }
5668
5834
 
@@ -5680,8 +5846,8 @@ if (typeof globalObject !== "undefined") {
5680
5846
 
5681
5847
  "use strict";
5682
5848
  __webpack_require__.r(__webpack_exports__);
5683
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _stl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../stl */ "./stl/index.ts");
5684
- /* 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"]; });
5685
5851
 
5686
5852
 
5687
5853
  /**
@@ -5690,8 +5856,8 @@ __webpack_require__.r(__webpack_exports__);
5690
5856
  */
5691
5857
  var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
5692
5858
  if (typeof globalObject !== "undefined") {
5693
- for (var serializer in _stl__WEBPACK_IMPORTED_MODULE_0__) {
5694
- 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];
5695
5861
  }
5696
5862
  }
5697
5863
 
@@ -5704,7 +5870,7 @@ if (typeof globalObject !== "undefined") {
5704
5870
  /*!**************************!*\
5705
5871
  !*** ./legacy/legacy.ts ***!
5706
5872
  \**************************/
5707
- /*! 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 */
5708
5874
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5709
5875
 
5710
5876
  "use strict";
@@ -5733,6 +5899,8 @@ __webpack_require__.r(__webpack_exports__);
5733
5899
 
5734
5900
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_lights_punctual", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_lights_punctual"]; });
5735
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
+
5736
5904
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_sheen", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_sheen"]; });
5737
5905
 
5738
5906
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KHR_materials_unlit", function() { return _legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_1__["KHR_materials_unlit"]; });
@@ -5778,8 +5946,8 @@ __webpack_require__.r(__webpack_exports__);
5778
5946
  "use strict";
5779
5947
  __webpack_require__.r(__webpack_exports__);
5780
5948
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STLExport", function() { return STLExport; });
5781
- /* harmony import */ var babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Meshes/buffer */ "babylonjs/Maths/math.vector");
5782
- /* 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__);
5783
5951
 
5784
5952
 
5785
5953
  /**
@@ -5808,13 +5976,13 @@ var STLExport = /** @class */ (function () {
5808
5976
  var getFaceData = function (indices, vertices, i) {
5809
5977
  var id = [indices[i] * 3, indices[i + 1] * 3, indices[i + 2] * 3];
5810
5978
  var v = [
5811
- new babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[0]], vertices[id[0] + 2], vertices[id[0] + 1]),
5812
- new babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[1]], vertices[id[1] + 2], vertices[id[1] + 1]),
5813
- 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])
5814
5982
  ];
5815
5983
  var p1p2 = v[0].subtract(v[1]);
5816
5984
  var p3p2 = v[2].subtract(v[1]);
5817
- 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();
5818
5986
  return { v: v, n: n };
5819
5987
  };
5820
5988
  var writeVector = function (dataview, offset, vector, isLittleEndian) {
@@ -5850,7 +6018,7 @@ var STLExport = /** @class */ (function () {
5850
6018
  if (!doNotBakeTransform) {
5851
6019
  mesh.bakeCurrentTransformIntoVertices();
5852
6020
  }
5853
- 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) || [];
5854
6022
  var indices = mesh.getIndices() || [];
5855
6023
  for (var i_1 = 0; i_1 < indices.length; i_1 += 3) {
5856
6024
  var fd = getFaceData(indices, vertices, i_1);