babylonjs-serializers 6.6.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.glTF2Serializer.js +248 -523
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylon.objSerializer.js +4 -4
- package/babylon.objSerializer.js.map +1 -1
- package/babylon.stlSerializer.js +4 -4
- package/babylon.stlSerializer.js.map +1 -1
- package/babylonjs.serializers.d.ts +25 -128
- package/babylonjs.serializers.js +250 -525
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/babylonjs.serializers.module.d.ts +51 -259
- package/package.json +3 -3
package/babylonjs.serializers.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
exports["babylonjs-serializers"] = factory(require("babylonjs"));
|
|
8
8
|
else
|
|
9
9
|
root["SERIALIZERS"] = factory(root["BABYLON"]);
|
|
10
|
-
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (
|
|
10
|
+
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (__WEBPACK_EXTERNAL_MODULE_core_Meshes_mesh__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
@@ -373,7 +373,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
373
373
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
374
374
|
/* harmony export */ "OBJExport": () => (/* binding */ OBJExport)
|
|
375
375
|
/* harmony export */ });
|
|
376
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/
|
|
376
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Meshes/mesh");
|
|
377
377
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
378
378
|
|
|
379
379
|
|
|
@@ -564,7 +564,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
564
564
|
/* harmony export */ "EXT_mesh_gpu_instancing": () => (/* binding */ EXT_mesh_gpu_instancing)
|
|
565
565
|
/* harmony export */ });
|
|
566
566
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
567
|
-
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Buffers/buffer */ "core/
|
|
567
|
+
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Buffers/buffer */ "core/Meshes/mesh");
|
|
568
568
|
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__);
|
|
569
569
|
|
|
570
570
|
|
|
@@ -713,12 +713,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
713
713
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
714
714
|
/* harmony export */ "KHR_lights_punctual": () => (/* binding */ KHR_lights_punctual)
|
|
715
715
|
/* harmony export */ });
|
|
716
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/logger */ "core/
|
|
716
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/logger */ "core/Meshes/mesh");
|
|
717
717
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
718
718
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
719
|
-
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
|
|
720
|
-
|
|
721
|
-
|
|
722
719
|
|
|
723
720
|
|
|
724
721
|
|
|
@@ -771,57 +768,48 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
|
771
768
|
var _this = this;
|
|
772
769
|
return new Promise(function (resolve) {
|
|
773
770
|
if (node && babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.ShadowLight) {
|
|
774
|
-
var babylonLight = babylonNode;
|
|
775
771
|
var light = void 0;
|
|
776
|
-
var lightType =
|
|
772
|
+
var lightType = babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_POINTLIGHT
|
|
777
773
|
? "point" /* KHRLightsPunctual_LightType.POINT */
|
|
778
|
-
:
|
|
774
|
+
: babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_DIRECTIONALLIGHT
|
|
779
775
|
? "directional" /* KHRLightsPunctual_LightType.DIRECTIONAL */
|
|
780
|
-
:
|
|
776
|
+
: babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_SPOTLIGHT
|
|
781
777
|
? "spot" /* KHRLightsPunctual_LightType.SPOT */
|
|
782
778
|
: null;
|
|
783
779
|
if (lightType == null) {
|
|
784
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light ").concat(
|
|
780
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light ").concat(babylonNode.name, " is not supported in ").concat(NAME));
|
|
785
781
|
}
|
|
786
782
|
else {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
if (!lightPosition.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero())) {
|
|
790
|
-
if (convertToRightHandedSystem) {
|
|
791
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedPositionVector3FromRef(lightPosition);
|
|
792
|
-
}
|
|
793
|
-
node.translation = lightPosition.asArray();
|
|
783
|
+
if (!babylonNode.position.equalsToFloats(0, 0, 0)) {
|
|
784
|
+
node.translation = babylonNode.position.asArray();
|
|
794
785
|
}
|
|
795
786
|
if (lightType !== "point" /* KHRLightsPunctual_LightType.POINT */) {
|
|
796
|
-
var localAxis =
|
|
797
|
-
var yaw = -Math.atan2(localAxis.z
|
|
787
|
+
var localAxis = babylonNode.direction;
|
|
788
|
+
var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
|
|
798
789
|
var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
799
790
|
var pitch = -Math.atan2(localAxis.y, len);
|
|
800
|
-
var lightRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw, pitch, 0);
|
|
801
|
-
if (
|
|
802
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedQuaternionFromRef(lightRotationQuaternion);
|
|
803
|
-
}
|
|
804
|
-
if (!lightRotationQuaternion.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity())) {
|
|
791
|
+
var lightRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw + Math.PI, pitch, 0);
|
|
792
|
+
if (!core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(lightRotationQuaternion)) {
|
|
805
793
|
node.rotation = lightRotationQuaternion.asArray();
|
|
806
794
|
}
|
|
807
795
|
}
|
|
808
|
-
if (
|
|
809
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light falloff for ").concat(
|
|
796
|
+
if (babylonNode.falloffType !== core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.FALLOFF_GLTF) {
|
|
797
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light falloff for ").concat(babylonNode.name, " does not match the ").concat(NAME, " specification!"));
|
|
810
798
|
}
|
|
811
799
|
light = {
|
|
812
800
|
type: lightType,
|
|
813
801
|
};
|
|
814
|
-
if (!
|
|
815
|
-
light.color =
|
|
802
|
+
if (!babylonNode.diffuse.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White())) {
|
|
803
|
+
light.color = babylonNode.diffuse.asArray();
|
|
816
804
|
}
|
|
817
|
-
if (
|
|
818
|
-
light.intensity =
|
|
805
|
+
if (babylonNode.intensity !== 1.0) {
|
|
806
|
+
light.intensity = babylonNode.intensity;
|
|
819
807
|
}
|
|
820
|
-
if (
|
|
821
|
-
light.range =
|
|
808
|
+
if (babylonNode.range !== Number.MAX_VALUE) {
|
|
809
|
+
light.range = babylonNode.range;
|
|
822
810
|
}
|
|
823
811
|
if (lightType === "spot" /* KHRLightsPunctual_LightType.SPOT */) {
|
|
824
|
-
var babylonSpotLight =
|
|
812
|
+
var babylonSpotLight = babylonNode;
|
|
825
813
|
if (babylonSpotLight.angle !== Math.PI / 2.0) {
|
|
826
814
|
if (light.spot == null) {
|
|
827
815
|
light.spot = {};
|
|
@@ -835,11 +823,9 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
|
835
823
|
light.spot.innerConeAngle = babylonSpotLight.innerAngle / 2.0;
|
|
836
824
|
}
|
|
837
825
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
};
|
|
842
|
-
}
|
|
826
|
+
_this._lights || (_this._lights = {
|
|
827
|
+
lights: [],
|
|
828
|
+
});
|
|
843
829
|
_this._lights.lights.push(light);
|
|
844
830
|
var lightReference = {
|
|
845
831
|
light: _this._lights.lights.length - 1,
|
|
@@ -849,52 +835,41 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
|
849
835
|
if (parentBabylonNode && parentBabylonNode.getChildren().length == 1) {
|
|
850
836
|
var parentNode = _this._exporter._nodes[nodeMap[parentBabylonNode.uniqueId]];
|
|
851
837
|
if (parentNode) {
|
|
852
|
-
var
|
|
853
|
-
var
|
|
854
|
-
var
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
var
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if (
|
|
868
|
-
|
|
869
|
-
? babylonLight.direction
|
|
870
|
-
: _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedPositionVector3(babylonLight.direction));
|
|
838
|
+
var parentTranslation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0]);
|
|
839
|
+
var parentRotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(parentNode.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0]);
|
|
840
|
+
var parentScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.scale || [1, 1, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1]);
|
|
841
|
+
var parentMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(parentScale, parentRotation, parentTranslation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
842
|
+
var translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[2]);
|
|
843
|
+
var rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[1]);
|
|
844
|
+
var matrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.OneReadOnly, rotation, translation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[1]);
|
|
845
|
+
parentMatrix.multiplyToRef(matrix, matrix);
|
|
846
|
+
matrix.decompose(parentScale, parentRotation, parentTranslation);
|
|
847
|
+
if (parentTranslation.equalsToFloats(0, 0, 0)) {
|
|
848
|
+
delete parentNode.translation;
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
parentNode.translation = parentTranslation.asArray();
|
|
852
|
+
}
|
|
853
|
+
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(parentRotation)) {
|
|
854
|
+
delete parentNode.rotation;
|
|
871
855
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
856
|
+
else {
|
|
857
|
+
parentNode.rotation = parentRotation.asArray();
|
|
858
|
+
}
|
|
859
|
+
if (parentScale.equalsToFloats(1, 1, 1)) {
|
|
860
|
+
delete parentNode.scale;
|
|
875
861
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
lightLocalMatrix.multiplyToRef(parentInvertNodeLocalMatrix, lightLocalMatrix);
|
|
879
|
-
var parentNewScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0];
|
|
880
|
-
var parentNewRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0];
|
|
881
|
-
var parentNewTranslation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1];
|
|
882
|
-
lightLocalMatrix.decompose(parentNewScale, parentNewRotationQuaternion, parentNewTranslation);
|
|
883
|
-
parentNode.scale = parentNewScale.asArray();
|
|
884
|
-
parentNode.rotation = parentNewRotationQuaternion.asArray();
|
|
885
|
-
parentNode.translation = parentNewTranslation.asArray();
|
|
886
|
-
if (parentNode.extensions == null) {
|
|
887
|
-
parentNode.extensions = {};
|
|
862
|
+
else {
|
|
863
|
+
parentNode.scale = parentScale.asArray();
|
|
888
864
|
}
|
|
865
|
+
parentNode.extensions || (parentNode.extensions = {});
|
|
889
866
|
parentNode.extensions[NAME] = lightReference;
|
|
890
867
|
// Do not export the original node
|
|
891
868
|
resolve(null);
|
|
892
869
|
return;
|
|
893
870
|
}
|
|
894
871
|
}
|
|
895
|
-
|
|
896
|
-
node.extensions = {};
|
|
897
|
-
}
|
|
872
|
+
node.extensions || (node.extensions = {});
|
|
898
873
|
node.extensions[NAME] = lightReference;
|
|
899
874
|
}
|
|
900
875
|
}
|
|
@@ -920,7 +895,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
920
895
|
/* harmony export */ "KHR_materials_anisotropy": () => (/* binding */ KHR_materials_anisotropy)
|
|
921
896
|
/* harmony export */ });
|
|
922
897
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
923
|
-
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/
|
|
898
|
+
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Meshes/mesh");
|
|
924
899
|
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
925
900
|
|
|
926
901
|
|
|
@@ -1004,7 +979,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1004
979
|
/* harmony export */ "KHR_materials_clearcoat": () => (/* binding */ KHR_materials_clearcoat)
|
|
1005
980
|
/* harmony export */ });
|
|
1006
981
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1007
|
-
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/tools */ "core/
|
|
982
|
+
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/tools */ "core/Meshes/mesh");
|
|
1008
983
|
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1009
984
|
|
|
1010
985
|
|
|
@@ -1111,7 +1086,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1111
1086
|
/* harmony export */ "KHR_materials_emissive_strength": () => (/* binding */ KHR_materials_emissive_strength)
|
|
1112
1087
|
/* harmony export */ });
|
|
1113
1088
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1114
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/
|
|
1089
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
|
|
1115
1090
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1116
1091
|
|
|
1117
1092
|
|
|
@@ -1180,7 +1155,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1180
1155
|
/* harmony export */ "KHR_materials_ior": () => (/* binding */ KHR_materials_ior)
|
|
1181
1156
|
/* harmony export */ });
|
|
1182
1157
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1183
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/
|
|
1158
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
|
|
1184
1159
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1185
1160
|
|
|
1186
1161
|
|
|
@@ -1249,7 +1224,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1249
1224
|
/* harmony export */ "KHR_materials_iridescence": () => (/* binding */ KHR_materials_iridescence)
|
|
1250
1225
|
/* harmony export */ });
|
|
1251
1226
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1252
|
-
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/
|
|
1227
|
+
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Meshes/mesh");
|
|
1253
1228
|
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1254
1229
|
|
|
1255
1230
|
|
|
@@ -1340,7 +1315,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1340
1315
|
/* harmony export */ "KHR_materials_sheen": () => (/* binding */ KHR_materials_sheen)
|
|
1341
1316
|
/* harmony export */ });
|
|
1342
1317
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1343
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/
|
|
1318
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
|
|
1344
1319
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1345
1320
|
|
|
1346
1321
|
|
|
@@ -1430,7 +1405,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1430
1405
|
/* harmony export */ "KHR_materials_specular": () => (/* binding */ KHR_materials_specular)
|
|
1431
1406
|
/* harmony export */ });
|
|
1432
1407
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1433
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/
|
|
1408
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
|
|
1434
1409
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1435
1410
|
|
|
1436
1411
|
|
|
@@ -1532,7 +1507,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1532
1507
|
/* harmony export */ "KHR_materials_transmission": () => (/* binding */ KHR_materials_transmission)
|
|
1533
1508
|
/* harmony export */ });
|
|
1534
1509
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1535
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/
|
|
1510
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Meshes/mesh");
|
|
1536
1511
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1537
1512
|
|
|
1538
1513
|
|
|
@@ -1625,7 +1600,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1625
1600
|
/* harmony export */ "KHR_materials_unlit": () => (/* binding */ KHR_materials_unlit)
|
|
1626
1601
|
/* harmony export */ });
|
|
1627
1602
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1628
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/standardMaterial */ "core/
|
|
1603
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/standardMaterial */ "core/Meshes/mesh");
|
|
1629
1604
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1630
1605
|
|
|
1631
1606
|
|
|
@@ -1693,7 +1668,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1693
1668
|
/* harmony export */ "KHR_materials_volume": () => (/* binding */ KHR_materials_volume)
|
|
1694
1669
|
/* harmony export */ });
|
|
1695
1670
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1696
|
-
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Maths/math.color */ "core/
|
|
1671
|
+
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Maths/math.color */ "core/Meshes/mesh");
|
|
1697
1672
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1698
1673
|
|
|
1699
1674
|
|
|
@@ -1797,7 +1772,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1797
1772
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1798
1773
|
/* harmony export */ "KHR_texture_transform": () => (/* binding */ KHR_texture_transform)
|
|
1799
1774
|
/* harmony export */ });
|
|
1800
|
-
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/
|
|
1775
|
+
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Meshes/mesh");
|
|
1801
1776
|
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__);
|
|
1802
1777
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1803
1778
|
|
|
@@ -1954,7 +1929,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1954
1929
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1955
1930
|
/* harmony export */ "_GLTFAnimation": () => (/* binding */ _GLTFAnimation)
|
|
1956
1931
|
/* harmony export */ });
|
|
1957
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Lights/light */ "core/
|
|
1932
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Lights/light */ "core/Meshes/mesh");
|
|
1958
1933
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
1959
1934
|
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
|
|
1960
1935
|
|
|
@@ -2005,32 +1980,30 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2005
1980
|
* @param babylonTransformNode - BabylonJS mesh.
|
|
2006
1981
|
* @param animation - animation.
|
|
2007
1982
|
* @param animationChannelTargetPath - The target animation channel.
|
|
2008
|
-
* @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
|
|
2009
1983
|
* @param useQuaternion - Specifies if quaternions are used.
|
|
2010
1984
|
* @returns nullable IAnimationData
|
|
2011
1985
|
*/
|
|
2012
|
-
_GLTFAnimation._CreateNodeAnimation = function (babylonTransformNode, animation, animationChannelTargetPath,
|
|
1986
|
+
_GLTFAnimation._CreateNodeAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate) {
|
|
2013
1987
|
if (this._IsTransformable(babylonTransformNode)) {
|
|
2014
1988
|
var inputs = [];
|
|
2015
1989
|
var outputs = [];
|
|
2016
1990
|
var keyFrames = animation.getKeys();
|
|
2017
1991
|
var minMaxKeyFrames = _GLTFAnimation._CalculateMinMaxKeyFrames(keyFrames);
|
|
2018
1992
|
var interpolationOrBake = _GLTFAnimation._DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);
|
|
2019
|
-
var frameDelta = minMaxKeyFrames.max - minMaxKeyFrames.min;
|
|
2020
1993
|
var interpolation = interpolationOrBake.interpolationType;
|
|
2021
1994
|
var shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;
|
|
2022
1995
|
if (shouldBakeAnimation) {
|
|
2023
|
-
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames,
|
|
1996
|
+
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
|
|
2024
1997
|
}
|
|
2025
1998
|
else {
|
|
2026
1999
|
if (interpolation === "LINEAR" /* AnimationSamplerInterpolation.LINEAR */ || interpolation === "STEP" /* AnimationSamplerInterpolation.STEP */) {
|
|
2027
|
-
_GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath,
|
|
2000
|
+
_GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
|
|
2028
2001
|
}
|
|
2029
2002
|
else if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
|
|
2030
|
-
_GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath,
|
|
2003
|
+
_GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
|
|
2031
2004
|
}
|
|
2032
2005
|
else {
|
|
2033
|
-
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames,
|
|
2006
|
+
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
|
|
2034
2007
|
}
|
|
2035
2008
|
}
|
|
2036
2009
|
if (inputs.length && outputs.length) {
|
|
@@ -2099,10 +2072,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2099
2072
|
* @param binaryWriter
|
|
2100
2073
|
* @param bufferViews
|
|
2101
2074
|
* @param accessors
|
|
2102
|
-
* @param convertToRightHandedSystem
|
|
2103
2075
|
* @param animationSampleRate
|
|
2104
2076
|
*/
|
|
2105
|
-
_GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors,
|
|
2077
|
+
_GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
2106
2078
|
var glTFAnimation;
|
|
2107
2079
|
if (_GLTFAnimation._IsTransformable(babylonNode)) {
|
|
2108
2080
|
if (babylonNode.animations) {
|
|
@@ -2118,7 +2090,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2118
2090
|
samplers: [],
|
|
2119
2091
|
channels: [],
|
|
2120
2092
|
};
|
|
2121
|
-
_GLTFAnimation._AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
2093
|
+
_GLTFAnimation._AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
|
|
2122
2094
|
if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
|
|
2123
2095
|
idleGLTFAnimations.push(glTFAnimation);
|
|
2124
2096
|
}
|
|
@@ -2138,10 +2110,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2138
2110
|
* @param binaryWriter
|
|
2139
2111
|
* @param bufferViews
|
|
2140
2112
|
* @param accessors
|
|
2141
|
-
* @param convertToRightHandedSystem
|
|
2142
2113
|
* @param animationSampleRate
|
|
2143
2114
|
*/
|
|
2144
|
-
_GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors,
|
|
2115
|
+
_GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
2145
2116
|
var glTFAnimation;
|
|
2146
2117
|
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
2147
2118
|
var morphTargetManager = babylonNode.morphTargetManager;
|
|
@@ -2175,7 +2146,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2175
2146
|
samplers: [],
|
|
2176
2147
|
channels: [],
|
|
2177
2148
|
};
|
|
2178
|
-
_GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
2149
|
+
_GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager.numTargets);
|
|
2179
2150
|
if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
|
|
2180
2151
|
idleGLTFAnimations.push(glTFAnimation);
|
|
2181
2152
|
}
|
|
@@ -2195,10 +2166,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2195
2166
|
* @param binaryWriter
|
|
2196
2167
|
* @param bufferViews
|
|
2197
2168
|
* @param accessors
|
|
2198
|
-
* @param convertToRightHandedSystemMap
|
|
2199
2169
|
* @param animationSampleRate
|
|
2200
2170
|
*/
|
|
2201
|
-
_GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap,
|
|
2171
|
+
_GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
2202
2172
|
var _a;
|
|
2203
2173
|
var glTFAnimation;
|
|
2204
2174
|
if (babylonScene.animationGroups) {
|
|
@@ -2225,8 +2195,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2225
2195
|
if (animationInfo) {
|
|
2226
2196
|
var babylonTransformNode = this_1._IsTransformable(target) ? target : this_1._IsTransformable(target[0]) ? target[0] : null;
|
|
2227
2197
|
if (babylonTransformNode) {
|
|
2228
|
-
|
|
2229
|
-
_GLTFAnimation._AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
|
|
2198
|
+
_GLTFAnimation._AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
|
|
2230
2199
|
}
|
|
2231
2200
|
}
|
|
2232
2201
|
}
|
|
@@ -2308,7 +2277,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2308
2277
|
combinedAnimationGroup.setKeys(animationKeys);
|
|
2309
2278
|
var animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
|
|
2310
2279
|
if (animationInfo) {
|
|
2311
|
-
_GLTFAnimation._AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
2280
|
+
_GLTFAnimation._AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
|
|
2312
2281
|
}
|
|
2313
2282
|
});
|
|
2314
2283
|
if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {
|
|
@@ -2322,8 +2291,8 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2322
2291
|
}
|
|
2323
2292
|
}
|
|
2324
2293
|
};
|
|
2325
|
-
_GLTFAnimation._AddAnimation = function (name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
2326
|
-
var animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath,
|
|
2294
|
+
_GLTFAnimation._AddAnimation = function (name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, useQuaternion, animationSampleRate, morphAnimationChannels) {
|
|
2295
|
+
var animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate);
|
|
2327
2296
|
var bufferView;
|
|
2328
2297
|
var accessor;
|
|
2329
2298
|
var keyframeAccessorIndex;
|
|
@@ -2407,10 +2376,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2407
2376
|
* @param minMaxFrames
|
|
2408
2377
|
* @param minMaxFrames.min
|
|
2409
2378
|
* @param minMaxFrames.max
|
|
2410
|
-
* @param convertToRightHandedSystem converts the values to right-handed
|
|
2411
2379
|
* @param useQuaternion specifies if quaternions should be used
|
|
2412
2380
|
*/
|
|
2413
|
-
_GLTFAnimation._CreateBakedAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames,
|
|
2381
|
+
_GLTFAnimation._CreateBakedAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, useQuaternion) {
|
|
2414
2382
|
var value;
|
|
2415
2383
|
var quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity();
|
|
2416
2384
|
var previousTime = null;
|
|
@@ -2464,7 +2432,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2464
2432
|
loopMode: animation.loopMode,
|
|
2465
2433
|
};
|
|
2466
2434
|
value = animation._interpolate(f, state);
|
|
2467
|
-
_GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs,
|
|
2435
|
+
_GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion);
|
|
2468
2436
|
}
|
|
2469
2437
|
}
|
|
2470
2438
|
}
|
|
@@ -2472,23 +2440,17 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2472
2440
|
minMaxFrames.max = maxUsedFrame;
|
|
2473
2441
|
}
|
|
2474
2442
|
};
|
|
2475
|
-
_GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath,
|
|
2476
|
-
var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath,
|
|
2443
|
+
_GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion) {
|
|
2444
|
+
var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion);
|
|
2477
2445
|
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
2478
2446
|
var property = animation.targetProperty.split(".");
|
|
2479
|
-
var componentName = property ? property[1] : ""; // x, y, or
|
|
2447
|
+
var componentName = property ? property[1] : ""; // x, y, z, or w component
|
|
2480
2448
|
var value = useQuaternion ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
|
|
2481
2449
|
switch (componentName) {
|
|
2482
|
-
case "x":
|
|
2483
|
-
|
|
2484
|
-
break;
|
|
2485
|
-
}
|
|
2486
|
-
case "y": {
|
|
2487
|
-
value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
|
|
2488
|
-
break;
|
|
2489
|
-
}
|
|
2450
|
+
case "x":
|
|
2451
|
+
case "y":
|
|
2490
2452
|
case "z": {
|
|
2491
|
-
value[componentName] =
|
|
2453
|
+
value[componentName] = factor;
|
|
2492
2454
|
break;
|
|
2493
2455
|
}
|
|
2494
2456
|
case "w": {
|
|
@@ -2501,7 +2463,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2501
2463
|
}
|
|
2502
2464
|
return value;
|
|
2503
2465
|
};
|
|
2504
|
-
_GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs,
|
|
2466
|
+
_GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion) {
|
|
2505
2467
|
var cacheValue;
|
|
2506
2468
|
inputs.push(time);
|
|
2507
2469
|
if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
|
|
@@ -2509,7 +2471,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2509
2471
|
return;
|
|
2510
2472
|
}
|
|
2511
2473
|
if (animation.dataType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
2512
|
-
value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath,
|
|
2474
|
+
value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
|
|
2513
2475
|
}
|
|
2514
2476
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2515
2477
|
if (useQuaternion) {
|
|
@@ -2519,24 +2481,11 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2519
2481
|
cacheValue = value;
|
|
2520
2482
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
|
|
2521
2483
|
}
|
|
2522
|
-
if (convertToRightHandedSystem) {
|
|
2523
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
|
|
2524
|
-
if (!babylonTransformNode.parent) {
|
|
2525
|
-
quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
2484
|
outputs.push(quaternionCache.asArray());
|
|
2529
2485
|
}
|
|
2530
2486
|
else {
|
|
2531
2487
|
// scaling and position animation
|
|
2532
2488
|
cacheValue = value;
|
|
2533
|
-
if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */) {
|
|
2534
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
|
|
2535
|
-
if (!babylonTransformNode.parent) {
|
|
2536
|
-
cacheValue.x *= -1;
|
|
2537
|
-
cacheValue.z *= -1;
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
2489
|
outputs.push(cacheValue.asArray());
|
|
2541
2490
|
}
|
|
2542
2491
|
};
|
|
@@ -2545,17 +2494,15 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2545
2494
|
* @param babylonTransformNode BabylonJS mesh
|
|
2546
2495
|
* @param animation BabylonJS animation
|
|
2547
2496
|
* @param animationChannelTargetPath The target animation channel
|
|
2548
|
-
* @param frameDelta The difference between the last and first frame of the animation
|
|
2549
2497
|
* @param inputs Array to store the key frame times
|
|
2550
2498
|
* @param outputs Array to store the key frame data
|
|
2551
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
2552
2499
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
2553
2500
|
*/
|
|
2554
|
-
_GLTFAnimation._CreateLinearOrStepAnimation = function (babylonTransformNode, animation, animationChannelTargetPath,
|
|
2501
|
+
_GLTFAnimation._CreateLinearOrStepAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
|
|
2555
2502
|
for (var _i = 0, _a = animation.getKeys(); _i < _a.length; _i++) {
|
|
2556
2503
|
var keyFrame = _a[_i];
|
|
2557
2504
|
inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
|
|
2558
|
-
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode,
|
|
2505
|
+
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
|
|
2559
2506
|
}
|
|
2560
2507
|
};
|
|
2561
2508
|
/**
|
|
@@ -2566,42 +2513,31 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2566
2513
|
* @param frameDelta The difference between the last and first frame of the animation
|
|
2567
2514
|
* @param inputs Array to store the key frame times
|
|
2568
2515
|
* @param outputs Array to store the key frame data
|
|
2569
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
2570
2516
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
2571
2517
|
*/
|
|
2572
|
-
_GLTFAnimation._CreateCubicSplineAnimation = function (babylonTransformNode, animation, animationChannelTargetPath,
|
|
2518
|
+
_GLTFAnimation._CreateCubicSplineAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
|
|
2573
2519
|
animation.getKeys().forEach(function (keyFrame) {
|
|
2574
2520
|
inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
|
|
2575
|
-
_GLTFAnimation._AddSplineTangent(
|
|
2576
|
-
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode,
|
|
2577
|
-
_GLTFAnimation._AddSplineTangent(
|
|
2521
|
+
_GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
|
|
2522
|
+
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
|
|
2523
|
+
_GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
|
|
2578
2524
|
});
|
|
2579
2525
|
};
|
|
2580
|
-
_GLTFAnimation._GetBasePositionRotationOrScale = function (babylonTransformNode, animationChannelTargetPath,
|
|
2526
|
+
_GLTFAnimation._GetBasePositionRotationOrScale = function (babylonTransformNode, animationChannelTargetPath, useQuaternion) {
|
|
2581
2527
|
var basePositionRotationOrScale;
|
|
2582
2528
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2583
2529
|
if (useQuaternion) {
|
|
2584
2530
|
var q = babylonTransformNode.rotationQuaternion;
|
|
2585
2531
|
basePositionRotationOrScale = (q !== null && q !== void 0 ? q : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity()).asArray();
|
|
2586
|
-
if (convertToRightHandedSystem) {
|
|
2587
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(basePositionRotationOrScale);
|
|
2588
|
-
if (!babylonTransformNode.parent) {
|
|
2589
|
-
basePositionRotationOrScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale)).asArray();
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
2532
|
}
|
|
2593
2533
|
else {
|
|
2594
2534
|
var r = babylonTransformNode.rotation;
|
|
2595
2535
|
basePositionRotationOrScale = (r !== null && r !== void 0 ? r : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
|
|
2596
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalArray3FromRef(basePositionRotationOrScale);
|
|
2597
2536
|
}
|
|
2598
2537
|
}
|
|
2599
2538
|
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2600
2539
|
var p = babylonTransformNode.position;
|
|
2601
2540
|
basePositionRotationOrScale = (p !== null && p !== void 0 ? p : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
|
|
2602
|
-
if (convertToRightHandedSystem) {
|
|
2603
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionArray3FromRef(basePositionRotationOrScale);
|
|
2604
|
-
}
|
|
2605
2541
|
}
|
|
2606
2542
|
else {
|
|
2607
2543
|
// scale
|
|
@@ -2617,35 +2553,18 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2617
2553
|
* @param outputs
|
|
2618
2554
|
* @param animationChannelTargetPath
|
|
2619
2555
|
* @param babylonTransformNode
|
|
2620
|
-
* @param convertToRightHandedSystem
|
|
2621
2556
|
* @param useQuaternion
|
|
2622
2557
|
*/
|
|
2623
|
-
_GLTFAnimation._AddKeyframeValue = function (keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode,
|
|
2624
|
-
var value;
|
|
2558
|
+
_GLTFAnimation._AddKeyframeValue = function (keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion) {
|
|
2625
2559
|
var newPositionRotationOrScale;
|
|
2626
2560
|
var animationType = animation.dataType;
|
|
2627
2561
|
if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_VECTOR3) {
|
|
2628
|
-
value = keyFrame.value.asArray();
|
|
2562
|
+
var value = keyFrame.value.asArray();
|
|
2629
2563
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2630
2564
|
var array = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(value);
|
|
2631
2565
|
var rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);
|
|
2632
|
-
if (convertToRightHandedSystem) {
|
|
2633
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
2634
|
-
if (!babylonTransformNode.parent) {
|
|
2635
|
-
rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(rotationQuaternion);
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
2566
|
value = rotationQuaternion.asArray();
|
|
2639
2567
|
}
|
|
2640
|
-
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2641
|
-
if (convertToRightHandedSystem) {
|
|
2642
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalArray3FromRef(value);
|
|
2643
|
-
if (!babylonTransformNode.parent) {
|
|
2644
|
-
value[0] *= -1;
|
|
2645
|
-
value[2] *= -1;
|
|
2646
|
-
}
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
2568
|
outputs.push(value); // scale vector.
|
|
2650
2569
|
}
|
|
2651
2570
|
else if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
@@ -2654,42 +2573,20 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2654
2573
|
}
|
|
2655
2574
|
else {
|
|
2656
2575
|
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
2657
|
-
newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath,
|
|
2576
|
+
newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
|
|
2658
2577
|
if (newPositionRotationOrScale) {
|
|
2659
2578
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2660
2579
|
var posRotScale = useQuaternion
|
|
2661
2580
|
? newPositionRotationOrScale
|
|
2662
2581
|
: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();
|
|
2663
|
-
if (convertToRightHandedSystem) {
|
|
2664
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(posRotScale);
|
|
2665
|
-
if (!babylonTransformNode.parent) {
|
|
2666
|
-
posRotScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(posRotScale);
|
|
2667
|
-
}
|
|
2668
|
-
}
|
|
2669
2582
|
outputs.push(posRotScale.asArray());
|
|
2670
2583
|
}
|
|
2671
|
-
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2672
|
-
if (convertToRightHandedSystem) {
|
|
2673
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalVector3FromRef(newPositionRotationOrScale);
|
|
2674
|
-
if (!babylonTransformNode.parent) {
|
|
2675
|
-
newPositionRotationOrScale.x *= -1;
|
|
2676
|
-
newPositionRotationOrScale.z *= -1;
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
2584
|
outputs.push(newPositionRotationOrScale.asArray());
|
|
2681
2585
|
}
|
|
2682
2586
|
}
|
|
2683
2587
|
}
|
|
2684
2588
|
else if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_QUATERNION) {
|
|
2685
|
-
|
|
2686
|
-
if (convertToRightHandedSystem) {
|
|
2687
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(value);
|
|
2688
|
-
if (!babylonTransformNode.parent) {
|
|
2689
|
-
value = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(value)).asArray();
|
|
2690
|
-
}
|
|
2691
|
-
}
|
|
2692
|
-
outputs.push(value);
|
|
2589
|
+
outputs.push(keyFrame.value.normalize().asArray());
|
|
2693
2590
|
}
|
|
2694
2591
|
else {
|
|
2695
2592
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported key frame values for animation!");
|
|
@@ -2757,9 +2654,8 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2757
2654
|
* @param keyFrame The key frame with the animation data
|
|
2758
2655
|
* @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
|
|
2759
2656
|
* @param useQuaternion Specifies if quaternions are used
|
|
2760
|
-
* @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
|
|
2761
2657
|
*/
|
|
2762
|
-
_GLTFAnimation._AddSplineTangent = function (
|
|
2658
|
+
_GLTFAnimation._AddSplineTangent = function (tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, useQuaternion) {
|
|
2763
2659
|
var tangent;
|
|
2764
2660
|
var tangentValue = tangentType === _TangentType.INTANGENT ? keyFrame.inTangent : keyFrame.outTangent;
|
|
2765
2661
|
if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
|
|
@@ -2772,12 +2668,6 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2772
2668
|
var array = tangentValue;
|
|
2773
2669
|
tangent = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();
|
|
2774
2670
|
}
|
|
2775
|
-
if (convertToRightHandedSystem) {
|
|
2776
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(tangent);
|
|
2777
|
-
if (!babylonTransformNode.parent) {
|
|
2778
|
-
tangent = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(tangent)).asArray();
|
|
2779
|
-
}
|
|
2780
|
-
}
|
|
2781
2671
|
}
|
|
2782
2672
|
else {
|
|
2783
2673
|
tangent = [0, 0, 0, 0];
|
|
@@ -2794,15 +2684,6 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2794
2684
|
else {
|
|
2795
2685
|
if (tangentValue) {
|
|
2796
2686
|
tangent = tangentValue.asArray();
|
|
2797
|
-
if (convertToRightHandedSystem) {
|
|
2798
|
-
if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2799
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionArray3FromRef(tangent);
|
|
2800
|
-
if (!babylonTransformNode.parent) {
|
|
2801
|
-
tangent[0] *= -1; // x
|
|
2802
|
-
tangent[2] *= -1; // z
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
2687
|
}
|
|
2807
2688
|
else {
|
|
2808
2689
|
tangent = [0, 0, 0];
|
|
@@ -2910,7 +2791,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2910
2791
|
/* harmony export */ "_Exporter": () => (/* binding */ _Exporter)
|
|
2911
2792
|
/* harmony export */ });
|
|
2912
2793
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
|
|
2913
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/multiMaterial */ "core/
|
|
2794
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/multiMaterial */ "core/Meshes/mesh");
|
|
2914
2795
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
|
|
2915
2796
|
/* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFMaterialExporter.js");
|
|
2916
2797
|
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
|
|
@@ -2937,6 +2818,54 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2937
2818
|
|
|
2938
2819
|
// Matrix that converts handedness on the X-axis.
|
|
2939
2820
|
var convertHandednessMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Matrix.Compose(new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(-1, 1, 1), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.Identity(), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero());
|
|
2821
|
+
function isNoopNode(node, useRightHandedSystem) {
|
|
2822
|
+
if (!(node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode)) {
|
|
2823
|
+
return false;
|
|
2824
|
+
}
|
|
2825
|
+
// Transform
|
|
2826
|
+
if (useRightHandedSystem) {
|
|
2827
|
+
var matrix = node.getWorldMatrix();
|
|
2828
|
+
if (!matrix.isIdentity()) {
|
|
2829
|
+
return false;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
else {
|
|
2833
|
+
var matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
|
|
2834
|
+
if (!matrix.isIdentity()) {
|
|
2835
|
+
return false;
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
// Geometry
|
|
2839
|
+
if ((node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh && node.geometry) || (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh && node.sourceMesh.geometry)) {
|
|
2840
|
+
return false;
|
|
2841
|
+
}
|
|
2842
|
+
return true;
|
|
2843
|
+
}
|
|
2844
|
+
function convertNodeHandedness(node) {
|
|
2845
|
+
var translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector3[0]);
|
|
2846
|
+
var rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Quaternion[0]);
|
|
2847
|
+
var scale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArrayToRef(node.scale || [1, 1, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector3[1]);
|
|
2848
|
+
var matrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Matrix.ComposeToRef(scale, rotation, translation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]).multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
|
|
2849
|
+
matrix.decompose(scale, rotation, translation);
|
|
2850
|
+
if (translation.equalsToFloats(0, 0, 0)) {
|
|
2851
|
+
delete node.translation;
|
|
2852
|
+
}
|
|
2853
|
+
else {
|
|
2854
|
+
node.translation = translation.asArray();
|
|
2855
|
+
}
|
|
2856
|
+
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.IsIdentity(rotation)) {
|
|
2857
|
+
delete node.rotation;
|
|
2858
|
+
}
|
|
2859
|
+
else {
|
|
2860
|
+
node.rotation = rotation.asArray();
|
|
2861
|
+
}
|
|
2862
|
+
if (scale.equalsToFloats(1, 1, 1)) {
|
|
2863
|
+
delete node.scale;
|
|
2864
|
+
}
|
|
2865
|
+
else {
|
|
2866
|
+
node.scale = scale.asArray();
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2940
2869
|
/**
|
|
2941
2870
|
* Converts Babylon Scene into glTF 2.0.
|
|
2942
2871
|
* @internal
|
|
@@ -2948,10 +2877,6 @@ var _Exporter = /** @class */ (function () {
|
|
|
2948
2877
|
* @param options Options to modify the behavior of the exporter
|
|
2949
2878
|
*/
|
|
2950
2879
|
function _Exporter(babylonScene, options) {
|
|
2951
|
-
/*
|
|
2952
|
-
* Specifies if root Babylon empty nodes that act as a coordinate space transform should be included in export
|
|
2953
|
-
*/
|
|
2954
|
-
this._includeCoordinateSystemConversionNodes = false;
|
|
2955
2880
|
this._extensions = {};
|
|
2956
2881
|
this._glTF = {
|
|
2957
2882
|
asset: { generator: "Babylon.js v".concat(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Engine.Version), version: "2.0" },
|
|
@@ -2977,8 +2902,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
2977
2902
|
this._imageData = {};
|
|
2978
2903
|
this._orderedImageData = [];
|
|
2979
2904
|
this._options = options || {};
|
|
2980
|
-
this._animationSampleRate =
|
|
2981
|
-
this._includeCoordinateSystemConversionNodes = options && options.includeCoordinateSystemConversionNodes ? true : false;
|
|
2905
|
+
this._animationSampleRate = this._options.animationSampleRate || 1 / 60;
|
|
2982
2906
|
this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__._GLTFMaterialExporter(this);
|
|
2983
2907
|
this._loadExtensions();
|
|
2984
2908
|
}
|
|
@@ -3157,28 +3081,24 @@ var _Exporter = /** @class */ (function () {
|
|
|
3157
3081
|
* clock-wise during export to glTF
|
|
3158
3082
|
* @param submesh BabylonJS submesh
|
|
3159
3083
|
* @param primitiveMode Primitive mode of the mesh
|
|
3160
|
-
* @param sideOrientation the winding order of the submesh
|
|
3161
3084
|
* @param vertexBufferKind The type of vertex attribute
|
|
3162
3085
|
* @param meshAttributeArray The vertex attribute data
|
|
3163
3086
|
* @param byteOffset The offset to the binary data
|
|
3164
3087
|
* @param binaryWriter The binary data for the glTF file
|
|
3165
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3166
3088
|
*/
|
|
3167
|
-
_Exporter.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode,
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
break;
|
|
3181
|
-
}
|
|
3089
|
+
_Exporter.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
3090
|
+
switch (primitiveMode) {
|
|
3091
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleFillMode: {
|
|
3092
|
+
this._reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
3093
|
+
break;
|
|
3094
|
+
}
|
|
3095
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleStripDrawMode: {
|
|
3096
|
+
this._reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
3097
|
+
break;
|
|
3098
|
+
}
|
|
3099
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.TriangleFanDrawMode: {
|
|
3100
|
+
this._reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
3101
|
+
break;
|
|
3182
3102
|
}
|
|
3183
3103
|
}
|
|
3184
3104
|
};
|
|
@@ -3186,15 +3106,12 @@ var _Exporter = /** @class */ (function () {
|
|
|
3186
3106
|
* Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
|
|
3187
3107
|
* clock-wise during export to glTF
|
|
3188
3108
|
* @param submesh BabylonJS submesh
|
|
3189
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
3190
|
-
* @param sideOrientation the winding order of the submesh
|
|
3191
3109
|
* @param vertexBufferKind The type of vertex attribute
|
|
3192
3110
|
* @param meshAttributeArray The vertex attribute data
|
|
3193
3111
|
* @param byteOffset The offset to the binary data
|
|
3194
3112
|
* @param binaryWriter The binary data for the glTF file
|
|
3195
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3196
3113
|
*/
|
|
3197
|
-
_Exporter.prototype._reorderTriangleFillMode = function (submesh,
|
|
3114
|
+
_Exporter.prototype._reorderTriangleFillMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
3198
3115
|
var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
3199
3116
|
if (vertexBuffer) {
|
|
3200
3117
|
var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
@@ -3255,7 +3172,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3255
3172
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
3256
3173
|
}
|
|
3257
3174
|
}
|
|
3258
|
-
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind,
|
|
3175
|
+
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
|
|
3259
3176
|
}
|
|
3260
3177
|
}
|
|
3261
3178
|
else {
|
|
@@ -3266,15 +3183,12 @@ var _Exporter = /** @class */ (function () {
|
|
|
3266
3183
|
* Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
|
|
3267
3184
|
* clock-wise during export to glTF
|
|
3268
3185
|
* @param submesh BabylonJS submesh
|
|
3269
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
3270
|
-
* @param sideOrientation the winding order of the submesh
|
|
3271
3186
|
* @param vertexBufferKind The type of vertex attribute
|
|
3272
3187
|
* @param meshAttributeArray The vertex attribute data
|
|
3273
3188
|
* @param byteOffset The offset to the binary data
|
|
3274
3189
|
* @param binaryWriter The binary data for the glTF file
|
|
3275
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3276
3190
|
*/
|
|
3277
|
-
_Exporter.prototype._reorderTriangleStripDrawMode = function (submesh,
|
|
3191
|
+
_Exporter.prototype._reorderTriangleStripDrawMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
3278
3192
|
var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
3279
3193
|
if (vertexBuffer) {
|
|
3280
3194
|
var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
@@ -3316,7 +3230,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3316
3230
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
3317
3231
|
}
|
|
3318
3232
|
}
|
|
3319
|
-
this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind,
|
|
3233
|
+
this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, binaryWriter);
|
|
3320
3234
|
}
|
|
3321
3235
|
else {
|
|
3322
3236
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
|
|
@@ -3326,15 +3240,12 @@ var _Exporter = /** @class */ (function () {
|
|
|
3326
3240
|
* Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
|
|
3327
3241
|
* clock-wise during export to glTF
|
|
3328
3242
|
* @param submesh BabylonJS submesh
|
|
3329
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
3330
|
-
* @param sideOrientation the winding order of the submesh
|
|
3331
3243
|
* @param vertexBufferKind The type of vertex attribute
|
|
3332
3244
|
* @param meshAttributeArray The vertex attribute data
|
|
3333
3245
|
* @param byteOffset The offset to the binary data
|
|
3334
3246
|
* @param binaryWriter The binary data for the glTF file
|
|
3335
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3336
3247
|
*/
|
|
3337
|
-
_Exporter.prototype._reorderTriangleFanMode = function (submesh,
|
|
3248
|
+
_Exporter.prototype._reorderTriangleFanMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
3338
3249
|
var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
3339
3250
|
if (vertexBuffer) {
|
|
3340
3251
|
var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
@@ -3378,7 +3289,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3378
3289
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
3379
3290
|
}
|
|
3380
3291
|
}
|
|
3381
|
-
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind,
|
|
3292
|
+
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
|
|
3382
3293
|
}
|
|
3383
3294
|
else {
|
|
3384
3295
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
|
|
@@ -3389,29 +3300,11 @@ var _Exporter = /** @class */ (function () {
|
|
|
3389
3300
|
* @param vertices The vertices to write to the binary writer
|
|
3390
3301
|
* @param byteOffset The offset into the binary writer to overwrite binary data
|
|
3391
3302
|
* @param vertexAttributeKind The vertex attribute type
|
|
3392
|
-
* @param meshAttributeArray The vertex attribute data
|
|
3393
3303
|
* @param binaryWriter The writer containing the binary data
|
|
3394
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3395
3304
|
*/
|
|
3396
|
-
_Exporter.prototype._writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind,
|
|
3305
|
+
_Exporter.prototype._writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind, binaryWriter) {
|
|
3397
3306
|
for (var _i = 0, vertices_1 = vertices; _i < vertices_1.length; _i++) {
|
|
3398
3307
|
var vertex = vertices_1[_i];
|
|
3399
|
-
if (convertToRightHandedSystem && !(vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.ColorKind) && !(vertex instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector2)) {
|
|
3400
|
-
if (vertex instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3) {
|
|
3401
|
-
if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind) {
|
|
3402
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(vertex);
|
|
3403
|
-
}
|
|
3404
|
-
else if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind) {
|
|
3405
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(vertex);
|
|
3406
|
-
}
|
|
3407
|
-
else {
|
|
3408
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported vertex attribute kind!");
|
|
3409
|
-
}
|
|
3410
|
-
}
|
|
3411
|
-
else {
|
|
3412
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(vertex);
|
|
3413
|
-
}
|
|
3414
|
-
}
|
|
3415
3308
|
if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind) {
|
|
3416
3309
|
vertex.normalize();
|
|
3417
3310
|
}
|
|
@@ -3433,10 +3326,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
3433
3326
|
* @param meshAttributeArray Array containing the attribute data
|
|
3434
3327
|
* @param stride Specifies the space between data
|
|
3435
3328
|
* @param binaryWriter The buffer to write the binary data to
|
|
3436
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3437
3329
|
* @param babylonTransformNode
|
|
3438
3330
|
*/
|
|
3439
|
-
_Exporter.prototype._writeAttributeData = function (vertexBufferKind, attributeComponentKind, meshAttributeArray, stride, binaryWriter,
|
|
3331
|
+
_Exporter.prototype._writeAttributeData = function (vertexBufferKind, attributeComponentKind, meshAttributeArray, stride, binaryWriter, babylonTransformNode) {
|
|
3440
3332
|
var vertexAttributes = [];
|
|
3441
3333
|
var index;
|
|
3442
3334
|
switch (vertexBufferKind) {
|
|
@@ -3444,9 +3336,6 @@ var _Exporter = /** @class */ (function () {
|
|
|
3444
3336
|
for (var k = 0, length_2 = meshAttributeArray.length / stride; k < length_2; ++k) {
|
|
3445
3337
|
index = k * stride;
|
|
3446
3338
|
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
|
|
3447
|
-
if (convertToRightHandedSystem) {
|
|
3448
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(vertexData);
|
|
3449
|
-
}
|
|
3450
3339
|
vertexAttributes.push(vertexData.asArray());
|
|
3451
3340
|
}
|
|
3452
3341
|
break;
|
|
@@ -3455,11 +3344,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3455
3344
|
for (var k = 0, length_3 = meshAttributeArray.length / stride; k < length_3; ++k) {
|
|
3456
3345
|
index = k * stride;
|
|
3457
3346
|
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
|
|
3458
|
-
|
|
3459
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(vertexData);
|
|
3460
|
-
}
|
|
3461
|
-
vertexData.normalize();
|
|
3462
|
-
vertexAttributes.push(vertexData.asArray());
|
|
3347
|
+
vertexAttributes.push(vertexData.normalize().asArray());
|
|
3463
3348
|
}
|
|
3464
3349
|
break;
|
|
3465
3350
|
}
|
|
@@ -3467,9 +3352,6 @@ var _Exporter = /** @class */ (function () {
|
|
|
3467
3352
|
for (var k = 0, length_4 = meshAttributeArray.length / stride; k < length_4; ++k) {
|
|
3468
3353
|
index = k * stride;
|
|
3469
3354
|
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector4.FromArray(meshAttributeArray, index);
|
|
3470
|
-
if (convertToRightHandedSystem) {
|
|
3471
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(vertexData);
|
|
3472
|
-
}
|
|
3473
3355
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
|
|
3474
3356
|
vertexAttributes.push(vertexData.asArray());
|
|
3475
3357
|
}
|
|
@@ -3502,7 +3384,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
3502
3384
|
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UV2Kind: {
|
|
3503
3385
|
for (var k = 0, length_6 = meshAttributeArray.length / stride; k < length_6; ++k) {
|
|
3504
3386
|
index = k * stride;
|
|
3505
|
-
|
|
3387
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector2.FromArray(meshAttributeArray, index);
|
|
3388
|
+
vertexAttributes.push(vertexData.asArray());
|
|
3506
3389
|
}
|
|
3507
3390
|
break;
|
|
3508
3391
|
}
|
|
@@ -3571,10 +3454,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
3571
3454
|
* @param morphTargetAttributeArray
|
|
3572
3455
|
* @param stride Specifies the space between data
|
|
3573
3456
|
* @param binaryWriter The buffer to write the binary data to
|
|
3574
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3575
3457
|
* @param minMax
|
|
3576
3458
|
*/
|
|
3577
|
-
_Exporter.prototype.writeMorphTargetAttributeData = function (vertexBufferKind, attributeComponentKind, meshPrimitive,
|
|
3459
|
+
_Exporter.prototype.writeMorphTargetAttributeData = function (vertexBufferKind, attributeComponentKind, meshPrimitive, meshAttributeArray, morphTargetAttributeArray, stride, binaryWriter, minMax) {
|
|
3578
3460
|
var vertexAttributes = [];
|
|
3579
3461
|
var index;
|
|
3580
3462
|
var difference = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3();
|
|
@@ -3586,9 +3468,6 @@ var _Exporter = /** @class */ (function () {
|
|
|
3586
3468
|
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
|
|
3587
3469
|
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index);
|
|
3588
3470
|
difference = morphData.subtractToRef(vertexData, difference);
|
|
3589
|
-
if (convertToRightHandedSystem) {
|
|
3590
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(difference);
|
|
3591
|
-
}
|
|
3592
3471
|
if (minMax) {
|
|
3593
3472
|
minMax.min.copyFromFloats(Math.min(difference.x, minMax.min.x), Math.min(difference.y, minMax.min.y), Math.min(difference.z, minMax.min.z));
|
|
3594
3473
|
minMax.max.copyFromFloats(Math.max(difference.x, minMax.max.x), Math.max(difference.y, minMax.max.y), Math.max(difference.z, minMax.max.z));
|
|
@@ -3600,14 +3479,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
3600
3479
|
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind: {
|
|
3601
3480
|
for (var k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
3602
3481
|
index = meshPrimitive.indexStart + k * stride;
|
|
3603
|
-
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index);
|
|
3604
|
-
|
|
3605
|
-
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index);
|
|
3606
|
-
morphData.normalize();
|
|
3482
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(meshAttributeArray, index).normalize();
|
|
3483
|
+
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index).normalize();
|
|
3607
3484
|
difference = morphData.subtractToRef(vertexData, difference);
|
|
3608
|
-
if (convertToRightHandedSystem) {
|
|
3609
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(difference);
|
|
3610
|
-
}
|
|
3611
3485
|
vertexAttributes.push(difference.asArray());
|
|
3612
3486
|
}
|
|
3613
3487
|
break;
|
|
@@ -3620,9 +3494,6 @@ var _Exporter = /** @class */ (function () {
|
|
|
3620
3494
|
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector4.FromArray(morphTargetAttributeArray, index);
|
|
3621
3495
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._NormalizeTangentFromRef(morphData);
|
|
3622
3496
|
difference4 = morphData.subtractToRef(vertexData, difference4);
|
|
3623
|
-
if (convertToRightHandedSystem) {
|
|
3624
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(difference4);
|
|
3625
|
-
}
|
|
3626
3497
|
vertexAttributes.push([difference4.x, difference4.y, difference4.z]);
|
|
3627
3498
|
}
|
|
3628
3499
|
break;
|
|
@@ -3784,7 +3655,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3784
3655
|
_Exporter.prototype._generateBinaryAsync = function () {
|
|
3785
3656
|
var _this = this;
|
|
3786
3657
|
var binaryWriter = new _BinaryWriter(4);
|
|
3787
|
-
return this._createSceneAsync(
|
|
3658
|
+
return this._createSceneAsync(binaryWriter).then(function () {
|
|
3788
3659
|
if (_this._localEngine) {
|
|
3789
3660
|
_this._localEngine.dispose();
|
|
3790
3661
|
}
|
|
@@ -3903,16 +3774,13 @@ var _Exporter = /** @class */ (function () {
|
|
|
3903
3774
|
* Sets the TRS for each node
|
|
3904
3775
|
* @param node glTF Node for storing the transformation data
|
|
3905
3776
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
3906
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3907
3777
|
*/
|
|
3908
|
-
_Exporter.prototype._setNodeTransformation = function (node, babylonTransformNode
|
|
3778
|
+
_Exporter.prototype._setNodeTransformation = function (node, babylonTransformNode) {
|
|
3909
3779
|
if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {
|
|
3910
3780
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Pivot points are not supported in the glTF serializer");
|
|
3911
3781
|
}
|
|
3912
3782
|
if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {
|
|
3913
|
-
node.translation =
|
|
3914
|
-
? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3(babylonTransformNode.position).asArray()
|
|
3915
|
-
: babylonTransformNode.position.asArray();
|
|
3783
|
+
node.translation = babylonTransformNode.position.asArray();
|
|
3916
3784
|
}
|
|
3917
3785
|
if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {
|
|
3918
3786
|
node.scale = babylonTransformNode.scaling.asArray();
|
|
@@ -3922,21 +3790,15 @@ var _Exporter = /** @class */ (function () {
|
|
|
3922
3790
|
rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
|
|
3923
3791
|
}
|
|
3924
3792
|
if (!core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.IsIdentity(rotationQuaternion)) {
|
|
3925
|
-
if (convertToRightHandedSystem) {
|
|
3926
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
3927
|
-
}
|
|
3928
3793
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3929
3794
|
}
|
|
3930
3795
|
};
|
|
3931
|
-
_Exporter.prototype._setCameraTransformation = function (node, babylonCamera
|
|
3796
|
+
_Exporter.prototype._setCameraTransformation = function (node, babylonCamera) {
|
|
3932
3797
|
if (!babylonCamera.position.equalsToFloats(0, 0, 0)) {
|
|
3933
|
-
node.translation =
|
|
3798
|
+
node.translation = babylonCamera.position.asArray();
|
|
3934
3799
|
}
|
|
3935
3800
|
var rotationQuaternion = babylonCamera.rotationQuaternion; // we target the local transformation if one.
|
|
3936
3801
|
if (rotationQuaternion && !core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.IsIdentity(rotationQuaternion)) {
|
|
3937
|
-
if (convertToRightHandedSystem) {
|
|
3938
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
3939
|
-
}
|
|
3940
3802
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3941
3803
|
}
|
|
3942
3804
|
};
|
|
@@ -3956,9 +3818,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
3956
3818
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
3957
3819
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
3958
3820
|
* @param byteStride
|
|
3959
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3960
3821
|
*/
|
|
3961
|
-
_Exporter.prototype._createBufferViewKind = function (kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride
|
|
3822
|
+
_Exporter.prototype._createBufferViewKind = function (kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride) {
|
|
3962
3823
|
var bufferMesh = babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh
|
|
3963
3824
|
? babylonTransformNode
|
|
3964
3825
|
: babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh
|
|
@@ -3972,7 +3833,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3972
3833
|
var byteLength = vertexData.length * typeByteLength;
|
|
3973
3834
|
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + " - " + bufferMesh.name);
|
|
3974
3835
|
this._bufferViews.push(bufferView);
|
|
3975
|
-
this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter,
|
|
3836
|
+
this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter, babylonTransformNode);
|
|
3976
3837
|
}
|
|
3977
3838
|
}
|
|
3978
3839
|
};
|
|
@@ -3982,9 +3843,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
3982
3843
|
* @param meshPrimitive
|
|
3983
3844
|
* @param babylonMorphTarget the morph target to be exported
|
|
3984
3845
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
3985
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3986
3846
|
*/
|
|
3987
|
-
_Exporter.prototype._setMorphTargetAttributes = function (babylonSubMesh, meshPrimitive, babylonMorphTarget, binaryWriter
|
|
3847
|
+
_Exporter.prototype._setMorphTargetAttributes = function (babylonSubMesh, meshPrimitive, babylonMorphTarget, binaryWriter) {
|
|
3988
3848
|
if (babylonMorphTarget) {
|
|
3989
3849
|
if (!meshPrimitive.targets) {
|
|
3990
3850
|
meshPrimitive.targets = [];
|
|
@@ -4003,7 +3863,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4003
3863
|
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "NORMAL", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
4004
3864
|
this._accessors.push(accessor);
|
|
4005
3865
|
target.NORMAL = this._accessors.length - 1;
|
|
4006
|
-
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh,
|
|
3866
|
+
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexNormals, morphNormals, byteStride / 4, binaryWriter);
|
|
4007
3867
|
}
|
|
4008
3868
|
if (babylonMorphTarget.hasPositions) {
|
|
4009
3869
|
var vertexPositions = mesh.getVerticesData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind, undefined, undefined, true);
|
|
@@ -4018,7 +3878,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4018
3878
|
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "POSITION", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
4019
3879
|
this._accessors.push(accessor);
|
|
4020
3880
|
target.POSITION = this._accessors.length - 1;
|
|
4021
|
-
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh,
|
|
3881
|
+
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexPositions, morphPositions, byteStride / 4, binaryWriter, minMax);
|
|
4022
3882
|
accessor.min = minMax.min.asArray();
|
|
4023
3883
|
accessor.max = minMax.max.asArray();
|
|
4024
3884
|
}
|
|
@@ -4034,7 +3894,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4034
3894
|
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "TANGENT", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
4035
3895
|
this._accessors.push(accessor);
|
|
4036
3896
|
target.TANGENT = this._accessors.length - 1;
|
|
4037
|
-
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh,
|
|
3897
|
+
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexTangents, morphTangents, byteStride / 4, binaryWriter);
|
|
4038
3898
|
}
|
|
4039
3899
|
meshPrimitive.targets.push(target);
|
|
4040
3900
|
}
|
|
@@ -4154,10 +4014,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
4154
4014
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
4155
4015
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
4156
4016
|
* @param binaryWriter Buffer to write the attribute data to
|
|
4157
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
4158
4017
|
*/
|
|
4159
|
-
_Exporter.prototype._setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter
|
|
4160
|
-
var _a;
|
|
4018
|
+
_Exporter.prototype._setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter) {
|
|
4161
4019
|
var promises = [];
|
|
4162
4020
|
var bufferMesh = null;
|
|
4163
4021
|
var bufferView;
|
|
@@ -4198,7 +4056,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4198
4056
|
if (attribute.byteStride === 12) {
|
|
4199
4057
|
attribute.accessorType = "VEC3" /* AccessorType.VEC3 */;
|
|
4200
4058
|
}
|
|
4201
|
-
this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride
|
|
4059
|
+
this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride);
|
|
4202
4060
|
attribute.bufferViewIndex = this._bufferViews.length - 1;
|
|
4203
4061
|
vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;
|
|
4204
4062
|
}
|
|
@@ -4217,8 +4075,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
4217
4075
|
}
|
|
4218
4076
|
if (bufferMesh.subMeshes) {
|
|
4219
4077
|
// go through all mesh primitives (submeshes)
|
|
4220
|
-
for (var
|
|
4221
|
-
var submesh =
|
|
4078
|
+
for (var _a = 0, _b = bufferMesh.subMeshes; _a < _b.length; _a++) {
|
|
4079
|
+
var submesh = _b[_a];
|
|
4222
4080
|
var babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;
|
|
4223
4081
|
var materialIndex = null;
|
|
4224
4082
|
if (babylonMaterial) {
|
|
@@ -4249,8 +4107,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
4249
4107
|
var glTFMaterial = materialIndex != null ? this._materials[materialIndex] : null;
|
|
4250
4108
|
var meshPrimitive = { attributes: {} };
|
|
4251
4109
|
this._setPrimitiveMode(meshPrimitive, primitiveMode);
|
|
4252
|
-
for (var
|
|
4253
|
-
var attribute = attributeData_2[
|
|
4110
|
+
for (var _c = 0, attributeData_2 = attributeData; _c < attributeData_2.length; _c++) {
|
|
4111
|
+
var attribute = attributeData_2[_c];
|
|
4254
4112
|
var attributeKind = attribute.kind;
|
|
4255
4113
|
if ((attributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UVKind || attributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UV2Kind) && !this._options.exportUnusedUVs) {
|
|
4256
4114
|
if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {
|
|
@@ -4267,7 +4125,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4267
4125
|
// check to see if bufferviewindex has a numeric value assigned.
|
|
4268
4126
|
minMax = { min: null, max: null };
|
|
4269
4127
|
if (attributeKind == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind) {
|
|
4270
|
-
minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride
|
|
4128
|
+
minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride);
|
|
4271
4129
|
}
|
|
4272
4130
|
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, attribute.accessorComponentType, vertexData.length / stride, 0, minMax.min, minMax.max);
|
|
4273
4131
|
this._accessors.push(accessor);
|
|
@@ -4284,10 +4142,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4284
4142
|
}
|
|
4285
4143
|
if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
|
|
4286
4144
|
var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
|
|
4287
|
-
if (
|
|
4288
|
-
(sideOrientation == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation &&
|
|
4289
|
-
convertToRightHandedSystem &&
|
|
4290
|
-
bufferMesh.overrideMaterialSideOrientation !== ((_a = bufferMesh.material) === null || _a === void 0 ? void 0 : _a.sideOrientation))) {
|
|
4145
|
+
if (sideOrientation === (this._babylonScene.useRightHandedSystem ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.CounterClockWiseSideOrientation)) {
|
|
4291
4146
|
var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
|
|
4292
4147
|
if (byteOffset == null) {
|
|
4293
4148
|
byteOffset = 0;
|
|
@@ -4300,15 +4155,12 @@ var _Exporter = /** @class */ (function () {
|
|
|
4300
4155
|
this._reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter);
|
|
4301
4156
|
}
|
|
4302
4157
|
else {
|
|
4303
|
-
for (var
|
|
4304
|
-
var attribute = attributeData_3[
|
|
4158
|
+
for (var _d = 0, attributeData_3 = attributeData; _d < attributeData_3.length; _d++) {
|
|
4159
|
+
var attribute = attributeData_3[_d];
|
|
4305
4160
|
var vertexData = bufferMesh.getVerticesData(attribute.kind, undefined, undefined, true);
|
|
4306
4161
|
if (vertexData) {
|
|
4307
|
-
var byteOffset_1 = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset;
|
|
4308
|
-
|
|
4309
|
-
byteOffset_1 = 0;
|
|
4310
|
-
}
|
|
4311
|
-
this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, sideOrientation, attribute.kind, vertexData, byteOffset_1, binaryWriter, convertToRightHandedSystem);
|
|
4162
|
+
var byteOffset_1 = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset || 0;
|
|
4163
|
+
this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, attribute.kind, vertexData, byteOffset_1, binaryWriter);
|
|
4312
4164
|
}
|
|
4313
4165
|
}
|
|
4314
4166
|
}
|
|
@@ -4319,7 +4171,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4319
4171
|
var target = void 0;
|
|
4320
4172
|
for (var i = 0; i < morphTargetManager.numTargets; ++i) {
|
|
4321
4173
|
target = morphTargetManager.getTarget(i);
|
|
4322
|
-
this._setMorphTargetAttributes(submesh, meshPrimitive, target, binaryWriter
|
|
4174
|
+
this._setMorphTargetAttributes(submesh, meshPrimitive, target, binaryWriter);
|
|
4323
4175
|
}
|
|
4324
4176
|
}
|
|
4325
4177
|
mesh.primitives.push(meshPrimitive);
|
|
@@ -4332,80 +4184,44 @@ var _Exporter = /** @class */ (function () {
|
|
|
4332
4184
|
/* do nothing */
|
|
4333
4185
|
});
|
|
4334
4186
|
};
|
|
4335
|
-
/**
|
|
4336
|
-
* Check if the node is used to convert its descendants from a right handed coordinate system to the Babylon scene's coordinate system.
|
|
4337
|
-
* @param node The node to check
|
|
4338
|
-
* @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
|
|
4339
|
-
*/
|
|
4340
|
-
_Exporter.prototype._isBabylonCoordinateSystemConvertingNode = function (node) {
|
|
4341
|
-
if (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode) {
|
|
4342
|
-
// Transform
|
|
4343
|
-
var matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
|
|
4344
|
-
if (!matrix.isIdentity()) {
|
|
4345
|
-
return false;
|
|
4346
|
-
}
|
|
4347
|
-
// Geometry
|
|
4348
|
-
if ((node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh && node.geometry !== null) || (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh && node.sourceMesh.geometry !== null)) {
|
|
4349
|
-
return false;
|
|
4350
|
-
}
|
|
4351
|
-
return true;
|
|
4352
|
-
}
|
|
4353
|
-
return false;
|
|
4354
|
-
};
|
|
4355
4187
|
/**
|
|
4356
4188
|
* Creates a glTF scene based on the array of meshes
|
|
4357
4189
|
* Returns the the total byte offset
|
|
4358
4190
|
* @param babylonScene Babylon scene to get the mesh data from
|
|
4359
4191
|
* @param binaryWriter Buffer to write binary data to
|
|
4360
4192
|
*/
|
|
4361
|
-
_Exporter.prototype._createSceneAsync = function (
|
|
4193
|
+
_Exporter.prototype._createSceneAsync = function (binaryWriter) {
|
|
4362
4194
|
var _this = this;
|
|
4195
|
+
var _a;
|
|
4363
4196
|
var scene = { nodes: [] };
|
|
4364
4197
|
var glTFNodeIndex;
|
|
4365
4198
|
var glTFNode;
|
|
4366
4199
|
var directDescendents;
|
|
4367
|
-
var nodes = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)([],
|
|
4368
|
-
var
|
|
4369
|
-
this._convertToRightHandedSystem = !babylonScene.useRightHandedSystem;
|
|
4370
|
-
this._convertToRightHandedSystemMap = {};
|
|
4200
|
+
var nodes = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)([], this._babylonScene.transformNodes, true), this._babylonScene.meshes, true), this._babylonScene.lights, true), this._babylonScene.cameras, true);
|
|
4201
|
+
var removedRootNodes = new Set();
|
|
4371
4202
|
// Scene metadata
|
|
4372
|
-
if (
|
|
4203
|
+
if (this._babylonScene.metadata) {
|
|
4373
4204
|
if (this._options.metadataSelector) {
|
|
4374
|
-
scene.extras = this._options.metadataSelector(
|
|
4205
|
+
scene.extras = this._options.metadataSelector(this._babylonScene.metadata);
|
|
4375
4206
|
}
|
|
4376
|
-
else if (
|
|
4377
|
-
scene.extras =
|
|
4207
|
+
else if (this._babylonScene.metadata.gltf) {
|
|
4208
|
+
scene.extras = this._babylonScene.metadata.gltf.extras;
|
|
4378
4209
|
}
|
|
4379
4210
|
}
|
|
4380
|
-
//
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
babylonScene.rootNodes.forEach(function (rootNode) {
|
|
4389
|
-
if (_this._includeCoordinateSystemConversionNodes) {
|
|
4390
|
-
return;
|
|
4391
|
-
}
|
|
4392
|
-
if (_this._isBabylonCoordinateSystemConvertingNode(rootNode)) {
|
|
4393
|
-
rootNodesToLeftHanded.push(rootNode);
|
|
4394
|
-
// Exclude the node from list of nodes to export
|
|
4395
|
-
var indexRootNode = nodes.indexOf(rootNode);
|
|
4396
|
-
if (indexRootNode !== -1) {
|
|
4397
|
-
// should always be true
|
|
4398
|
-
nodes.splice(indexRootNode, 1);
|
|
4211
|
+
// Remove no-op root nodes
|
|
4212
|
+
if (((_a = this._options.removeNoopRootNodes) !== null && _a !== void 0 ? _a : true) && !this._options.includeCoordinateSystemConversionNodes) {
|
|
4213
|
+
for (var _i = 0, _b = this._babylonScene.rootNodes; _i < _b.length; _i++) {
|
|
4214
|
+
var rootNode = _b[_i];
|
|
4215
|
+
if (isNoopNode(rootNode, this._babylonScene.useRightHandedSystem)) {
|
|
4216
|
+
removedRootNodes.add(rootNode);
|
|
4217
|
+
// Exclude the node from list of nodes to export
|
|
4218
|
+
nodes.splice(nodes.indexOf(rootNode), 1);
|
|
4399
4219
|
}
|
|
4400
|
-
// Cancel conversion to right handed system
|
|
4401
|
-
rootNode.getDescendants(false).forEach(function (descendant) {
|
|
4402
|
-
_this._convertToRightHandedSystemMap[descendant.uniqueId] = false;
|
|
4403
|
-
});
|
|
4404
4220
|
}
|
|
4405
|
-
}
|
|
4221
|
+
}
|
|
4406
4222
|
// Export babylon cameras to glTFCamera
|
|
4407
4223
|
var cameraMap = new Map();
|
|
4408
|
-
|
|
4224
|
+
this._babylonScene.cameras.forEach(function (camera) {
|
|
4409
4225
|
if (!_this._options.shouldExportNode || _this._options.shouldExportNode(camera)) {
|
|
4410
4226
|
var glTFCamera = {
|
|
4411
4227
|
type: camera.mode === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera.PERSPECTIVE_CAMERA ? "perspective" /* CameraType.PERSPECTIVE */ : "orthographic" /* CameraType.ORTHOGRAPHIC */,
|
|
@@ -4435,10 +4251,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4435
4251
|
_this._cameras.push(glTFCamera);
|
|
4436
4252
|
}
|
|
4437
4253
|
});
|
|
4438
|
-
var
|
|
4254
|
+
var _c = this._getExportNodes(nodes), exportNodes = _c[0], exportMaterials = _c[1];
|
|
4439
4255
|
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* ImageMimeType.PNG */, true).then(function () {
|
|
4440
|
-
return _this._createNodeMapAndAnimationsAsync(
|
|
4441
|
-
return _this._createSkinsAsync(
|
|
4256
|
+
return _this._createNodeMapAndAnimationsAsync(exportNodes, binaryWriter).then(function (nodeMap) {
|
|
4257
|
+
return _this._createSkinsAsync(nodeMap, binaryWriter).then(function (skinMap) {
|
|
4442
4258
|
_this._nodeMap = nodeMap;
|
|
4443
4259
|
_this._totalByteLength = binaryWriter.getByteOffset();
|
|
4444
4260
|
if (_this._totalByteLength == undefined) {
|
|
@@ -4461,28 +4277,20 @@ var _Exporter = /** @class */ (function () {
|
|
|
4461
4277
|
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera) {
|
|
4462
4278
|
glTFNode.camera = cameraMap.get(babylonNode);
|
|
4463
4279
|
}
|
|
4464
|
-
if (
|
|
4465
|
-
|
|
4466
|
-
|
|
4280
|
+
if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
|
|
4281
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Log("Omitting " + babylonNode.name + " from scene.");
|
|
4282
|
+
}
|
|
4283
|
+
else {
|
|
4284
|
+
if (!babylonNode.parent && !_this._babylonScene.useRightHandedSystem) {
|
|
4285
|
+
convertNodeHandedness(glTFNode);
|
|
4467
4286
|
}
|
|
4468
|
-
|
|
4469
|
-
var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
|
|
4470
|
-
if (convertToRightHandedSystem) {
|
|
4471
|
-
if (glTFNode.translation) {
|
|
4472
|
-
glTFNode.translation[2] *= -1;
|
|
4473
|
-
glTFNode.translation[0] *= -1;
|
|
4474
|
-
}
|
|
4475
|
-
glTFNode.rotation = glTFNode.rotation
|
|
4476
|
-
? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray(glTFNode.rotation)).asArray()
|
|
4477
|
-
: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([0, 1, 0, 0]).asArray();
|
|
4478
|
-
}
|
|
4287
|
+
if (!babylonNode.parent || removedRootNodes.has(babylonNode.parent)) {
|
|
4479
4288
|
scene.nodes.push(glTFNodeIndex);
|
|
4480
4289
|
}
|
|
4481
4290
|
}
|
|
4482
4291
|
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh) {
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
glTFNode.skin = skinMap[babylonMesh.skeleton.uniqueId];
|
|
4292
|
+
if (babylonNode.skeleton) {
|
|
4293
|
+
glTFNode.skin = skinMap[babylonNode.skeleton.uniqueId];
|
|
4486
4294
|
}
|
|
4487
4295
|
}
|
|
4488
4296
|
directDescendents = babylonNode.getDescendants(true);
|
|
@@ -4544,12 +4352,11 @@ var _Exporter = /** @class */ (function () {
|
|
|
4544
4352
|
};
|
|
4545
4353
|
/**
|
|
4546
4354
|
* Creates a mapping of Node unique id to node index and handles animations
|
|
4547
|
-
* @param babylonScene Babylon Scene
|
|
4548
4355
|
* @param nodes Babylon transform nodes
|
|
4549
4356
|
* @param binaryWriter Buffer to write binary data to
|
|
4550
4357
|
* @returns Node mapping of unique id to index
|
|
4551
4358
|
*/
|
|
4552
|
-
_Exporter.prototype._createNodeMapAndAnimationsAsync = function (
|
|
4359
|
+
_Exporter.prototype._createNodeMapAndAnimationsAsync = function (nodes, binaryWriter) {
|
|
4553
4360
|
var _this = this;
|
|
4554
4361
|
var promiseChain = Promise.resolve();
|
|
4555
4362
|
var nodeMap = {};
|
|
@@ -4562,8 +4369,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4562
4369
|
var idleGLTFAnimations = [];
|
|
4563
4370
|
var _loop_1 = function (babylonNode) {
|
|
4564
4371
|
promiseChain = promiseChain.then(function () {
|
|
4565
|
-
|
|
4566
|
-
return _this._createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem).then(function (node) {
|
|
4372
|
+
return _this._createNodeAsync(babylonNode, binaryWriter).then(function (node) {
|
|
4567
4373
|
var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap, binaryWriter);
|
|
4568
4374
|
if (promise == null) {
|
|
4569
4375
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Not exporting node ".concat(babylonNode.name));
|
|
@@ -4577,10 +4383,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4577
4383
|
_this._nodes.push(node);
|
|
4578
4384
|
nodeIndex = _this._nodes.length - 1;
|
|
4579
4385
|
nodeMap[babylonNode.uniqueId] = nodeIndex;
|
|
4580
|
-
if (!
|
|
4581
|
-
_glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors,
|
|
4386
|
+
if (!_this._babylonScene.animationGroups.length) {
|
|
4387
|
+
_glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
|
|
4582
4388
|
if (babylonNode.animations.length) {
|
|
4583
|
-
_glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors,
|
|
4389
|
+
_glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
|
|
4584
4390
|
}
|
|
4585
4391
|
}
|
|
4586
4392
|
});
|
|
@@ -4601,8 +4407,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
4601
4407
|
_this._animations.push(idleGLTFAnimation);
|
|
4602
4408
|
}
|
|
4603
4409
|
});
|
|
4604
|
-
if (
|
|
4605
|
-
_glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(
|
|
4410
|
+
if (_this._babylonScene.animationGroups.length) {
|
|
4411
|
+
_glTFAnimation__WEBPACK_IMPORTED_MODULE_5__._GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(_this._babylonScene, _this._animations, nodeMap, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
|
|
4606
4412
|
}
|
|
4607
4413
|
return nodeMap;
|
|
4608
4414
|
});
|
|
@@ -4611,10 +4417,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
4611
4417
|
* Creates a glTF node from a Babylon mesh
|
|
4612
4418
|
* @param babylonNode Source Babylon mesh
|
|
4613
4419
|
* @param binaryWriter Buffer for storing geometry data
|
|
4614
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
4615
4420
|
* @returns glTF node
|
|
4616
4421
|
*/
|
|
4617
|
-
_Exporter.prototype._createNodeAsync = function (babylonNode, binaryWriter
|
|
4422
|
+
_Exporter.prototype._createNodeAsync = function (babylonNode, binaryWriter) {
|
|
4618
4423
|
var _this = this;
|
|
4619
4424
|
return Promise.resolve().then(function () {
|
|
4620
4425
|
// create node to hold translation/rotation/scale and the mesh
|
|
@@ -4626,7 +4431,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4626
4431
|
}
|
|
4627
4432
|
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode) {
|
|
4628
4433
|
// Set transformation
|
|
4629
|
-
_this._setNodeTransformation(node, babylonNode
|
|
4434
|
+
_this._setNodeTransformation(node, babylonNode);
|
|
4630
4435
|
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh) {
|
|
4631
4436
|
var morphTargetManager = babylonNode.morphTargetManager;
|
|
4632
4437
|
if (morphTargetManager && morphTargetManager.numTargets > 0) {
|
|
@@ -4636,7 +4441,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4636
4441
|
}
|
|
4637
4442
|
}
|
|
4638
4443
|
}
|
|
4639
|
-
return _this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter
|
|
4444
|
+
return _this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter).then(function () {
|
|
4640
4445
|
if (mesh.primitives.length) {
|
|
4641
4446
|
_this._meshes.push(mesh);
|
|
4642
4447
|
node.mesh = _this._meshes.length - 1;
|
|
@@ -4645,7 +4450,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4645
4450
|
});
|
|
4646
4451
|
}
|
|
4647
4452
|
else if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera) {
|
|
4648
|
-
_this._setCameraTransformation(node, babylonNode
|
|
4453
|
+
_this._setCameraTransformation(node, babylonNode);
|
|
4649
4454
|
return node;
|
|
4650
4455
|
}
|
|
4651
4456
|
else {
|
|
@@ -4660,11 +4465,11 @@ var _Exporter = /** @class */ (function () {
|
|
|
4660
4465
|
* @param binaryWriter Buffer to write binary data to
|
|
4661
4466
|
* @returns Node mapping of unique id to index
|
|
4662
4467
|
*/
|
|
4663
|
-
_Exporter.prototype._createSkinsAsync = function (
|
|
4468
|
+
_Exporter.prototype._createSkinsAsync = function (nodeMap, binaryWriter) {
|
|
4664
4469
|
var _a;
|
|
4665
4470
|
var promiseChain = Promise.resolve();
|
|
4666
4471
|
var skinMap = {};
|
|
4667
|
-
for (var _i = 0, _b =
|
|
4472
|
+
for (var _i = 0, _b = this._babylonScene.skeletons; _i < _b.length; _i++) {
|
|
4668
4473
|
var skeleton = _b[_i];
|
|
4669
4474
|
if (skeleton.bones.length <= 0) {
|
|
4670
4475
|
continue;
|
|
@@ -4993,7 +4798,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4993
4798
|
/* harmony export */ "_GLTFMaterialExporter": () => (/* binding */ _GLTFMaterialExporter)
|
|
4994
4799
|
/* harmony export */ });
|
|
4995
4800
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
|
|
4996
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/dumpTools */ "core/
|
|
4801
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/dumpTools */ "core/Meshes/mesh");
|
|
4997
4802
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
|
|
4998
4803
|
|
|
4999
4804
|
|
|
@@ -6097,7 +5902,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6097
5902
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6098
5903
|
/* harmony export */ "_GLTFUtilities": () => (/* binding */ _GLTFUtilities)
|
|
6099
5904
|
/* harmony export */ });
|
|
6100
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/
|
|
5905
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/Meshes/mesh");
|
|
6101
5906
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
6102
5907
|
|
|
6103
5908
|
/**
|
|
@@ -6158,10 +5963,9 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
6158
5963
|
* @param positions Positions array of a mesh
|
|
6159
5964
|
* @param vertexStart Starting vertex offset to calculate min and max values
|
|
6160
5965
|
* @param vertexCount Number of vertices to check for min and max values
|
|
6161
|
-
* @param convertToRightHandedSystem
|
|
6162
5966
|
* @returns min number array and max number array
|
|
6163
5967
|
*/
|
|
6164
|
-
_GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount
|
|
5968
|
+
_GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount) {
|
|
6165
5969
|
var min = [Infinity, Infinity, Infinity];
|
|
6166
5970
|
var max = [-Infinity, -Infinity, -Infinity];
|
|
6167
5971
|
var positionStrideSize = 3;
|
|
@@ -6172,9 +5976,6 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
6172
5976
|
for (var i = vertexStart, length_1 = vertexStart + vertexCount; i < length_1; ++i) {
|
|
6173
5977
|
indexOffset = positionStrideSize * i;
|
|
6174
5978
|
position = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(positions, indexOffset);
|
|
6175
|
-
if (convertToRightHandedSystem) {
|
|
6176
|
-
_GLTFUtilities._GetRightHandedPositionVector3FromRef(position);
|
|
6177
|
-
}
|
|
6178
5979
|
vector = position.asArray();
|
|
6179
5980
|
for (var j = 0; j < positionStrideSize; ++j) {
|
|
6180
5981
|
var num = vector[j];
|
|
@@ -6190,82 +5991,6 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
6190
5991
|
}
|
|
6191
5992
|
return { min: min, max: max };
|
|
6192
5993
|
};
|
|
6193
|
-
/**
|
|
6194
|
-
* Converts a new right-handed Vector3
|
|
6195
|
-
* @param vector vector3 array
|
|
6196
|
-
* @returns right-handed Vector3
|
|
6197
|
-
*/
|
|
6198
|
-
_GLTFUtilities._GetRightHandedPositionVector3 = function (vector) {
|
|
6199
|
-
return new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(vector.x, vector.y, -vector.z);
|
|
6200
|
-
};
|
|
6201
|
-
/**
|
|
6202
|
-
* Converts a Vector3 to right-handed
|
|
6203
|
-
* @param vector Vector3 to convert to right-handed
|
|
6204
|
-
*/
|
|
6205
|
-
_GLTFUtilities._GetRightHandedPositionVector3FromRef = function (vector) {
|
|
6206
|
-
vector.z *= -1;
|
|
6207
|
-
};
|
|
6208
|
-
/**
|
|
6209
|
-
* Converts a three element number array to right-handed
|
|
6210
|
-
* @param vector number array to convert to right-handed
|
|
6211
|
-
*/
|
|
6212
|
-
_GLTFUtilities._GetRightHandedPositionArray3FromRef = function (vector) {
|
|
6213
|
-
vector[2] *= -1;
|
|
6214
|
-
};
|
|
6215
|
-
/**
|
|
6216
|
-
* Converts a new right-handed Vector3
|
|
6217
|
-
* @param vector vector3 array
|
|
6218
|
-
* @returns right-handed Vector3
|
|
6219
|
-
*/
|
|
6220
|
-
_GLTFUtilities._GetRightHandedNormalVector3 = function (vector) {
|
|
6221
|
-
return new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(vector.x, vector.y, -vector.z);
|
|
6222
|
-
};
|
|
6223
|
-
/**
|
|
6224
|
-
* Converts a Vector3 to right-handed
|
|
6225
|
-
* @param vector Vector3 to convert to right-handed
|
|
6226
|
-
*/
|
|
6227
|
-
_GLTFUtilities._GetRightHandedNormalVector3FromRef = function (vector) {
|
|
6228
|
-
vector.z *= -1;
|
|
6229
|
-
};
|
|
6230
|
-
/**
|
|
6231
|
-
* Converts a three element number array to right-handed
|
|
6232
|
-
* @param vector number array to convert to right-handed
|
|
6233
|
-
*/
|
|
6234
|
-
_GLTFUtilities._GetRightHandedNormalArray3FromRef = function (vector) {
|
|
6235
|
-
vector[2] *= -1;
|
|
6236
|
-
};
|
|
6237
|
-
/**
|
|
6238
|
-
* Converts a Vector4 to right-handed
|
|
6239
|
-
* @param vector Vector4 to convert to right-handed
|
|
6240
|
-
*/
|
|
6241
|
-
_GLTFUtilities._GetRightHandedVector4FromRef = function (vector) {
|
|
6242
|
-
vector.z *= -1;
|
|
6243
|
-
vector.w *= -1;
|
|
6244
|
-
};
|
|
6245
|
-
/**
|
|
6246
|
-
* Converts a Vector4 to right-handed
|
|
6247
|
-
* @param vector Vector4 to convert to right-handed
|
|
6248
|
-
*/
|
|
6249
|
-
_GLTFUtilities._GetRightHandedArray4FromRef = function (vector) {
|
|
6250
|
-
vector[2] *= -1;
|
|
6251
|
-
vector[3] *= -1;
|
|
6252
|
-
};
|
|
6253
|
-
/**
|
|
6254
|
-
* Converts a Quaternion to right-handed
|
|
6255
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
6256
|
-
*/
|
|
6257
|
-
_GLTFUtilities._GetRightHandedQuaternionFromRef = function (quaternion) {
|
|
6258
|
-
quaternion.x *= -1;
|
|
6259
|
-
quaternion.y *= -1;
|
|
6260
|
-
};
|
|
6261
|
-
/**
|
|
6262
|
-
* Converts a Quaternion to right-handed
|
|
6263
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
6264
|
-
*/
|
|
6265
|
-
_GLTFUtilities._GetRightHandedQuaternionArrayFromRef = function (quaternion) {
|
|
6266
|
-
quaternion[0] *= -1;
|
|
6267
|
-
quaternion[1] *= -1;
|
|
6268
|
-
};
|
|
6269
5994
|
_GLTFUtilities._NormalizeTangentFromRef = function (tangent) {
|
|
6270
5995
|
var length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);
|
|
6271
5996
|
if (length > 0) {
|
|
@@ -6664,7 +6389,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6664
6389
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6665
6390
|
/* harmony export */ "STLExport": () => (/* binding */ STLExport)
|
|
6666
6391
|
/* harmony export */ });
|
|
6667
|
-
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/
|
|
6392
|
+
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/Meshes/mesh");
|
|
6668
6393
|
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__);
|
|
6669
6394
|
|
|
6670
6395
|
|
|
@@ -6814,13 +6539,13 @@ var STLExport = /** @class */ (function () {
|
|
|
6814
6539
|
|
|
6815
6540
|
/***/ }),
|
|
6816
6541
|
|
|
6817
|
-
/***/ "core/
|
|
6542
|
+
/***/ "core/Meshes/mesh":
|
|
6818
6543
|
/*!****************************************************************************************************!*\
|
|
6819
6544
|
!*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
|
|
6820
6545
|
\****************************************************************************************************/
|
|
6821
6546
|
/***/ ((module) => {
|
|
6822
6547
|
|
|
6823
|
-
module.exports =
|
|
6548
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_core_Meshes_mesh__;
|
|
6824
6549
|
|
|
6825
6550
|
/***/ })
|
|
6826
6551
|
|