babylonjs-serializers 5.0.0-beta.1 → 5.0.0-beta.12

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,9 +97,9 @@ return /******/ (function(modules) { // webpackBootstrap
97
97
  /******/ ({
98
98
 
99
99
  /***/ "../../node_modules/tslib/tslib.es6.js":
100
- /*!*************************************************************!*\
101
- !*** E:/Babylon/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
- \*************************************************************/
100
+ /*!************************************************************************************!*\
101
+ !*** C:/Users/raweber/Documents/GitHub/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
+ \************************************************************************************/
103
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
 
@@ -664,7 +664,7 @@ var KHR_lights_punctual = /** @class */ (function () {
664
664
  var light = void 0;
665
665
  var lightType = (babylonLight.getTypeID() == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Light"].LIGHTTYPEID_POINTLIGHT ? "point" /* POINT */ : (babylonLight.getTypeID() == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Light"].LIGHTTYPEID_DIRECTIONALLIGHT ? "directional" /* DIRECTIONAL */ : (babylonLight.getTypeID() == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Light"].LIGHTTYPEID_SPOTLIGHT ? "spot" /* SPOT */ : null)));
666
666
  if (lightType == null) {
667
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Logger"].Warn(context + ": Light " + babylonLight.name + " is not supported in " + NAME);
667
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Logger"].Warn("".concat(context, ": Light ").concat(babylonLight.name, " is not supported in ").concat(NAME));
668
668
  }
669
669
  else {
670
670
  var lightPosition = babylonLight.position.clone();
@@ -689,7 +689,7 @@ var KHR_lights_punctual = /** @class */ (function () {
689
689
  }
690
690
  }
691
691
  if (babylonLight.falloffType !== babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Light"].FALLOFF_GLTF) {
692
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Logger"].Warn(context + ": Light falloff for " + babylonLight.name + " does not match the " + NAME + " specification!");
692
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Logger"].Warn("".concat(context, ": Light falloff for ").concat(babylonLight.name, " does not match the ").concat(NAME, " specification!"));
693
693
  }
694
694
  light = {
695
695
  type: lightType
@@ -864,10 +864,10 @@ var KHR_materials_clearcoat = /** @class */ (function () {
864
864
  clearCoatTextureRoughnessInfo = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.textureRoughness);
865
865
  }
866
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);
867
+ babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Clear Color tint is not supported for glTF export. Ignoring for: ".concat(babylonMaterial.name));
868
868
  }
869
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);
870
+ babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Clear Color F0 remapping is not supported for glTF export. Ignoring for: ".concat(babylonMaterial.name));
871
871
  }
872
872
  var clearCoatNormalTextureInfo = _this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.bumpTexture);
873
873
  var clearCoatInfo_1 = {
@@ -1135,7 +1135,7 @@ var KHR_texture_transform = /** @class */ (function () {
1135
1135
  return new Promise(function (resolve, reject) {
1136
1136
  var scene = babylonTexture.getScene();
1137
1137
  if (!scene) {
1138
- reject(context + ": \"scene\" is not defined for Babylon texture " + babylonTexture.name + "!");
1138
+ reject("".concat(context, ": \"scene\" is not defined for Babylon texture ").concat(babylonTexture.name, "!"));
1139
1139
  return;
1140
1140
  }
1141
1141
  var bakeTextureTransform = false;
@@ -1171,9 +1171,9 @@ var KHR_texture_transform = /** @class */ (function () {
1171
1171
  KHR_texture_transform.prototype._textureTransformTextureAsync = function (babylonTexture, scene) {
1172
1172
  var _this = this;
1173
1173
  return new Promise(function (resolve) {
1174
- var proceduralTexture = new babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__["ProceduralTexture"]("" + babylonTexture.name, babylonTexture.getSize(), "textureTransform", scene);
1174
+ var proceduralTexture = new babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__["ProceduralTexture"]("".concat(babylonTexture.name), babylonTexture.getSize(), "textureTransform", scene);
1175
1175
  if (!proceduralTexture) {
1176
- babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__["Tools"].Log("Cannot create procedural texture for " + babylonTexture.name + "!");
1176
+ babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__["Tools"].Log("Cannot create procedural texture for ".concat(babylonTexture.name, "!"));
1177
1177
  resolve(babylonTexture);
1178
1178
  }
1179
1179
  proceduralTexture.reservedDataStore = {
@@ -1358,7 +1358,7 @@ var _GLTFAnimation = /** @class */ (function () {
1358
1358
  break;
1359
1359
  }
1360
1360
  default: {
1361
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Tools"].Error("Unsupported animatable property " + property[0]);
1361
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Tools"].Error("Unsupported animatable property ".concat(property[0]));
1362
1362
  }
1363
1363
  }
1364
1364
  if (animationChannelTargetPath) {
@@ -1396,7 +1396,7 @@ var _GLTFAnimation = /** @class */ (function () {
1396
1396
  samplers: [],
1397
1397
  channels: []
1398
1398
  };
1399
- _GLTFAnimation.AddAnimation("" + animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
1399
+ _GLTFAnimation.AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
1400
1400
  if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
1401
1401
  idleGLTFAnimations.push(glTFAnimation);
1402
1402
  }
@@ -1428,7 +1428,7 @@ var _GLTFAnimation = /** @class */ (function () {
1428
1428
  var morphTarget = morphTargetManager.getTarget(i);
1429
1429
  for (var _i = 0, _a = morphTarget.animations; _i < _a.length; _i++) {
1430
1430
  var animation = _a[_i];
1431
- var combinedAnimation = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Animation"]("" + animation.name, "influence", animation.framePerSecond, animation.dataType, animation.loopMode, animation.enableBlending);
1431
+ var combinedAnimation = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Animation"]("".concat(animation.name), "influence", animation.framePerSecond, animation.dataType, animation.loopMode, animation.enableBlending);
1432
1432
  var combinedAnimationKeys = [];
1433
1433
  var animationKeys = animation.getKeys();
1434
1434
  for (var j = 0; j < animationKeys.length; ++j) {
@@ -1497,7 +1497,7 @@ var _GLTFAnimation = /** @class */ (function () {
1497
1497
  if (animationInfo) {
1498
1498
  var babylonTransformNode = target instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["TransformNode"] ? target : target[0];
1499
1499
  var convertToRightHandedSystem = convertToRightHandedSystemMap[babylonTransformNode.uniqueId];
1500
- _GLTFAnimation.AddAnimation("" + animation.name, glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
1500
+ _GLTFAnimation.AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
1501
1501
  }
1502
1502
  }
1503
1503
  else if (target instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"] || target.length === 1 && target[0] instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"]) {
@@ -1557,7 +1557,7 @@ var _GLTFAnimation = /** @class */ (function () {
1557
1557
  var morphTargetAnimation = animationsByMorphTarget.get(morphTarget);
1558
1558
  if (morphTargetAnimation) {
1559
1559
  if (!combinedAnimationGroup) {
1560
- combinedAnimationGroup = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Animation"](animationGroup.name + "_" + mesh.name + "_MorphWeightAnimation", "influence", morphTargetAnimation.framePerSecond, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_FLOAT, morphTargetAnimation.loopMode, morphTargetAnimation.enableBlending);
1560
+ combinedAnimationGroup = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Animation"]("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), "influence", morphTargetAnimation.framePerSecond, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_FLOAT, morphTargetAnimation.loopMode, morphTargetAnimation.enableBlending);
1561
1561
  }
1562
1562
  animationKeys.push(morphTargetAnimation.getKeys()[i]);
1563
1563
  }
@@ -1575,7 +1575,7 @@ var _GLTFAnimation = /** @class */ (function () {
1575
1575
  combinedAnimationGroup.setKeys(animationKeys);
1576
1576
  var animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
1577
1577
  if (animationInfo) {
1578
- _GLTFAnimation.AddAnimation(animationGroup.name + "_" + mesh.name + "_MorphWeightAnimation", glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, false, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
1578
+ _GLTFAnimation.AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, false, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
1579
1579
  }
1580
1580
  });
1581
1581
  if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {
@@ -1619,26 +1619,26 @@ var _GLTFAnimation = /** @class */ (function () {
1619
1619
  var nodeIndex = nodeMap[babylonTransformNode.uniqueId];
1620
1620
  // Creates buffer view and accessor for key frames.
1621
1621
  var byteLength = animationData.inputs.length * 4;
1622
- bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, name + " keyframe data view");
1622
+ bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, "".concat(name, " keyframe data view"));
1623
1623
  bufferViews.push(bufferView);
1624
1624
  animationData.inputs.forEach(function (input) {
1625
1625
  binaryWriter.setFloat32(input);
1626
1626
  });
1627
- accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateAccessor(bufferViews.length - 1, name + " keyframes", "SCALAR" /* SCALAR */, 5126 /* FLOAT */, animationData.inputs.length, null, [animationData.inputsMin], [animationData.inputsMax]);
1627
+ accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateAccessor(bufferViews.length - 1, "".concat(name, " keyframes"), "SCALAR" /* SCALAR */, 5126 /* FLOAT */, animationData.inputs.length, null, [animationData.inputsMin], [animationData.inputsMax]);
1628
1628
  accessors.push(accessor);
1629
1629
  keyframeAccessorIndex = accessors.length - 1;
1630
1630
  // create bufferview and accessor for keyed values.
1631
1631
  outputLength = animationData.outputs.length;
1632
1632
  byteLength = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._GetDataAccessorElementCount(dataAccessorType) * 4 * animationData.outputs.length;
1633
1633
  // check for in and out tangents
1634
- bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, name + " data view");
1634
+ bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, "".concat(name, " data view"));
1635
1635
  bufferViews.push(bufferView);
1636
1636
  animationData.outputs.forEach(function (output) {
1637
1637
  output.forEach(function (entry) {
1638
1638
  binaryWriter.setFloat32(entry);
1639
1639
  });
1640
1640
  });
1641
- accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateAccessor(bufferViews.length - 1, name + " data", dataAccessorType, 5126 /* FLOAT */, outputLength, null, null, null);
1641
+ accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__["_GLTFUtilities"]._CreateAccessor(bufferViews.length - 1, "".concat(name, " data"), dataAccessorType, 5126 /* FLOAT */, outputLength, null, null, null);
1642
1642
  accessors.push(accessor);
1643
1643
  dataAccessorIndex = accessors.length - 1;
1644
1644
  // create sampler
@@ -1760,7 +1760,7 @@ var _GLTFAnimation = /** @class */ (function () {
1760
1760
  break;
1761
1761
  }
1762
1762
  default: {
1763
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Tools"].Error("glTFAnimation: Unsupported component type \"" + componentName + "\" for scale animation!");
1763
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Tools"].Error("glTFAnimation: Unsupported component type \"".concat(componentName, "\" for scale animation!"));
1764
1764
  }
1765
1765
  }
1766
1766
  }
@@ -2192,6 +2192,8 @@ __webpack_require__.r(__webpack_exports__);
2192
2192
 
2193
2193
 
2194
2194
 
2195
+
2196
+
2195
2197
  /**
2196
2198
  * Converts Babylon Scene into glTF 2.0.
2197
2199
  * @hidden
@@ -2211,11 +2213,16 @@ var _Exporter = /** @class */ (function () {
2211
2213
  this._glTF = {
2212
2214
  asset: { generator: "BabylonJS", version: "2.0" }
2213
2215
  };
2216
+ babylonScene = babylonScene || babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["EngineStore"].LastCreatedScene;
2217
+ if (!babylonScene) {
2218
+ return;
2219
+ }
2214
2220
  this._babylonScene = babylonScene;
2215
2221
  this._bufferViews = [];
2216
2222
  this._accessors = [];
2217
2223
  this._meshes = [];
2218
2224
  this._scenes = [];
2225
+ this._cameras = [];
2219
2226
  this._nodes = [];
2220
2227
  this._images = [];
2221
2228
  this._materials = [];
@@ -2342,7 +2349,7 @@ var _Exporter = /** @class */ (function () {
2342
2349
  */
2343
2350
  _Exporter.RegisterExtension = function (name, factory) {
2344
2351
  if (_Exporter.UnregisterExtension(name)) {
2345
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Extension with the name " + name + " already exists");
2352
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Extension with the name ".concat(name, " already exists"));
2346
2353
  }
2347
2354
  _Exporter._ExtensionFactories[name] = factory;
2348
2355
  _Exporter._ExtensionNames.push(name);
@@ -2495,14 +2502,14 @@ var _Exporter = /** @class */ (function () {
2495
2502
  break;
2496
2503
  }
2497
2504
  default: {
2498
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
2505
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
2499
2506
  }
2500
2507
  }
2501
2508
  this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
2502
2509
  }
2503
2510
  }
2504
2511
  else {
2505
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFillMode: Vertex Buffer Kind " + vertexBufferKind + " not present!");
2512
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFillMode: Vertex Buffer Kind ".concat(vertexBufferKind, " not present!"));
2506
2513
  }
2507
2514
  };
2508
2515
  /**
@@ -2554,13 +2561,13 @@ var _Exporter = /** @class */ (function () {
2554
2561
  break;
2555
2562
  }
2556
2563
  default: {
2557
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
2564
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
2558
2565
  }
2559
2566
  }
2560
2567
  this.writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
2561
2568
  }
2562
2569
  else {
2563
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleStripDrawMode: Vertex buffer kind " + vertexBufferKind + " not present!");
2570
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleStripDrawMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
2564
2571
  }
2565
2572
  };
2566
2573
  /**
@@ -2614,13 +2621,13 @@ var _Exporter = /** @class */ (function () {
2614
2621
  break;
2615
2622
  }
2616
2623
  default: {
2617
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: " + vertexBufferKind);
2624
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
2618
2625
  }
2619
2626
  }
2620
2627
  this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
2621
2628
  }
2622
2629
  else {
2623
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFanMode: Vertex buffer kind " + vertexBufferKind + " not present!");
2630
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFanMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
2624
2631
  }
2625
2632
  };
2626
2633
  /**
@@ -2919,6 +2926,9 @@ var _Exporter = /** @class */ (function () {
2919
2926
  this._glTF.scenes = this._scenes;
2920
2927
  this._glTF.scene = 0;
2921
2928
  }
2929
+ if (this._cameras && this._cameras.length) {
2930
+ this._glTF.cameras = this._cameras;
2931
+ }
2922
2932
  if (this._bufferViews && this._bufferViews.length) {
2923
2933
  this._glTF.bufferViews = this._bufferViews;
2924
2934
  }
@@ -3145,7 +3155,19 @@ var _Exporter = /** @class */ (function () {
3145
3155
  if (babylonTransformNode.rotationQuaternion) {
3146
3156
  rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
3147
3157
  }
3148
- if (!(rotationQuaternion.x === 0 && rotationQuaternion.y === 0 && rotationQuaternion.z === 0 && rotationQuaternion.w === 1)) {
3158
+ if (!babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Quaternion"].IsIdentity(rotationQuaternion)) {
3159
+ if (convertToRightHandedSystem) {
3160
+ _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(rotationQuaternion);
3161
+ }
3162
+ node.rotation = rotationQuaternion.normalize().asArray();
3163
+ }
3164
+ };
3165
+ _Exporter.prototype.setCameraTransformation = function (node, babylonCamera, convertToRightHandedSystem) {
3166
+ if (!babylonCamera.position.equalsToFloats(0, 0, 0)) {
3167
+ node.translation = convertToRightHandedSystem ? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedPositionVector3(babylonCamera.position).asArray() : babylonCamera.position.asArray();
3168
+ }
3169
+ var rotationQuaternion = babylonCamera.absoluteRotation;
3170
+ if (!babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Quaternion"].IsIdentity(rotationQuaternion)) {
3149
3171
  if (convertToRightHandedSystem) {
3150
3172
  _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(rotationQuaternion);
3151
3173
  }
@@ -3566,7 +3588,7 @@ var _Exporter = /** @class */ (function () {
3566
3588
  var glTFNodeIndex;
3567
3589
  var glTFNode;
3568
3590
  var directDescendents;
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);
3591
+ var nodes = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArray"])(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), babylonScene.cameras, true);
3570
3592
  var rootNodesToLeftHanded = [];
3571
3593
  this._convertToRightHandedSystem = !babylonScene.useRightHandedSystem;
3572
3594
  this._convertToRightHandedSystemMap = {};
@@ -3592,6 +3614,35 @@ var _Exporter = /** @class */ (function () {
3592
3614
  });
3593
3615
  }
3594
3616
  });
3617
+ // Export babylon cameras to glTFCamera
3618
+ var cameraHash = new Map();
3619
+ babylonScene.cameras.forEach(function (camera) {
3620
+ var glTFCamera = {
3621
+ type: camera.mode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"].PERSPECTIVE_CAMERA ? "perspective" /* PERSPECTIVE */ : "orthographic" /* ORTHOGRAPHIC */
3622
+ };
3623
+ if (camera.name) {
3624
+ glTFCamera.name = camera.name;
3625
+ }
3626
+ if (glTFCamera.type === "perspective" /* PERSPECTIVE */) {
3627
+ glTFCamera.perspective = {
3628
+ aspectRatio: camera.getEngine().getAspectRatio(camera),
3629
+ yfov: camera._cache.fovMode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"].FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera._cache.aspectRatio,
3630
+ znear: camera.minZ, zfar: camera.maxZ
3631
+ };
3632
+ }
3633
+ else if (glTFCamera.type === "orthographic" /* ORTHOGRAPHIC */) {
3634
+ var halfWidth = camera.orthoLeft && camera.orthoRight ?
3635
+ 0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;
3636
+ var halfHeight = camera.orthoBottom && camera.orthoTop ?
3637
+ 0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;
3638
+ glTFCamera.orthographic = {
3639
+ xmag: halfWidth, ymag: halfHeight,
3640
+ znear: camera.minZ, zfar: camera.maxZ
3641
+ };
3642
+ }
3643
+ cameraHash.set(camera, _this._cameras.length);
3644
+ _this._cameras.push(glTFCamera);
3645
+ });
3595
3646
  var _a = this.getExportNodes(nodes), exportNodes = _a[0], exportMaterials = _a[1];
3596
3647
  return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* PNG */, true).then(function () {
3597
3648
  return _this.createNodeMapAndAnimationsAsync(babylonScene, exportNodes, binaryWriter).then(function (nodeMap) {
@@ -3615,6 +3666,9 @@ var _Exporter = /** @class */ (function () {
3615
3666
  glTFNode.extras = babylonNode.metadata.gltf.extras;
3616
3667
  }
3617
3668
  }
3669
+ if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"]) {
3670
+ glTFNode.camera = cameraHash.get(babylonNode);
3671
+ }
3618
3672
  if (!babylonNode.parent || rootNodesToLeftHanded.indexOf(babylonNode.parent) !== -1) {
3619
3673
  if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
3620
3674
  babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Log("Omitting " + babylonNode.name + " from scene.");
@@ -3689,7 +3743,7 @@ var _Exporter = /** @class */ (function () {
3689
3743
  }
3690
3744
  }
3691
3745
  else {
3692
- "Excluding node " + babylonNode.name;
3746
+ "Excluding node ".concat(babylonNode.name);
3693
3747
  }
3694
3748
  }
3695
3749
  return [exportNodes, exportMaterials];
@@ -3718,7 +3772,7 @@ var _Exporter = /** @class */ (function () {
3718
3772
  return _this.createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem, nodeMap).then(function (node) {
3719
3773
  var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap);
3720
3774
  if (promise == null) {
3721
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node " + babylonNode.name);
3775
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node ".concat(babylonNode.name));
3722
3776
  return Promise.resolve();
3723
3777
  }
3724
3778
  else {
@@ -3797,6 +3851,10 @@ var _Exporter = /** @class */ (function () {
3797
3851
  return node;
3798
3852
  });
3799
3853
  }
3854
+ else if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"]) {
3855
+ _this.setCameraTransformation(node, babylonNode, convertToRightHandedSystem);
3856
+ return node;
3857
+ }
3800
3858
  else {
3801
3859
  return node;
3802
3860
  }
@@ -4149,7 +4207,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4149
4207
  promises.push(_this._convertPBRMaterialAsync(material, mimeType, hasTextureCoords));
4150
4208
  }
4151
4209
  else {
4152
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Unsupported material type: " + material.name);
4210
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Unsupported material type: ".concat(material.name));
4153
4211
  }
4154
4212
  });
4155
4213
  return Promise.all(promises).then(function () { });
@@ -4884,7 +4942,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
4884
4942
  return 33648 /* MIRRORED_REPEAT */;
4885
4943
  }
4886
4944
  default: {
4887
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Texture Wrap Mode " + wrapMode + "!");
4945
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Texture Wrap Mode ".concat(wrapMode, "!"));
4888
4946
  return 10497 /* REPEAT */;
4889
4947
  }
4890
4948
  }
@@ -5187,7 +5245,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
5187
5245
  var textureName = baseTextureName + extension;
5188
5246
  var originalTextureName = textureName;
5189
5247
  if (textureName in imageData) {
5190
- textureName = baseTextureName + "_" + babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].RandomId() + extension;
5248
+ textureName = "".concat(baseTextureName, "_").concat(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].RandomId()).concat(extension);
5191
5249
  }
5192
5250
  imageData[textureName] = imageValues;
5193
5251
  if (mimeType === "image/jpeg" /* JPEG */ || mimeType === "image/png" /* PNG */) {
@@ -5218,7 +5276,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
5218
5276
  }
5219
5277
  }
5220
5278
  else {
5221
- babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported texture mime type " + mimeType);
5279
+ babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported texture mime type ".concat(mimeType));
5222
5280
  }
5223
5281
  return textureInfo;
5224
5282
  };