babylonjs-serializers 5.0.0-beta.1 → 5.0.0-beta.5
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.
package/babylonjs.serializers.js
CHANGED
|
@@ -97,9 +97,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
97
97
|
/******/ ({
|
|
98
98
|
|
|
99
99
|
/***/ "../../node_modules/tslib/tslib.es6.js":
|
|
100
|
-
|
|
101
|
-
!***
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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"](""
|
|
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 "
|
|
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 "
|
|
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(""
|
|
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"](""
|
|
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(""
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 \""
|
|
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,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2192
2192
|
|
|
2193
2193
|
|
|
2194
2194
|
|
|
2195
|
+
|
|
2195
2196
|
/**
|
|
2196
2197
|
* Converts Babylon Scene into glTF 2.0.
|
|
2197
2198
|
* @hidden
|
|
@@ -2216,6 +2217,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
2216
2217
|
this._accessors = [];
|
|
2217
2218
|
this._meshes = [];
|
|
2218
2219
|
this._scenes = [];
|
|
2220
|
+
this._cameras = [];
|
|
2219
2221
|
this._nodes = [];
|
|
2220
2222
|
this._images = [];
|
|
2221
2223
|
this._materials = [];
|
|
@@ -2342,7 +2344,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
2342
2344
|
*/
|
|
2343
2345
|
_Exporter.RegisterExtension = function (name, factory) {
|
|
2344
2346
|
if (_Exporter.UnregisterExtension(name)) {
|
|
2345
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Extension with the name "
|
|
2347
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Extension with the name ".concat(name, " already exists"));
|
|
2346
2348
|
}
|
|
2347
2349
|
_Exporter._ExtensionFactories[name] = factory;
|
|
2348
2350
|
_Exporter._ExtensionNames.push(name);
|
|
@@ -2495,14 +2497,14 @@ var _Exporter = /** @class */ (function () {
|
|
|
2495
2497
|
break;
|
|
2496
2498
|
}
|
|
2497
2499
|
default: {
|
|
2498
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: "
|
|
2500
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
2499
2501
|
}
|
|
2500
2502
|
}
|
|
2501
2503
|
this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
|
|
2502
2504
|
}
|
|
2503
2505
|
}
|
|
2504
2506
|
else {
|
|
2505
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFillMode: Vertex Buffer Kind "
|
|
2507
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFillMode: Vertex Buffer Kind ".concat(vertexBufferKind, " not present!"));
|
|
2506
2508
|
}
|
|
2507
2509
|
};
|
|
2508
2510
|
/**
|
|
@@ -2554,13 +2556,13 @@ var _Exporter = /** @class */ (function () {
|
|
|
2554
2556
|
break;
|
|
2555
2557
|
}
|
|
2556
2558
|
default: {
|
|
2557
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: "
|
|
2559
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
2558
2560
|
}
|
|
2559
2561
|
}
|
|
2560
2562
|
this.writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
|
|
2561
2563
|
}
|
|
2562
2564
|
else {
|
|
2563
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleStripDrawMode: Vertex buffer kind "
|
|
2565
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleStripDrawMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
|
|
2564
2566
|
}
|
|
2565
2567
|
};
|
|
2566
2568
|
/**
|
|
@@ -2614,13 +2616,13 @@ var _Exporter = /** @class */ (function () {
|
|
|
2614
2616
|
break;
|
|
2615
2617
|
}
|
|
2616
2618
|
default: {
|
|
2617
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: "
|
|
2619
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
2618
2620
|
}
|
|
2619
2621
|
}
|
|
2620
2622
|
this.writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, meshAttributeArray, binaryWriter, convertToRightHandedSystem);
|
|
2621
2623
|
}
|
|
2622
2624
|
else {
|
|
2623
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFanMode: Vertex buffer kind "
|
|
2625
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("reorderTriangleFanMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
|
|
2624
2626
|
}
|
|
2625
2627
|
};
|
|
2626
2628
|
/**
|
|
@@ -2919,6 +2921,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
2919
2921
|
this._glTF.scenes = this._scenes;
|
|
2920
2922
|
this._glTF.scene = 0;
|
|
2921
2923
|
}
|
|
2924
|
+
if (this._cameras && this._cameras.length) {
|
|
2925
|
+
this._glTF.cameras = this._cameras;
|
|
2926
|
+
}
|
|
2922
2927
|
if (this._bufferViews && this._bufferViews.length) {
|
|
2923
2928
|
this._glTF.bufferViews = this._bufferViews;
|
|
2924
2929
|
}
|
|
@@ -3145,7 +3150,19 @@ var _Exporter = /** @class */ (function () {
|
|
|
3145
3150
|
if (babylonTransformNode.rotationQuaternion) {
|
|
3146
3151
|
rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
|
|
3147
3152
|
}
|
|
3148
|
-
if (!(rotationQuaternion
|
|
3153
|
+
if (!babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Quaternion"].IsIdentity(rotationQuaternion)) {
|
|
3154
|
+
if (convertToRightHandedSystem) {
|
|
3155
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
3156
|
+
}
|
|
3157
|
+
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3158
|
+
}
|
|
3159
|
+
};
|
|
3160
|
+
_Exporter.prototype.setCameraTransformation = function (node, babylonCamera, convertToRightHandedSystem) {
|
|
3161
|
+
if (!babylonCamera.position.equalsToFloats(0, 0, 0)) {
|
|
3162
|
+
node.translation = convertToRightHandedSystem ? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedPositionVector3(babylonCamera.position).asArray() : babylonCamera.position.asArray();
|
|
3163
|
+
}
|
|
3164
|
+
var rotationQuaternion = babylonCamera.absoluteRotation;
|
|
3165
|
+
if (!babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Quaternion"].IsIdentity(rotationQuaternion)) {
|
|
3149
3166
|
if (convertToRightHandedSystem) {
|
|
3150
3167
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__["_GLTFUtilities"]._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
3151
3168
|
}
|
|
@@ -3566,7 +3583,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3566
3583
|
var glTFNodeIndex;
|
|
3567
3584
|
var glTFNode;
|
|
3568
3585
|
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);
|
|
3586
|
+
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
3587
|
var rootNodesToLeftHanded = [];
|
|
3571
3588
|
this._convertToRightHandedSystem = !babylonScene.useRightHandedSystem;
|
|
3572
3589
|
this._convertToRightHandedSystemMap = {};
|
|
@@ -3592,6 +3609,35 @@ var _Exporter = /** @class */ (function () {
|
|
|
3592
3609
|
});
|
|
3593
3610
|
}
|
|
3594
3611
|
});
|
|
3612
|
+
// Export babylon cameras to glTFCamera
|
|
3613
|
+
var cameraHash = new Map();
|
|
3614
|
+
babylonScene.cameras.forEach(function (camera) {
|
|
3615
|
+
var glTFCamera = {
|
|
3616
|
+
type: camera.mode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"].PERSPECTIVE_CAMERA ? "perspective" /* PERSPECTIVE */ : "orthographic" /* ORTHOGRAPHIC */
|
|
3617
|
+
};
|
|
3618
|
+
if (camera.name) {
|
|
3619
|
+
glTFCamera.name = camera.name;
|
|
3620
|
+
}
|
|
3621
|
+
if (glTFCamera.type === "perspective" /* PERSPECTIVE */) {
|
|
3622
|
+
glTFCamera.perspective = {
|
|
3623
|
+
aspectRatio: camera.getEngine().getAspectRatio(camera),
|
|
3624
|
+
yfov: camera._cache.fovMode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"].FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera._cache.aspectRatio,
|
|
3625
|
+
znear: camera.minZ, zfar: camera.maxZ
|
|
3626
|
+
};
|
|
3627
|
+
}
|
|
3628
|
+
else if (glTFCamera.type === "orthographic" /* ORTHOGRAPHIC */) {
|
|
3629
|
+
var halfWidth = camera.orthoLeft && camera.orthoRight ?
|
|
3630
|
+
0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;
|
|
3631
|
+
var halfHeight = camera.orthoBottom && camera.orthoTop ?
|
|
3632
|
+
0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;
|
|
3633
|
+
glTFCamera.orthographic = {
|
|
3634
|
+
xmag: halfWidth, ymag: halfHeight,
|
|
3635
|
+
znear: camera.minZ, zfar: camera.maxZ
|
|
3636
|
+
};
|
|
3637
|
+
}
|
|
3638
|
+
cameraHash.set(camera, _this._cameras.length);
|
|
3639
|
+
_this._cameras.push(glTFCamera);
|
|
3640
|
+
});
|
|
3595
3641
|
var _a = this.getExportNodes(nodes), exportNodes = _a[0], exportMaterials = _a[1];
|
|
3596
3642
|
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* PNG */, true).then(function () {
|
|
3597
3643
|
return _this.createNodeMapAndAnimationsAsync(babylonScene, exportNodes, binaryWriter).then(function (nodeMap) {
|
|
@@ -3615,6 +3661,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
3615
3661
|
glTFNode.extras = babylonNode.metadata.gltf.extras;
|
|
3616
3662
|
}
|
|
3617
3663
|
}
|
|
3664
|
+
if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"]) {
|
|
3665
|
+
glTFNode.camera = cameraHash.get(babylonNode);
|
|
3666
|
+
}
|
|
3618
3667
|
if (!babylonNode.parent || rootNodesToLeftHanded.indexOf(babylonNode.parent) !== -1) {
|
|
3619
3668
|
if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
|
|
3620
3669
|
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Log("Omitting " + babylonNode.name + " from scene.");
|
|
@@ -3689,7 +3738,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3689
3738
|
}
|
|
3690
3739
|
}
|
|
3691
3740
|
else {
|
|
3692
|
-
"Excluding node "
|
|
3741
|
+
"Excluding node ".concat(babylonNode.name);
|
|
3693
3742
|
}
|
|
3694
3743
|
}
|
|
3695
3744
|
return [exportNodes, exportMaterials];
|
|
@@ -3718,7 +3767,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3718
3767
|
return _this.createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem, nodeMap).then(function (node) {
|
|
3719
3768
|
var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap);
|
|
3720
3769
|
if (promise == null) {
|
|
3721
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node "
|
|
3770
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Not exporting node ".concat(babylonNode.name));
|
|
3722
3771
|
return Promise.resolve();
|
|
3723
3772
|
}
|
|
3724
3773
|
else {
|
|
@@ -3797,6 +3846,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
3797
3846
|
return node;
|
|
3798
3847
|
});
|
|
3799
3848
|
}
|
|
3849
|
+
else if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Camera"]) {
|
|
3850
|
+
_this.setCameraTransformation(node, babylonNode, convertToRightHandedSystem);
|
|
3851
|
+
return node;
|
|
3852
|
+
}
|
|
3800
3853
|
else {
|
|
3801
3854
|
return node;
|
|
3802
3855
|
}
|
|
@@ -4149,7 +4202,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4149
4202
|
promises.push(_this._convertPBRMaterialAsync(material, mimeType, hasTextureCoords));
|
|
4150
4203
|
}
|
|
4151
4204
|
else {
|
|
4152
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Unsupported material type: "
|
|
4205
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Warn("Unsupported material type: ".concat(material.name));
|
|
4153
4206
|
}
|
|
4154
4207
|
});
|
|
4155
4208
|
return Promise.all(promises).then(function () { });
|
|
@@ -4884,7 +4937,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4884
4937
|
return 33648 /* MIRRORED_REPEAT */;
|
|
4885
4938
|
}
|
|
4886
4939
|
default: {
|
|
4887
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Texture Wrap Mode "
|
|
4940
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported Texture Wrap Mode ".concat(wrapMode, "!"));
|
|
4888
4941
|
return 10497 /* REPEAT */;
|
|
4889
4942
|
}
|
|
4890
4943
|
}
|
|
@@ -5187,7 +5240,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5187
5240
|
var textureName = baseTextureName + extension;
|
|
5188
5241
|
var originalTextureName = textureName;
|
|
5189
5242
|
if (textureName in imageData) {
|
|
5190
|
-
textureName = baseTextureName
|
|
5243
|
+
textureName = "".concat(baseTextureName, "_").concat(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].RandomId()).concat(extension);
|
|
5191
5244
|
}
|
|
5192
5245
|
imageData[textureName] = imageValues;
|
|
5193
5246
|
if (mimeType === "image/jpeg" /* JPEG */ || mimeType === "image/png" /* PNG */) {
|
|
@@ -5218,7 +5271,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5218
5271
|
}
|
|
5219
5272
|
}
|
|
5220
5273
|
else {
|
|
5221
|
-
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported texture mime type "
|
|
5274
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Tools"].Error("Unsupported texture mime type ".concat(mimeType));
|
|
5222
5275
|
}
|
|
5223
5276
|
return textureInfo;
|
|
5224
5277
|
};
|