babylonjs-serializers 6.11.0 → 6.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.glTF2Serializer.js +519 -519
- 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 +25 -25
- package/babylon.objSerializer.js.map +1 -1
- package/babylon.objSerializer.min.js +1 -1
- package/babylon.objSerializer.min.js.map +1 -1
- package/babylon.stlSerializer.js +32 -32
- package/babylon.stlSerializer.js.map +1 -1
- package/babylon.stlSerializer.min.js +1 -1
- package/babylon.stlSerializer.min.js.map +1 -1
- package/babylonjs.serializers.js +589 -589
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/package.json +4 -4
- package/tsconfig.build.json +6 -4
- package/webpack.config.js +2 -2
|
@@ -7,24 +7,24 @@
|
|
|
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_babylonjs_Maths_math_vector__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/ "../../../dev/serializers/
|
|
16
|
-
|
|
17
|
-
!*** ../../../dev/serializers/
|
|
18
|
-
|
|
15
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts":
|
|
16
|
+
/*!***********************************************************************************!*\
|
|
17
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts ***!
|
|
18
|
+
\***********************************************************************************/
|
|
19
19
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
20
|
|
|
21
21
|
__webpack_require__.r(__webpack_exports__);
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ EXT_mesh_gpu_instancing: () => (/* binding */ EXT_mesh_gpu_instancing)
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
26
|
-
/* harmony import */ var
|
|
27
|
-
/* harmony import */ var
|
|
25
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
26
|
+
/* harmony import */ var babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Buffers/buffer */ "babylonjs/Maths/math.vector");
|
|
27
|
+
/* harmony import */ var babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__);
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -53,17 +53,17 @@ class EXT_mesh_gpu_instancing {
|
|
|
53
53
|
}
|
|
54
54
|
postExportNodeAsync(context, node, babylonNode, nodeMap, binaryWriter) {
|
|
55
55
|
return new Promise((resolve) => {
|
|
56
|
-
if (node && babylonNode instanceof
|
|
56
|
+
if (node && babylonNode instanceof babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.Mesh) {
|
|
57
57
|
if (babylonNode.hasThinInstances && binaryWriter) {
|
|
58
58
|
this._wasUsed = true;
|
|
59
|
-
const noTranslation =
|
|
60
|
-
const noRotation =
|
|
61
|
-
const noScale =
|
|
59
|
+
const noTranslation = babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero();
|
|
60
|
+
const noRotation = babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.Quaternion.Identity();
|
|
61
|
+
const noScale = babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.Vector3.One();
|
|
62
62
|
// retreive all the instance world matrix
|
|
63
63
|
const matrix = babylonNode.thinInstanceGetWorldMatrices();
|
|
64
|
-
const iwt =
|
|
65
|
-
const iwr =
|
|
66
|
-
const iws =
|
|
64
|
+
const iwt = babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector3[2];
|
|
65
|
+
const iwr = babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Quaternion[1];
|
|
66
|
+
const iws = babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector3[3];
|
|
67
67
|
let hasAnyInstanceWorldTranslation = false;
|
|
68
68
|
let hasAnyInstanceWorldRotation = false;
|
|
69
69
|
let hasAnyInstanceWorldScale = false;
|
|
@@ -132,7 +132,7 @@ class EXT_mesh_gpu_instancing {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
// build the buffer view
|
|
135
|
-
const bv = { buffer: 0, byteOffset: bufferOffset, byteLength: buffer.length *
|
|
135
|
+
const bv = { buffer: 0, byteOffset: bufferOffset, byteLength: buffer.length * babylonjs_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.GetTypeByteLength(componentType) };
|
|
136
136
|
const bufferViewIndex = this._exporter._bufferViews.length;
|
|
137
137
|
this._exporter._bufferViews.push(bv);
|
|
138
138
|
// finally build the accessor
|
|
@@ -154,19 +154,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
154
154
|
|
|
155
155
|
/***/ }),
|
|
156
156
|
|
|
157
|
-
/***/ "../../../dev/serializers/
|
|
158
|
-
|
|
159
|
-
!*** ../../../dev/serializers/
|
|
160
|
-
|
|
157
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_lights_punctual.ts":
|
|
158
|
+
/*!*******************************************************************************!*\
|
|
159
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_lights_punctual.ts ***!
|
|
160
|
+
\*******************************************************************************/
|
|
161
161
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
162
162
|
|
|
163
163
|
__webpack_require__.r(__webpack_exports__);
|
|
164
164
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
165
165
|
/* harmony export */ KHR_lights_punctual: () => (/* binding */ KHR_lights_punctual)
|
|
166
166
|
/* harmony export */ });
|
|
167
|
-
/* harmony import */ var
|
|
168
|
-
/* harmony import */ var
|
|
169
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
167
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/logger */ "babylonjs/Maths/math.vector");
|
|
168
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
169
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
|
|
@@ -213,17 +213,17 @@ class KHR_lights_punctual {
|
|
|
213
213
|
*/
|
|
214
214
|
postExportNodeAsync(context, node, babylonNode, nodeMap) {
|
|
215
215
|
return new Promise((resolve) => {
|
|
216
|
-
if (node && babylonNode instanceof
|
|
216
|
+
if (node && babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.ShadowLight) {
|
|
217
217
|
let light;
|
|
218
|
-
const lightType = babylonNode.getTypeID() ==
|
|
218
|
+
const lightType = babylonNode.getTypeID() == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_POINTLIGHT
|
|
219
219
|
? "point" /* KHRLightsPunctual_LightType.POINT */
|
|
220
|
-
: babylonNode.getTypeID() ==
|
|
220
|
+
: babylonNode.getTypeID() == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_DIRECTIONALLIGHT
|
|
221
221
|
? "directional" /* KHRLightsPunctual_LightType.DIRECTIONAL */
|
|
222
|
-
: babylonNode.getTypeID() ==
|
|
222
|
+
: babylonNode.getTypeID() == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_SPOTLIGHT
|
|
223
223
|
? "spot" /* KHRLightsPunctual_LightType.SPOT */
|
|
224
224
|
: null;
|
|
225
225
|
if (lightType == null) {
|
|
226
|
-
|
|
226
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn(`${context}: Light ${babylonNode.name} is not supported in ${NAME}`);
|
|
227
227
|
}
|
|
228
228
|
else {
|
|
229
229
|
if (!babylonNode.position.equalsToFloats(0, 0, 0)) {
|
|
@@ -234,18 +234,18 @@ class KHR_lights_punctual {
|
|
|
234
234
|
const yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
|
|
235
235
|
const len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
236
236
|
const pitch = -Math.atan2(localAxis.y, len);
|
|
237
|
-
const lightRotationQuaternion =
|
|
238
|
-
if (!
|
|
237
|
+
const lightRotationQuaternion = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw + Math.PI, pitch, 0);
|
|
238
|
+
if (!babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(lightRotationQuaternion)) {
|
|
239
239
|
node.rotation = lightRotationQuaternion.asArray();
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
if (babylonNode.falloffType !==
|
|
243
|
-
|
|
242
|
+
if (babylonNode.falloffType !== babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.FALLOFF_GLTF) {
|
|
243
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn(`${context}: Light falloff for ${babylonNode.name} does not match the ${NAME} specification!`);
|
|
244
244
|
}
|
|
245
245
|
light = {
|
|
246
246
|
type: lightType,
|
|
247
247
|
};
|
|
248
|
-
if (!babylonNode.diffuse.equals(
|
|
248
|
+
if (!babylonNode.diffuse.equals(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White())) {
|
|
249
249
|
light.color = babylonNode.diffuse.asArray();
|
|
250
250
|
}
|
|
251
251
|
if (babylonNode.intensity !== 1.0) {
|
|
@@ -281,13 +281,13 @@ class KHR_lights_punctual {
|
|
|
281
281
|
if (parentBabylonNode && parentBabylonNode.getChildren().length == 1) {
|
|
282
282
|
const parentNode = this._exporter._nodes[nodeMap[parentBabylonNode.uniqueId]];
|
|
283
283
|
if (parentNode) {
|
|
284
|
-
const parentTranslation =
|
|
285
|
-
const parentRotation =
|
|
286
|
-
const parentScale =
|
|
287
|
-
const parentMatrix =
|
|
288
|
-
const translation =
|
|
289
|
-
const rotation =
|
|
290
|
-
const matrix =
|
|
284
|
+
const parentTranslation = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.translation || [0, 0, 0], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0]);
|
|
285
|
+
const parentRotation = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(parentNode.rotation || [0, 0, 0, 1], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0]);
|
|
286
|
+
const parentScale = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.scale || [1, 1, 1], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1]);
|
|
287
|
+
const parentMatrix = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(parentScale, parentRotation, parentTranslation, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
288
|
+
const translation = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[2]);
|
|
289
|
+
const rotation = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[1]);
|
|
290
|
+
const matrix = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.OneReadOnly, rotation, translation, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[1]);
|
|
291
291
|
parentMatrix.multiplyToRef(matrix, matrix);
|
|
292
292
|
matrix.decompose(parentScale, parentRotation, parentTranslation);
|
|
293
293
|
if (parentTranslation.equalsToFloats(0, 0, 0)) {
|
|
@@ -296,7 +296,7 @@ class KHR_lights_punctual {
|
|
|
296
296
|
else {
|
|
297
297
|
parentNode.translation = parentTranslation.asArray();
|
|
298
298
|
}
|
|
299
|
-
if (
|
|
299
|
+
if (babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(parentRotation)) {
|
|
300
300
|
delete parentNode.rotation;
|
|
301
301
|
}
|
|
302
302
|
else {
|
|
@@ -328,19 +328,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_1__._Exporter.RegisterExtension(NAME, (ex
|
|
|
328
328
|
|
|
329
329
|
/***/ }),
|
|
330
330
|
|
|
331
|
-
/***/ "../../../dev/serializers/
|
|
332
|
-
|
|
333
|
-
!*** ../../../dev/serializers/
|
|
334
|
-
|
|
331
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_anisotropy.ts":
|
|
332
|
+
/*!************************************************************************************!*\
|
|
333
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_anisotropy.ts ***!
|
|
334
|
+
\************************************************************************************/
|
|
335
335
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
336
336
|
|
|
337
337
|
__webpack_require__.r(__webpack_exports__);
|
|
338
338
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
339
339
|
/* harmony export */ KHR_materials_anisotropy: () => (/* binding */ KHR_materials_anisotropy)
|
|
340
340
|
/* harmony export */ });
|
|
341
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
342
|
-
/* harmony import */ var
|
|
343
|
-
/* harmony import */ var
|
|
341
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
342
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrBaseMaterial */ "babylonjs/Maths/math.vector");
|
|
343
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
344
344
|
|
|
345
345
|
|
|
346
346
|
const NAME = "KHR_materials_anisotropy";
|
|
@@ -366,7 +366,7 @@ class KHR_materials_anisotropy {
|
|
|
366
366
|
}
|
|
367
367
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
368
368
|
const additionalTextures = [];
|
|
369
|
-
if (babylonMaterial instanceof
|
|
369
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRBaseMaterial) {
|
|
370
370
|
if (babylonMaterial.anisotropy.isEnabled && !babylonMaterial.anisotropy.legacy) {
|
|
371
371
|
if (babylonMaterial.anisotropy.texture) {
|
|
372
372
|
additionalTextures.push(babylonMaterial.anisotropy.texture);
|
|
@@ -378,7 +378,7 @@ class KHR_materials_anisotropy {
|
|
|
378
378
|
}
|
|
379
379
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
380
380
|
return new Promise((resolve) => {
|
|
381
|
-
if (babylonMaterial instanceof
|
|
381
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRBaseMaterial) {
|
|
382
382
|
if (!babylonMaterial.anisotropy.isEnabled || babylonMaterial.anisotropy.legacy) {
|
|
383
383
|
resolve(node);
|
|
384
384
|
return;
|
|
@@ -405,19 +405,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
405
405
|
|
|
406
406
|
/***/ }),
|
|
407
407
|
|
|
408
|
-
/***/ "../../../dev/serializers/
|
|
409
|
-
|
|
410
|
-
!*** ../../../dev/serializers/
|
|
411
|
-
|
|
408
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_clearcoat.ts":
|
|
409
|
+
/*!***********************************************************************************!*\
|
|
410
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_clearcoat.ts ***!
|
|
411
|
+
\***********************************************************************************/
|
|
412
412
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
413
413
|
|
|
414
414
|
__webpack_require__.r(__webpack_exports__);
|
|
415
415
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
416
416
|
/* harmony export */ KHR_materials_clearcoat: () => (/* binding */ KHR_materials_clearcoat)
|
|
417
417
|
/* harmony export */ });
|
|
418
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
419
|
-
/* harmony import */ var
|
|
420
|
-
/* harmony import */ var
|
|
418
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
419
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/tools */ "babylonjs/Maths/math.vector");
|
|
420
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
421
421
|
|
|
422
422
|
|
|
423
423
|
|
|
@@ -444,7 +444,7 @@ class KHR_materials_clearcoat {
|
|
|
444
444
|
}
|
|
445
445
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
446
446
|
const additionalTextures = [];
|
|
447
|
-
if (babylonMaterial instanceof
|
|
447
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRBaseMaterial) {
|
|
448
448
|
if (babylonMaterial.clearCoat.isEnabled) {
|
|
449
449
|
if (babylonMaterial.clearCoat.texture) {
|
|
450
450
|
additionalTextures.push(babylonMaterial.clearCoat.texture);
|
|
@@ -462,7 +462,7 @@ class KHR_materials_clearcoat {
|
|
|
462
462
|
}
|
|
463
463
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
464
464
|
return new Promise((resolve) => {
|
|
465
|
-
if (babylonMaterial instanceof
|
|
465
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRBaseMaterial) {
|
|
466
466
|
if (!babylonMaterial.clearCoat.isEnabled) {
|
|
467
467
|
resolve(node);
|
|
468
468
|
return;
|
|
@@ -478,10 +478,10 @@ class KHR_materials_clearcoat {
|
|
|
478
478
|
clearCoatTextureRoughnessInfo = this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.textureRoughness);
|
|
479
479
|
}
|
|
480
480
|
if (babylonMaterial.clearCoat.isTintEnabled) {
|
|
481
|
-
|
|
481
|
+
babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn(`Clear Color tint is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);
|
|
482
482
|
}
|
|
483
483
|
if (babylonMaterial.clearCoat.remapF0OnInterfaceChange) {
|
|
484
|
-
|
|
484
|
+
babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn(`Clear Color F0 remapping is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);
|
|
485
485
|
}
|
|
486
486
|
const clearCoatNormalTextureInfo = this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.clearCoat.bumpTexture);
|
|
487
487
|
const clearCoatInfo = {
|
|
@@ -505,19 +505,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
505
505
|
|
|
506
506
|
/***/ }),
|
|
507
507
|
|
|
508
|
-
/***/ "../../../dev/serializers/
|
|
509
|
-
|
|
510
|
-
!*** ../../../dev/serializers/
|
|
511
|
-
|
|
508
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts":
|
|
509
|
+
/*!*******************************************************************************************!*\
|
|
510
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts ***!
|
|
511
|
+
\*******************************************************************************************/
|
|
512
512
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
513
513
|
|
|
514
514
|
__webpack_require__.r(__webpack_exports__);
|
|
515
515
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
516
516
|
/* harmony export */ KHR_materials_emissive_strength: () => (/* binding */ KHR_materials_emissive_strength)
|
|
517
517
|
/* harmony export */ });
|
|
518
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
519
|
-
/* harmony import */ var
|
|
520
|
-
/* harmony import */ var
|
|
518
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
519
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrMaterial */ "babylonjs/Maths/math.vector");
|
|
520
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
521
521
|
|
|
522
522
|
|
|
523
523
|
const NAME = "KHR_materials_emissive_strength";
|
|
@@ -542,7 +542,7 @@ class KHR_materials_emissive_strength {
|
|
|
542
542
|
}
|
|
543
543
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
544
544
|
return new Promise((resolve) => {
|
|
545
|
-
if (!(babylonMaterial instanceof
|
|
545
|
+
if (!(babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial)) {
|
|
546
546
|
return resolve(node);
|
|
547
547
|
}
|
|
548
548
|
const emissiveColor = babylonMaterial.emissiveColor.asArray();
|
|
@@ -567,19 +567,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
567
567
|
|
|
568
568
|
/***/ }),
|
|
569
569
|
|
|
570
|
-
/***/ "../../../dev/serializers/
|
|
571
|
-
|
|
572
|
-
!*** ../../../dev/serializers/
|
|
573
|
-
|
|
570
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_ior.ts":
|
|
571
|
+
/*!*****************************************************************************!*\
|
|
572
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_ior.ts ***!
|
|
573
|
+
\*****************************************************************************/
|
|
574
574
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
575
575
|
|
|
576
576
|
__webpack_require__.r(__webpack_exports__);
|
|
577
577
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
578
578
|
/* harmony export */ KHR_materials_ior: () => (/* binding */ KHR_materials_ior)
|
|
579
579
|
/* harmony export */ });
|
|
580
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
581
|
-
/* harmony import */ var
|
|
582
|
-
/* harmony import */ var
|
|
580
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
581
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrMaterial */ "babylonjs/Maths/math.vector");
|
|
582
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
583
583
|
|
|
584
584
|
|
|
585
585
|
const NAME = "KHR_materials_ior";
|
|
@@ -611,7 +611,7 @@ class KHR_materials_ior {
|
|
|
611
611
|
}
|
|
612
612
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
613
613
|
return new Promise((resolve) => {
|
|
614
|
-
if (babylonMaterial instanceof
|
|
614
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial && this._isExtensionEnabled(babylonMaterial)) {
|
|
615
615
|
this._wasUsed = true;
|
|
616
616
|
const iorInfo = {
|
|
617
617
|
ior: babylonMaterial.indexOfRefraction,
|
|
@@ -629,19 +629,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
629
629
|
|
|
630
630
|
/***/ }),
|
|
631
631
|
|
|
632
|
-
/***/ "../../../dev/serializers/
|
|
633
|
-
|
|
634
|
-
!*** ../../../dev/serializers/
|
|
635
|
-
|
|
632
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_iridescence.ts":
|
|
633
|
+
/*!*************************************************************************************!*\
|
|
634
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_iridescence.ts ***!
|
|
635
|
+
\*************************************************************************************/
|
|
636
636
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
637
637
|
|
|
638
638
|
__webpack_require__.r(__webpack_exports__);
|
|
639
639
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
640
640
|
/* harmony export */ KHR_materials_iridescence: () => (/* binding */ KHR_materials_iridescence)
|
|
641
641
|
/* harmony export */ });
|
|
642
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
643
|
-
/* harmony import */ var
|
|
644
|
-
/* harmony import */ var
|
|
642
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
643
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrBaseMaterial */ "babylonjs/Maths/math.vector");
|
|
644
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
645
645
|
|
|
646
646
|
|
|
647
647
|
const NAME = "KHR_materials_iridescence";
|
|
@@ -667,7 +667,7 @@ class KHR_materials_iridescence {
|
|
|
667
667
|
}
|
|
668
668
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
669
669
|
const additionalTextures = [];
|
|
670
|
-
if (babylonMaterial instanceof
|
|
670
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRBaseMaterial) {
|
|
671
671
|
if (babylonMaterial.iridescence.isEnabled) {
|
|
672
672
|
if (babylonMaterial.iridescence.texture) {
|
|
673
673
|
additionalTextures.push(babylonMaterial.iridescence.texture);
|
|
@@ -682,7 +682,7 @@ class KHR_materials_iridescence {
|
|
|
682
682
|
}
|
|
683
683
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
684
684
|
return new Promise((resolve) => {
|
|
685
|
-
if (babylonMaterial instanceof
|
|
685
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRBaseMaterial) {
|
|
686
686
|
if (!babylonMaterial.iridescence.isEnabled) {
|
|
687
687
|
resolve(node);
|
|
688
688
|
return;
|
|
@@ -713,19 +713,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
713
713
|
|
|
714
714
|
/***/ }),
|
|
715
715
|
|
|
716
|
-
/***/ "../../../dev/serializers/
|
|
717
|
-
|
|
718
|
-
!*** ../../../dev/serializers/
|
|
719
|
-
|
|
716
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_sheen.ts":
|
|
717
|
+
/*!*******************************************************************************!*\
|
|
718
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_sheen.ts ***!
|
|
719
|
+
\*******************************************************************************/
|
|
720
720
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
721
721
|
|
|
722
722
|
__webpack_require__.r(__webpack_exports__);
|
|
723
723
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
724
724
|
/* harmony export */ KHR_materials_sheen: () => (/* binding */ KHR_materials_sheen)
|
|
725
725
|
/* harmony export */ });
|
|
726
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
727
|
-
/* harmony import */ var
|
|
728
|
-
/* harmony import */ var
|
|
726
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
727
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrMaterial */ "babylonjs/Maths/math.vector");
|
|
728
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
729
729
|
|
|
730
730
|
|
|
731
731
|
const NAME = "KHR_materials_sheen";
|
|
@@ -750,7 +750,7 @@ class KHR_materials_sheen {
|
|
|
750
750
|
return this._wasUsed;
|
|
751
751
|
}
|
|
752
752
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
753
|
-
if (babylonMaterial instanceof
|
|
753
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial) {
|
|
754
754
|
if (babylonMaterial.sheen.isEnabled && babylonMaterial.sheen.texture) {
|
|
755
755
|
return [babylonMaterial.sheen.texture];
|
|
756
756
|
}
|
|
@@ -759,7 +759,7 @@ class KHR_materials_sheen {
|
|
|
759
759
|
}
|
|
760
760
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
761
761
|
return new Promise((resolve) => {
|
|
762
|
-
if (babylonMaterial instanceof
|
|
762
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial) {
|
|
763
763
|
if (!babylonMaterial.sheen.isEnabled) {
|
|
764
764
|
resolve(node);
|
|
765
765
|
return;
|
|
@@ -795,19 +795,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
795
795
|
|
|
796
796
|
/***/ }),
|
|
797
797
|
|
|
798
|
-
/***/ "../../../dev/serializers/
|
|
799
|
-
|
|
800
|
-
!*** ../../../dev/serializers/
|
|
801
|
-
|
|
798
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_specular.ts":
|
|
799
|
+
/*!**********************************************************************************!*\
|
|
800
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_specular.ts ***!
|
|
801
|
+
\**********************************************************************************/
|
|
802
802
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
803
803
|
|
|
804
804
|
__webpack_require__.r(__webpack_exports__);
|
|
805
805
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
806
806
|
/* harmony export */ KHR_materials_specular: () => (/* binding */ KHR_materials_specular)
|
|
807
807
|
/* harmony export */ });
|
|
808
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
809
|
-
/* harmony import */ var
|
|
810
|
-
/* harmony import */ var
|
|
808
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
809
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrMaterial */ "babylonjs/Maths/math.vector");
|
|
810
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
811
811
|
|
|
812
812
|
|
|
813
813
|
const NAME = "KHR_materials_specular";
|
|
@@ -833,7 +833,7 @@ class KHR_materials_specular {
|
|
|
833
833
|
}
|
|
834
834
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
835
835
|
const additionalTextures = [];
|
|
836
|
-
if (babylonMaterial instanceof
|
|
836
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial) {
|
|
837
837
|
if (this._isExtensionEnabled(babylonMaterial)) {
|
|
838
838
|
if (babylonMaterial.metallicReflectanceTexture) {
|
|
839
839
|
additionalTextures.push(babylonMaterial.metallicReflectanceTexture);
|
|
@@ -860,7 +860,7 @@ class KHR_materials_specular {
|
|
|
860
860
|
}
|
|
861
861
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
862
862
|
return new Promise((resolve) => {
|
|
863
|
-
if (babylonMaterial instanceof
|
|
863
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial && this._isExtensionEnabled(babylonMaterial)) {
|
|
864
864
|
this._wasUsed = true;
|
|
865
865
|
node.extensions = node.extensions || {};
|
|
866
866
|
const metallicReflectanceTexture = this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.metallicReflectanceTexture) ?? undefined;
|
|
@@ -889,19 +889,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
889
889
|
|
|
890
890
|
/***/ }),
|
|
891
891
|
|
|
892
|
-
/***/ "../../../dev/serializers/
|
|
893
|
-
|
|
894
|
-
!*** ../../../dev/serializers/
|
|
895
|
-
|
|
892
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_transmission.ts":
|
|
893
|
+
/*!**************************************************************************************!*\
|
|
894
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_transmission.ts ***!
|
|
895
|
+
\**************************************************************************************/
|
|
896
896
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
897
897
|
|
|
898
898
|
__webpack_require__.r(__webpack_exports__);
|
|
899
899
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
900
900
|
/* harmony export */ KHR_materials_transmission: () => (/* binding */ KHR_materials_transmission)
|
|
901
901
|
/* harmony export */ });
|
|
902
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
903
|
-
/* harmony import */ var
|
|
904
|
-
/* harmony import */ var
|
|
902
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
903
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/PBR/pbrMaterial */ "babylonjs/Maths/math.vector");
|
|
904
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
905
905
|
|
|
906
906
|
|
|
907
907
|
const NAME = "KHR_materials_transmission";
|
|
@@ -927,7 +927,7 @@ class KHR_materials_transmission {
|
|
|
927
927
|
}
|
|
928
928
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
929
929
|
const additionalTextures = [];
|
|
930
|
-
if (babylonMaterial instanceof
|
|
930
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial) {
|
|
931
931
|
if (this._isExtensionEnabled(babylonMaterial)) {
|
|
932
932
|
if (babylonMaterial.subSurface.thicknessTexture) {
|
|
933
933
|
additionalTextures.push(babylonMaterial.subSurface.thicknessTexture);
|
|
@@ -950,7 +950,7 @@ class KHR_materials_transmission {
|
|
|
950
950
|
}
|
|
951
951
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
952
952
|
return new Promise((resolve) => {
|
|
953
|
-
if (babylonMaterial instanceof
|
|
953
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial && this._isExtensionEnabled(babylonMaterial)) {
|
|
954
954
|
this._wasUsed = true;
|
|
955
955
|
const subs = babylonMaterial.subSurface;
|
|
956
956
|
const transmissionFactor = subs.refractionIntensity === 0 ? undefined : subs.refractionIntensity;
|
|
@@ -974,19 +974,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
974
974
|
|
|
975
975
|
/***/ }),
|
|
976
976
|
|
|
977
|
-
/***/ "../../../dev/serializers/
|
|
978
|
-
|
|
979
|
-
!*** ../../../dev/serializers/
|
|
980
|
-
|
|
977
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_unlit.ts":
|
|
978
|
+
/*!*******************************************************************************!*\
|
|
979
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_unlit.ts ***!
|
|
980
|
+
\*******************************************************************************/
|
|
981
981
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
982
982
|
|
|
983
983
|
__webpack_require__.r(__webpack_exports__);
|
|
984
984
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
985
985
|
/* harmony export */ KHR_materials_unlit: () => (/* binding */ KHR_materials_unlit)
|
|
986
986
|
/* harmony export */ });
|
|
987
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
988
|
-
/* harmony import */ var
|
|
989
|
-
/* harmony import */ var
|
|
987
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
988
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/standardMaterial */ "babylonjs/Maths/math.vector");
|
|
989
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
990
990
|
|
|
991
991
|
|
|
992
992
|
|
|
@@ -1013,10 +1013,10 @@ class KHR_materials_unlit {
|
|
|
1013
1013
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
1014
1014
|
return new Promise((resolve) => {
|
|
1015
1015
|
let unlitMaterial = false;
|
|
1016
|
-
if (babylonMaterial instanceof
|
|
1016
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial) {
|
|
1017
1017
|
unlitMaterial = babylonMaterial.unlit;
|
|
1018
1018
|
}
|
|
1019
|
-
else if (babylonMaterial instanceof
|
|
1019
|
+
else if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.StandardMaterial) {
|
|
1020
1020
|
unlitMaterial = babylonMaterial.disableLighting;
|
|
1021
1021
|
}
|
|
1022
1022
|
if (unlitMaterial) {
|
|
@@ -1035,19 +1035,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, ()
|
|
|
1035
1035
|
|
|
1036
1036
|
/***/ }),
|
|
1037
1037
|
|
|
1038
|
-
/***/ "../../../dev/serializers/
|
|
1039
|
-
|
|
1040
|
-
!*** ../../../dev/serializers/
|
|
1041
|
-
|
|
1038
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_volume.ts":
|
|
1039
|
+
/*!********************************************************************************!*\
|
|
1040
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_volume.ts ***!
|
|
1041
|
+
\********************************************************************************/
|
|
1042
1042
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1043
1043
|
|
|
1044
1044
|
__webpack_require__.r(__webpack_exports__);
|
|
1045
1045
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1046
1046
|
/* harmony export */ KHR_materials_volume: () => (/* binding */ KHR_materials_volume)
|
|
1047
1047
|
/* harmony export */ });
|
|
1048
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
1049
|
-
/* harmony import */ var
|
|
1050
|
-
/* harmony import */ var
|
|
1048
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
1049
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Maths/math.color */ "babylonjs/Maths/math.vector");
|
|
1050
|
+
/* harmony import */ var babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__);
|
|
1051
1051
|
|
|
1052
1052
|
|
|
1053
1053
|
|
|
@@ -1074,7 +1074,7 @@ class KHR_materials_volume {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
|
1076
1076
|
const additionalTextures = [];
|
|
1077
|
-
if (babylonMaterial instanceof
|
|
1077
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial) {
|
|
1078
1078
|
if (this._isExtensionEnabled(babylonMaterial)) {
|
|
1079
1079
|
if (babylonMaterial.subSurface.thicknessTexture) {
|
|
1080
1080
|
additionalTextures.push(babylonMaterial.subSurface.thicknessTexture);
|
|
@@ -1096,7 +1096,7 @@ class KHR_materials_volume {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
return ((subs.maximumThickness != undefined && subs.maximumThickness != 0) ||
|
|
1098
1098
|
(subs.tintColorAtDistance != undefined && subs.tintColorAtDistance != Number.POSITIVE_INFINITY) ||
|
|
1099
|
-
(subs.tintColor != undefined && subs.tintColor !=
|
|
1099
|
+
(subs.tintColor != undefined && subs.tintColor != babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.Color3.White()) ||
|
|
1100
1100
|
this._hasTexturesExtension(mat));
|
|
1101
1101
|
}
|
|
1102
1102
|
_hasTexturesExtension(mat) {
|
|
@@ -1104,7 +1104,7 @@ class KHR_materials_volume {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
postExportMaterialAsync(context, node, babylonMaterial) {
|
|
1106
1106
|
return new Promise((resolve) => {
|
|
1107
|
-
if (babylonMaterial instanceof
|
|
1107
|
+
if (babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__.PBRMaterial && this._isExtensionEnabled(babylonMaterial)) {
|
|
1108
1108
|
this._wasUsed = true;
|
|
1109
1109
|
const subs = babylonMaterial.subSurface;
|
|
1110
1110
|
const thicknessFactor = subs.maximumThickness == 0 ? undefined : subs.maximumThickness;
|
|
@@ -1132,19 +1132,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, (ex
|
|
|
1132
1132
|
|
|
1133
1133
|
/***/ }),
|
|
1134
1134
|
|
|
1135
|
-
/***/ "../../../dev/serializers/
|
|
1136
|
-
|
|
1137
|
-
!*** ../../../dev/serializers/
|
|
1138
|
-
|
|
1135
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_texture_transform.ts":
|
|
1136
|
+
/*!*********************************************************************************!*\
|
|
1137
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/KHR_texture_transform.ts ***!
|
|
1138
|
+
\*********************************************************************************/
|
|
1139
1139
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1140
1140
|
|
|
1141
1141
|
__webpack_require__.r(__webpack_exports__);
|
|
1142
1142
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1143
1143
|
/* harmony export */ KHR_texture_transform: () => (/* binding */ KHR_texture_transform)
|
|
1144
1144
|
/* harmony export */ });
|
|
1145
|
-
/* harmony import */ var
|
|
1146
|
-
/* harmony import */ var
|
|
1147
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/
|
|
1145
|
+
/* harmony import */ var babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/tools */ "babylonjs/Maths/math.vector");
|
|
1146
|
+
/* harmony import */ var babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__);
|
|
1147
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
1148
1148
|
|
|
1149
1149
|
|
|
1150
1150
|
const NAME = "KHR_texture_transform";
|
|
@@ -1213,11 +1213,11 @@ class KHR_texture_transform {
|
|
|
1213
1213
|
* See https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#gltf-schema-updates.
|
|
1214
1214
|
*/
|
|
1215
1215
|
if (babylonTexture.uAng !== 0 || babylonTexture.vAng !== 0) {
|
|
1216
|
-
|
|
1216
|
+
babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`${context}: Texture ${babylonTexture.name} with rotation in the u or v axis is not supported in glTF.`);
|
|
1217
1217
|
resolve(null);
|
|
1218
1218
|
}
|
|
1219
1219
|
else if (babylonTexture.wAng !== 0 && (babylonTexture.uRotationCenter !== 0 || babylonTexture.vRotationCenter !== 0)) {
|
|
1220
|
-
|
|
1220
|
+
babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`${context}: Texture ${babylonTexture.name} with rotation not centered at the origin cannot be exported with ${NAME}`);
|
|
1221
1221
|
resolve(null);
|
|
1222
1222
|
}
|
|
1223
1223
|
else {
|
|
@@ -1231,10 +1231,10 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_1__._Exporter.RegisterExtension(NAME, ()
|
|
|
1231
1231
|
|
|
1232
1232
|
/***/ }),
|
|
1233
1233
|
|
|
1234
|
-
/***/ "../../../dev/serializers/
|
|
1235
|
-
|
|
1236
|
-
!*** ../../../dev/serializers/
|
|
1237
|
-
|
|
1234
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/Extensions/index.ts":
|
|
1235
|
+
/*!*****************************************************************!*\
|
|
1236
|
+
!*** ../../../dev/serializers/src/glTF/2.0/Extensions/index.ts ***!
|
|
1237
|
+
\*****************************************************************/
|
|
1238
1238
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1239
1239
|
|
|
1240
1240
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1253,19 +1253,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1253
1253
|
/* harmony export */ KHR_materials_volume: () => (/* reexport safe */ _KHR_materials_volume__WEBPACK_IMPORTED_MODULE_9__.KHR_materials_volume),
|
|
1254
1254
|
/* harmony export */ KHR_texture_transform: () => (/* reexport safe */ _KHR_texture_transform__WEBPACK_IMPORTED_MODULE_0__.KHR_texture_transform)
|
|
1255
1255
|
/* harmony export */ });
|
|
1256
|
-
/* harmony import */ var _KHR_texture_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./KHR_texture_transform */ "../../../dev/serializers/
|
|
1257
|
-
/* harmony import */ var _KHR_lights_punctual__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./KHR_lights_punctual */ "../../../dev/serializers/
|
|
1258
|
-
/* harmony import */ var _KHR_materials_clearcoat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./KHR_materials_clearcoat */ "../../../dev/serializers/
|
|
1259
|
-
/* harmony import */ var _KHR_materials_iridescence__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./KHR_materials_iridescence */ "../../../dev/serializers/
|
|
1260
|
-
/* harmony import */ var _KHR_materials_anisotropy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./KHR_materials_anisotropy */ "../../../dev/serializers/
|
|
1261
|
-
/* harmony import */ var _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./KHR_materials_sheen */ "../../../dev/serializers/
|
|
1262
|
-
/* harmony import */ var _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./KHR_materials_unlit */ "../../../dev/serializers/
|
|
1263
|
-
/* harmony import */ var _KHR_materials_ior__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./KHR_materials_ior */ "../../../dev/serializers/
|
|
1264
|
-
/* harmony import */ var _KHR_materials_specular__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./KHR_materials_specular */ "../../../dev/serializers/
|
|
1265
|
-
/* harmony import */ var _KHR_materials_volume__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./KHR_materials_volume */ "../../../dev/serializers/
|
|
1266
|
-
/* harmony import */ var _KHR_materials_transmission__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./KHR_materials_transmission */ "../../../dev/serializers/
|
|
1267
|
-
/* harmony import */ var _EXT_mesh_gpu_instancing__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./EXT_mesh_gpu_instancing */ "../../../dev/serializers/
|
|
1268
|
-
/* harmony import */ var _KHR_materials_emissive_strength__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./KHR_materials_emissive_strength */ "../../../dev/serializers/
|
|
1256
|
+
/* harmony import */ var _KHR_texture_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./KHR_texture_transform */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_texture_transform.ts");
|
|
1257
|
+
/* harmony import */ var _KHR_lights_punctual__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./KHR_lights_punctual */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_lights_punctual.ts");
|
|
1258
|
+
/* harmony import */ var _KHR_materials_clearcoat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./KHR_materials_clearcoat */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_clearcoat.ts");
|
|
1259
|
+
/* harmony import */ var _KHR_materials_iridescence__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./KHR_materials_iridescence */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_iridescence.ts");
|
|
1260
|
+
/* harmony import */ var _KHR_materials_anisotropy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./KHR_materials_anisotropy */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_anisotropy.ts");
|
|
1261
|
+
/* harmony import */ var _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./KHR_materials_sheen */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_sheen.ts");
|
|
1262
|
+
/* harmony import */ var _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./KHR_materials_unlit */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_unlit.ts");
|
|
1263
|
+
/* harmony import */ var _KHR_materials_ior__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./KHR_materials_ior */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_ior.ts");
|
|
1264
|
+
/* harmony import */ var _KHR_materials_specular__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./KHR_materials_specular */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_specular.ts");
|
|
1265
|
+
/* harmony import */ var _KHR_materials_volume__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./KHR_materials_volume */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_volume.ts");
|
|
1266
|
+
/* harmony import */ var _KHR_materials_transmission__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./KHR_materials_transmission */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_transmission.ts");
|
|
1267
|
+
/* harmony import */ var _EXT_mesh_gpu_instancing__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./EXT_mesh_gpu_instancing */ "../../../dev/serializers/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts");
|
|
1268
|
+
/* harmony import */ var _KHR_materials_emissive_strength__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./KHR_materials_emissive_strength */ "../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts");
|
|
1269
1269
|
|
|
1270
1270
|
|
|
1271
1271
|
|
|
@@ -1283,19 +1283,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1283
1283
|
|
|
1284
1284
|
/***/ }),
|
|
1285
1285
|
|
|
1286
|
-
/***/ "../../../dev/serializers/
|
|
1287
|
-
|
|
1288
|
-
!*** ../../../dev/serializers/
|
|
1289
|
-
|
|
1286
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFAnimation.ts":
|
|
1287
|
+
/*!**************************************************************!*\
|
|
1288
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFAnimation.ts ***!
|
|
1289
|
+
\**************************************************************/
|
|
1290
1290
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1291
1291
|
|
|
1292
1292
|
__webpack_require__.r(__webpack_exports__);
|
|
1293
1293
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1294
1294
|
/* harmony export */ _GLTFAnimation: () => (/* binding */ _GLTFAnimation)
|
|
1295
1295
|
/* harmony export */ });
|
|
1296
|
-
/* harmony import */ var
|
|
1297
|
-
/* harmony import */ var
|
|
1298
|
-
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFUtilities */ "../../../dev/serializers/
|
|
1296
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Lights/light */ "babylonjs/Maths/math.vector");
|
|
1297
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
1298
|
+
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFUtilities */ "../../../dev/serializers/src/glTF/2.0/glTFUtilities.ts");
|
|
1299
1299
|
|
|
1300
1300
|
|
|
1301
1301
|
|
|
@@ -1333,7 +1333,7 @@ class _GLTFAnimation {
|
|
|
1333
1333
|
* @returns true if can be animated, false otherwise. False if the parameter is null or undefined.
|
|
1334
1334
|
*/
|
|
1335
1335
|
static _IsTransformable(babylonNode) {
|
|
1336
|
-
return babylonNode && (babylonNode instanceof
|
|
1336
|
+
return babylonNode && (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TransformNode || babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera || babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light);
|
|
1337
1337
|
}
|
|
1338
1338
|
/**
|
|
1339
1339
|
* @ignore
|
|
@@ -1373,8 +1373,8 @@ class _GLTFAnimation {
|
|
|
1373
1373
|
inputs: inputs,
|
|
1374
1374
|
outputs: outputs,
|
|
1375
1375
|
samplerInterpolation: interpolation,
|
|
1376
|
-
inputsMin: shouldBakeAnimation ? minMaxKeyFrames.min :
|
|
1377
|
-
inputsMax: shouldBakeAnimation ? minMaxKeyFrames.max :
|
|
1376
|
+
inputsMin: shouldBakeAnimation ? minMaxKeyFrames.min : babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.FloatRound(minMaxKeyFrames.min / animation.framePerSecond),
|
|
1377
|
+
inputsMax: shouldBakeAnimation ? minMaxKeyFrames.max : babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.FloatRound(minMaxKeyFrames.max / animation.framePerSecond),
|
|
1378
1378
|
};
|
|
1379
1379
|
return result;
|
|
1380
1380
|
}
|
|
@@ -1412,14 +1412,14 @@ class _GLTFAnimation {
|
|
|
1412
1412
|
break;
|
|
1413
1413
|
}
|
|
1414
1414
|
default: {
|
|
1415
|
-
|
|
1415
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`Unsupported animatable property ${property[0]}`);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
if (animationChannelTargetPath) {
|
|
1419
1419
|
return { animationChannelTargetPath: animationChannelTargetPath, dataAccessorType: dataAccessorType, useQuaternion: useQuaternion };
|
|
1420
1420
|
}
|
|
1421
1421
|
else {
|
|
1422
|
-
|
|
1422
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("animation channel target path and data accessor type could be deduced");
|
|
1423
1423
|
}
|
|
1424
1424
|
return null;
|
|
1425
1425
|
}
|
|
@@ -1475,7 +1475,7 @@ class _GLTFAnimation {
|
|
|
1475
1475
|
*/
|
|
1476
1476
|
static _CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
1477
1477
|
let glTFAnimation;
|
|
1478
|
-
if (babylonNode instanceof
|
|
1478
|
+
if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
1479
1479
|
const morphTargetManager = babylonNode.morphTargetManager;
|
|
1480
1480
|
if (morphTargetManager) {
|
|
1481
1481
|
for (let i = 0; i < morphTargetManager.numTargets; ++i) {
|
|
@@ -1484,7 +1484,7 @@ class _GLTFAnimation {
|
|
|
1484
1484
|
if (shouldExportAnimation && !shouldExportAnimation(animation)) {
|
|
1485
1485
|
continue;
|
|
1486
1486
|
}
|
|
1487
|
-
const combinedAnimation = new
|
|
1487
|
+
const combinedAnimation = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation(`${animation.name}`, "influence", animation.framePerSecond, animation.dataType, animation.loopMode, animation.enableBlending);
|
|
1488
1488
|
const combinedAnimationKeys = [];
|
|
1489
1489
|
const animationKeys = animation.getKeys();
|
|
1490
1490
|
for (let j = 0; j < animationKeys.length; ++j) {
|
|
@@ -1558,10 +1558,10 @@ class _GLTFAnimation {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
|
-
else if (target instanceof
|
|
1561
|
+
else if (target instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MorphTarget || (target.length === 1 && target[0] instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MorphTarget)) {
|
|
1562
1562
|
const animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);
|
|
1563
1563
|
if (animationInfo) {
|
|
1564
|
-
const babylonMorphTarget = target instanceof
|
|
1564
|
+
const babylonMorphTarget = target instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MorphTarget ? target : target[0];
|
|
1565
1565
|
if (babylonMorphTarget) {
|
|
1566
1566
|
const babylonMorphTargetManager = babylonScene.morphTargetManagers.find((morphTargetManager) => {
|
|
1567
1567
|
for (let j = 0; j < morphTargetManager.numTargets; ++j) {
|
|
@@ -1615,7 +1615,7 @@ class _GLTFAnimation {
|
|
|
1615
1615
|
const morphTargetAnimation = animationsByMorphTarget.get(morphTarget);
|
|
1616
1616
|
if (morphTargetAnimation) {
|
|
1617
1617
|
if (!combinedAnimationGroup) {
|
|
1618
|
-
combinedAnimationGroup = new
|
|
1618
|
+
combinedAnimationGroup = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`, "influence", morphTargetAnimation.framePerSecond, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT, morphTargetAnimation.loopMode, morphTargetAnimation.enableBlending);
|
|
1619
1619
|
}
|
|
1620
1620
|
animationKeys.push(morphTargetAnimation.getKeys()[i]);
|
|
1621
1621
|
}
|
|
@@ -1731,7 +1731,7 @@ class _GLTFAnimation {
|
|
|
1731
1731
|
*/
|
|
1732
1732
|
static _CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, useQuaternion) {
|
|
1733
1733
|
let value;
|
|
1734
|
-
const quaternionCache =
|
|
1734
|
+
const quaternionCache = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity();
|
|
1735
1735
|
let previousTime = null;
|
|
1736
1736
|
let time;
|
|
1737
1737
|
let maxUsedFrame = null;
|
|
@@ -1739,7 +1739,7 @@ class _GLTFAnimation {
|
|
|
1739
1739
|
let nextKeyFrame = null;
|
|
1740
1740
|
let prevKeyFrame = null;
|
|
1741
1741
|
let endFrame = null;
|
|
1742
|
-
minMaxFrames.min =
|
|
1742
|
+
minMaxFrames.min = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.FloatRound(minFrame / fps);
|
|
1743
1743
|
const keyFrames = animation.getKeys();
|
|
1744
1744
|
for (let i = 0, length = keyFrames.length; i < length; ++i) {
|
|
1745
1745
|
endFrame = null;
|
|
@@ -1771,7 +1771,7 @@ class _GLTFAnimation {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
if (endFrame) {
|
|
1773
1773
|
for (let f = currKeyFrame.frame; f <= endFrame; f += sampleRate) {
|
|
1774
|
-
time =
|
|
1774
|
+
time = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.FloatRound(f / fps);
|
|
1775
1775
|
if (time === previousTime) {
|
|
1776
1776
|
continue;
|
|
1777
1777
|
}
|
|
@@ -1796,7 +1796,7 @@ class _GLTFAnimation {
|
|
|
1796
1796
|
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
1797
1797
|
const property = animation.targetProperty.split(".");
|
|
1798
1798
|
const componentName = property ? property[1] : ""; // x, y, z, or w component
|
|
1799
|
-
const value = useQuaternion ?
|
|
1799
|
+
const value = useQuaternion ? babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
|
|
1800
1800
|
switch (componentName) {
|
|
1801
1801
|
case "x":
|
|
1802
1802
|
case "y":
|
|
@@ -1809,7 +1809,7 @@ class _GLTFAnimation {
|
|
|
1809
1809
|
break;
|
|
1810
1810
|
}
|
|
1811
1811
|
default: {
|
|
1812
|
-
|
|
1812
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`glTFAnimation: Unsupported component name "${componentName}"!`);
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
1815
|
return value;
|
|
@@ -1821,7 +1821,7 @@ class _GLTFAnimation {
|
|
|
1821
1821
|
outputs.push([value]);
|
|
1822
1822
|
return;
|
|
1823
1823
|
}
|
|
1824
|
-
if (animation.dataType ===
|
|
1824
|
+
if (animation.dataType === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
1825
1825
|
value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
|
|
1826
1826
|
}
|
|
1827
1827
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
@@ -1830,7 +1830,7 @@ class _GLTFAnimation {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
else {
|
|
1832
1832
|
cacheValue = value;
|
|
1833
|
-
|
|
1833
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
|
|
1834
1834
|
}
|
|
1835
1835
|
outputs.push(quaternionCache.asArray());
|
|
1836
1836
|
}
|
|
@@ -1878,21 +1878,21 @@ class _GLTFAnimation {
|
|
|
1878
1878
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
1879
1879
|
if (useQuaternion) {
|
|
1880
1880
|
const q = babylonTransformNode.rotationQuaternion;
|
|
1881
|
-
basePositionRotationOrScale = (q ??
|
|
1881
|
+
basePositionRotationOrScale = (q ?? babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity()).asArray();
|
|
1882
1882
|
}
|
|
1883
1883
|
else {
|
|
1884
1884
|
const r = babylonTransformNode.rotation;
|
|
1885
|
-
basePositionRotationOrScale = (r ??
|
|
1885
|
+
basePositionRotationOrScale = (r ?? babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
|
|
1886
1886
|
}
|
|
1887
1887
|
}
|
|
1888
1888
|
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
1889
1889
|
const p = babylonTransformNode.position;
|
|
1890
|
-
basePositionRotationOrScale = (p ??
|
|
1890
|
+
basePositionRotationOrScale = (p ?? babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
|
|
1891
1891
|
}
|
|
1892
1892
|
else {
|
|
1893
1893
|
// scale
|
|
1894
1894
|
const s = babylonTransformNode.scaling;
|
|
1895
|
-
basePositionRotationOrScale = (s ??
|
|
1895
|
+
basePositionRotationOrScale = (s ?? babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.One()).asArray();
|
|
1896
1896
|
}
|
|
1897
1897
|
return basePositionRotationOrScale;
|
|
1898
1898
|
}
|
|
@@ -1908,16 +1908,16 @@ class _GLTFAnimation {
|
|
|
1908
1908
|
static _AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion) {
|
|
1909
1909
|
let newPositionRotationOrScale;
|
|
1910
1910
|
const animationType = animation.dataType;
|
|
1911
|
-
if (animationType ===
|
|
1911
|
+
if (animationType === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_VECTOR3) {
|
|
1912
1912
|
let value = keyFrame.value.asArray();
|
|
1913
1913
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
1914
|
-
const array =
|
|
1915
|
-
const rotationQuaternion =
|
|
1914
|
+
const array = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(value);
|
|
1915
|
+
const rotationQuaternion = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);
|
|
1916
1916
|
value = rotationQuaternion.asArray();
|
|
1917
1917
|
}
|
|
1918
1918
|
outputs.push(value); // scale vector.
|
|
1919
1919
|
}
|
|
1920
|
-
else if (animationType ===
|
|
1920
|
+
else if (animationType === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
1921
1921
|
if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
|
|
1922
1922
|
outputs.push([keyFrame.value]);
|
|
1923
1923
|
}
|
|
@@ -1928,18 +1928,18 @@ class _GLTFAnimation {
|
|
|
1928
1928
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
1929
1929
|
const posRotScale = useQuaternion
|
|
1930
1930
|
? newPositionRotationOrScale
|
|
1931
|
-
:
|
|
1931
|
+
: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();
|
|
1932
1932
|
outputs.push(posRotScale.asArray());
|
|
1933
1933
|
}
|
|
1934
1934
|
outputs.push(newPositionRotationOrScale.asArray());
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
1938
|
-
else if (animationType ===
|
|
1938
|
+
else if (animationType === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_QUATERNION) {
|
|
1939
1939
|
outputs.push(keyFrame.value.normalize().asArray());
|
|
1940
1940
|
}
|
|
1941
1941
|
else {
|
|
1942
|
-
|
|
1942
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported key frame values for animation!");
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
1945
|
/**
|
|
@@ -1972,14 +1972,14 @@ class _GLTFAnimation {
|
|
|
1972
1972
|
else {
|
|
1973
1973
|
if (interpolationType) {
|
|
1974
1974
|
if (interpolationType === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */ ||
|
|
1975
|
-
(key.interpolation && key.interpolation ===
|
|
1975
|
+
(key.interpolation && key.interpolation === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.AnimationKeyInterpolation.STEP && interpolationType !== "STEP" /* AnimationSamplerInterpolation.STEP */)) {
|
|
1976
1976
|
interpolationType = "LINEAR" /* AnimationSamplerInterpolation.LINEAR */;
|
|
1977
1977
|
shouldBakeAnimation = true;
|
|
1978
1978
|
break;
|
|
1979
1979
|
}
|
|
1980
1980
|
}
|
|
1981
1981
|
else {
|
|
1982
|
-
if (key.interpolation && key.interpolation ===
|
|
1982
|
+
if (key.interpolation && key.interpolation === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.AnimationKeyInterpolation.STEP) {
|
|
1983
1983
|
interpolationType = "STEP" /* AnimationSamplerInterpolation.STEP */;
|
|
1984
1984
|
}
|
|
1985
1985
|
else {
|
|
@@ -2016,7 +2016,7 @@ class _GLTFAnimation {
|
|
|
2016
2016
|
}
|
|
2017
2017
|
else {
|
|
2018
2018
|
const array = tangentValue;
|
|
2019
|
-
tangent =
|
|
2019
|
+
tangent = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
2022
|
else {
|
|
@@ -2061,10 +2061,10 @@ class _GLTFAnimation {
|
|
|
2061
2061
|
|
|
2062
2062
|
/***/ }),
|
|
2063
2063
|
|
|
2064
|
-
/***/ "../../../dev/serializers/
|
|
2065
|
-
|
|
2066
|
-
!*** ../../../dev/serializers/
|
|
2067
|
-
|
|
2064
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFData.ts":
|
|
2065
|
+
/*!*********************************************************!*\
|
|
2066
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFData.ts ***!
|
|
2067
|
+
\*********************************************************/
|
|
2068
2068
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2069
2069
|
|
|
2070
2070
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -2125,10 +2125,10 @@ class GLTFData {
|
|
|
2125
2125
|
|
|
2126
2126
|
/***/ }),
|
|
2127
2127
|
|
|
2128
|
-
/***/ "../../../dev/serializers/
|
|
2129
|
-
|
|
2130
|
-
!*** ../../../dev/serializers/
|
|
2131
|
-
|
|
2128
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts":
|
|
2129
|
+
/*!*************************************************************!*\
|
|
2130
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFExporter.ts ***!
|
|
2131
|
+
\*************************************************************/
|
|
2132
2132
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2133
2133
|
|
|
2134
2134
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -2136,12 +2136,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2136
2136
|
/* harmony export */ _BinaryWriter: () => (/* binding */ _BinaryWriter),
|
|
2137
2137
|
/* harmony export */ _Exporter: () => (/* binding */ _Exporter)
|
|
2138
2138
|
/* harmony export */ });
|
|
2139
|
-
/* harmony import */ var
|
|
2140
|
-
/* harmony import */ var
|
|
2141
|
-
/* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../dev/serializers/
|
|
2142
|
-
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFUtilities */ "../../../dev/serializers/
|
|
2143
|
-
/* harmony import */ var _glTFData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFData */ "../../../dev/serializers/
|
|
2144
|
-
/* harmony import */ var _glTFAnimation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFAnimation */ "../../../dev/serializers/
|
|
2139
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/multiMaterial */ "babylonjs/Maths/math.vector");
|
|
2140
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
2141
|
+
/* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../dev/serializers/src/glTF/2.0/glTFMaterialExporter.ts");
|
|
2142
|
+
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFUtilities */ "../../../dev/serializers/src/glTF/2.0/glTFUtilities.ts");
|
|
2143
|
+
/* harmony import */ var _glTFData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFData */ "../../../dev/serializers/src/glTF/2.0/glTFData.ts");
|
|
2144
|
+
/* harmony import */ var _glTFAnimation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFAnimation */ "../../../dev/serializers/src/glTF/2.0/glTFAnimation.ts");
|
|
2145
2145
|
|
|
2146
2146
|
|
|
2147
2147
|
|
|
@@ -2161,9 +2161,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2161
2161
|
|
|
2162
2162
|
|
|
2163
2163
|
// Matrix that converts handedness on the X-axis.
|
|
2164
|
-
const convertHandednessMatrix =
|
|
2164
|
+
const convertHandednessMatrix = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.Compose(new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(-1, 1, 1), babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity(), babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero());
|
|
2165
2165
|
function isNoopNode(node, useRightHandedSystem) {
|
|
2166
|
-
if (!(node instanceof
|
|
2166
|
+
if (!(node instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TransformNode)) {
|
|
2167
2167
|
return false;
|
|
2168
2168
|
}
|
|
2169
2169
|
// Transform
|
|
@@ -2174,22 +2174,22 @@ function isNoopNode(node, useRightHandedSystem) {
|
|
|
2174
2174
|
}
|
|
2175
2175
|
}
|
|
2176
2176
|
else {
|
|
2177
|
-
const matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix,
|
|
2177
|
+
const matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
2178
2178
|
if (!matrix.isIdentity()) {
|
|
2179
2179
|
return false;
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
2182
|
// Geometry
|
|
2183
|
-
if ((node instanceof
|
|
2183
|
+
if ((node instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh && node.geometry) || (node instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh && node.sourceMesh.geometry)) {
|
|
2184
2184
|
return false;
|
|
2185
2185
|
}
|
|
2186
2186
|
return true;
|
|
2187
2187
|
}
|
|
2188
2188
|
function convertNodeHandedness(node) {
|
|
2189
|
-
const translation =
|
|
2190
|
-
const rotation =
|
|
2191
|
-
const scale =
|
|
2192
|
-
const matrix =
|
|
2189
|
+
const translation = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0]);
|
|
2190
|
+
const rotation = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0]);
|
|
2191
|
+
const scale = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.scale || [1, 1, 1], 0, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1]);
|
|
2192
|
+
const matrix = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(scale, rotation, translation, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]).multiplyToRef(convertHandednessMatrix, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
2193
2193
|
matrix.decompose(scale, rotation, translation);
|
|
2194
2194
|
if (translation.equalsToFloats(0, 0, 0)) {
|
|
2195
2195
|
delete node.translation;
|
|
@@ -2197,7 +2197,7 @@ function convertNodeHandedness(node) {
|
|
|
2197
2197
|
else {
|
|
2198
2198
|
node.translation = translation.asArray();
|
|
2199
2199
|
}
|
|
2200
|
-
if (
|
|
2200
|
+
if (babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(rotation)) {
|
|
2201
2201
|
delete node.rotation;
|
|
2202
2202
|
}
|
|
2203
2203
|
else {
|
|
@@ -2313,9 +2313,9 @@ class _Exporter {
|
|
|
2313
2313
|
constructor(babylonScene, options) {
|
|
2314
2314
|
this._extensions = {};
|
|
2315
2315
|
this._glTF = {
|
|
2316
|
-
asset: { generator: `Babylon.js v${
|
|
2316
|
+
asset: { generator: `Babylon.js v${babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Engine.Version}`, version: "2.0" },
|
|
2317
2317
|
};
|
|
2318
|
-
babylonScene = babylonScene ||
|
|
2318
|
+
babylonScene = babylonScene || babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.EngineStore.LastCreatedScene;
|
|
2319
2319
|
if (!babylonScene) {
|
|
2320
2320
|
return;
|
|
2321
2321
|
}
|
|
@@ -2356,7 +2356,7 @@ class _Exporter {
|
|
|
2356
2356
|
*/
|
|
2357
2357
|
static RegisterExtension(name, factory) {
|
|
2358
2358
|
if (_Exporter.UnregisterExtension(name)) {
|
|
2359
|
-
|
|
2359
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`Extension with the name ${name} already exists`);
|
|
2360
2360
|
}
|
|
2361
2361
|
_Exporter._ExtensionFactories[name] = factory;
|
|
2362
2362
|
_Exporter._ExtensionNames.push(name);
|
|
@@ -2379,7 +2379,7 @@ class _Exporter {
|
|
|
2379
2379
|
}
|
|
2380
2380
|
_reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter) {
|
|
2381
2381
|
switch (primitiveMode) {
|
|
2382
|
-
case
|
|
2382
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {
|
|
2383
2383
|
if (!byteOffset) {
|
|
2384
2384
|
byteOffset = 0;
|
|
2385
2385
|
}
|
|
@@ -2393,14 +2393,14 @@ class _Exporter {
|
|
|
2393
2393
|
}
|
|
2394
2394
|
break;
|
|
2395
2395
|
}
|
|
2396
|
-
case
|
|
2396
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFanDrawMode: {
|
|
2397
2397
|
for (let i = submesh.indexStart + submesh.indexCount - 1, start = submesh.indexStart; i >= start; --i) {
|
|
2398
2398
|
binaryWriter.setUInt32(babylonIndices[i], byteOffset);
|
|
2399
2399
|
byteOffset += 4;
|
|
2400
2400
|
}
|
|
2401
2401
|
break;
|
|
2402
2402
|
}
|
|
2403
|
-
case
|
|
2403
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleStripDrawMode: {
|
|
2404
2404
|
if (submesh.indexCount >= 3) {
|
|
2405
2405
|
binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 2], byteOffset + 4);
|
|
2406
2406
|
binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 1], byteOffset + 8);
|
|
@@ -2421,15 +2421,15 @@ class _Exporter {
|
|
|
2421
2421
|
*/
|
|
2422
2422
|
_reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
2423
2423
|
switch (primitiveMode) {
|
|
2424
|
-
case
|
|
2424
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {
|
|
2425
2425
|
this._reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
2426
2426
|
break;
|
|
2427
2427
|
}
|
|
2428
|
-
case
|
|
2428
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleStripDrawMode: {
|
|
2429
2429
|
this._reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
2430
2430
|
break;
|
|
2431
2431
|
}
|
|
2432
|
-
case
|
|
2432
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFanDrawMode: {
|
|
2433
2433
|
this._reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
2434
2434
|
break;
|
|
2435
2435
|
}
|
|
@@ -2447,69 +2447,69 @@ class _Exporter {
|
|
|
2447
2447
|
_reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
2448
2448
|
const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
2449
2449
|
if (vertexBuffer) {
|
|
2450
|
-
const stride = vertexBuffer.byteStride /
|
|
2450
|
+
const stride = vertexBuffer.byteStride / babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
2451
2451
|
if (submesh.verticesCount % 3 !== 0) {
|
|
2452
|
-
|
|
2452
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("The submesh vertices for the triangle fill mode is not divisible by 3!");
|
|
2453
2453
|
}
|
|
2454
2454
|
else {
|
|
2455
2455
|
const vertexData = [];
|
|
2456
2456
|
let index = 0;
|
|
2457
2457
|
switch (vertexBufferKind) {
|
|
2458
|
-
case
|
|
2459
|
-
case
|
|
2458
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind:
|
|
2459
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
2460
2460
|
for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {
|
|
2461
2461
|
index = x * stride;
|
|
2462
|
-
vertexData.push(
|
|
2463
|
-
vertexData.push(
|
|
2464
|
-
vertexData.push(
|
|
2462
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2463
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2464
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + stride));
|
|
2465
2465
|
}
|
|
2466
2466
|
break;
|
|
2467
2467
|
}
|
|
2468
|
-
case
|
|
2468
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
2469
2469
|
for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {
|
|
2470
2470
|
index = x * stride;
|
|
2471
|
-
vertexData.push(
|
|
2472
|
-
vertexData.push(
|
|
2473
|
-
vertexData.push(
|
|
2471
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2472
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2473
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + stride));
|
|
2474
2474
|
}
|
|
2475
2475
|
break;
|
|
2476
2476
|
}
|
|
2477
|
-
case
|
|
2477
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
2478
2478
|
const size = vertexBuffer.getSize();
|
|
2479
2479
|
for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + size) {
|
|
2480
2480
|
index = x * stride;
|
|
2481
2481
|
if (size === 4) {
|
|
2482
|
-
vertexData.push(
|
|
2483
|
-
vertexData.push(
|
|
2484
|
-
vertexData.push(
|
|
2482
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2483
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2484
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + stride));
|
|
2485
2485
|
}
|
|
2486
2486
|
else {
|
|
2487
|
-
vertexData.push(
|
|
2488
|
-
vertexData.push(
|
|
2489
|
-
vertexData.push(
|
|
2487
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2488
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2489
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + stride));
|
|
2490
2490
|
}
|
|
2491
2491
|
}
|
|
2492
2492
|
break;
|
|
2493
2493
|
}
|
|
2494
|
-
case
|
|
2495
|
-
case
|
|
2494
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2495
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
2496
2496
|
for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {
|
|
2497
2497
|
index = x * stride;
|
|
2498
|
-
vertexData.push(
|
|
2499
|
-
vertexData.push(
|
|
2500
|
-
vertexData.push(
|
|
2498
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index));
|
|
2499
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2500
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index + stride));
|
|
2501
2501
|
}
|
|
2502
2502
|
break;
|
|
2503
2503
|
}
|
|
2504
2504
|
default: {
|
|
2505
|
-
|
|
2505
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);
|
|
2506
2506
|
}
|
|
2507
2507
|
}
|
|
2508
2508
|
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
2511
|
else {
|
|
2512
|
-
|
|
2512
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`reorderTriangleFillMode: Vertex Buffer Kind ${vertexBufferKind} not present!`);
|
|
2513
2513
|
}
|
|
2514
2514
|
}
|
|
2515
2515
|
/**
|
|
@@ -2524,49 +2524,49 @@ class _Exporter {
|
|
|
2524
2524
|
_reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
2525
2525
|
const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
2526
2526
|
if (vertexBuffer) {
|
|
2527
|
-
const stride = vertexBuffer.byteStride /
|
|
2527
|
+
const stride = vertexBuffer.byteStride / babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
2528
2528
|
const vertexData = [];
|
|
2529
2529
|
let index = 0;
|
|
2530
2530
|
switch (vertexBufferKind) {
|
|
2531
|
-
case
|
|
2532
|
-
case
|
|
2531
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind:
|
|
2532
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
2533
2533
|
index = submesh.verticesStart;
|
|
2534
|
-
vertexData.push(
|
|
2535
|
-
vertexData.push(
|
|
2534
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2535
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + stride));
|
|
2536
2536
|
break;
|
|
2537
2537
|
}
|
|
2538
|
-
case
|
|
2538
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
2539
2539
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2540
2540
|
index = x * stride;
|
|
2541
|
-
vertexData.push(
|
|
2541
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2542
2542
|
}
|
|
2543
2543
|
break;
|
|
2544
2544
|
}
|
|
2545
|
-
case
|
|
2545
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
2546
2546
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2547
2547
|
index = x * stride;
|
|
2548
2548
|
vertexBuffer.getSize() === 4
|
|
2549
|
-
? vertexData.push(
|
|
2550
|
-
: vertexData.push(
|
|
2549
|
+
? vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index))
|
|
2550
|
+
: vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2551
2551
|
}
|
|
2552
2552
|
break;
|
|
2553
2553
|
}
|
|
2554
|
-
case
|
|
2555
|
-
case
|
|
2554
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2555
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
2556
2556
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2557
2557
|
index = x * stride;
|
|
2558
|
-
vertexData.push(
|
|
2558
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index));
|
|
2559
2559
|
}
|
|
2560
2560
|
break;
|
|
2561
2561
|
}
|
|
2562
2562
|
default: {
|
|
2563
|
-
|
|
2563
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);
|
|
2564
2564
|
}
|
|
2565
2565
|
}
|
|
2566
2566
|
this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, binaryWriter);
|
|
2567
2567
|
}
|
|
2568
2568
|
else {
|
|
2569
|
-
|
|
2569
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`reorderTriangleStripDrawMode: Vertex buffer kind ${vertexBufferKind} not present!`);
|
|
2570
2570
|
}
|
|
2571
2571
|
}
|
|
2572
2572
|
/**
|
|
@@ -2581,51 +2581,51 @@ class _Exporter {
|
|
|
2581
2581
|
_reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
2582
2582
|
const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
2583
2583
|
if (vertexBuffer) {
|
|
2584
|
-
const stride = vertexBuffer.byteStride /
|
|
2584
|
+
const stride = vertexBuffer.byteStride / babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
2585
2585
|
const vertexData = [];
|
|
2586
2586
|
let index = 0;
|
|
2587
2587
|
switch (vertexBufferKind) {
|
|
2588
|
-
case
|
|
2589
|
-
case
|
|
2588
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind:
|
|
2589
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
2590
2590
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2591
2591
|
index = x * stride;
|
|
2592
|
-
vertexData.push(
|
|
2592
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2593
2593
|
}
|
|
2594
2594
|
break;
|
|
2595
2595
|
}
|
|
2596
|
-
case
|
|
2596
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
2597
2597
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2598
2598
|
index = x * stride;
|
|
2599
|
-
vertexData.push(
|
|
2599
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2600
2600
|
}
|
|
2601
2601
|
break;
|
|
2602
2602
|
}
|
|
2603
|
-
case
|
|
2603
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
2604
2604
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2605
2605
|
index = x * stride;
|
|
2606
|
-
vertexData.push(
|
|
2606
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2607
2607
|
vertexBuffer.getSize() === 4
|
|
2608
|
-
? vertexData.push(
|
|
2609
|
-
: vertexData.push(
|
|
2608
|
+
? vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index))
|
|
2609
|
+
: vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2610
2610
|
}
|
|
2611
2611
|
break;
|
|
2612
2612
|
}
|
|
2613
|
-
case
|
|
2614
|
-
case
|
|
2613
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2614
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
2615
2615
|
for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
2616
2616
|
index = x * stride;
|
|
2617
|
-
vertexData.push(
|
|
2617
|
+
vertexData.push(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index));
|
|
2618
2618
|
}
|
|
2619
2619
|
break;
|
|
2620
2620
|
}
|
|
2621
2621
|
default: {
|
|
2622
|
-
|
|
2622
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);
|
|
2623
2623
|
}
|
|
2624
2624
|
}
|
|
2625
2625
|
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
|
|
2626
2626
|
}
|
|
2627
2627
|
else {
|
|
2628
|
-
|
|
2628
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`reorderTriangleFanMode: Vertex buffer kind ${vertexBufferKind} not present!`);
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
2631
|
/**
|
|
@@ -2637,10 +2637,10 @@ class _Exporter {
|
|
|
2637
2637
|
*/
|
|
2638
2638
|
_writeVertexAttributeData(vertices, byteOffset, vertexAttributeKind, binaryWriter) {
|
|
2639
2639
|
for (const vertex of vertices) {
|
|
2640
|
-
if (vertexAttributeKind ===
|
|
2640
|
+
if (vertexAttributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind) {
|
|
2641
2641
|
vertex.normalize();
|
|
2642
2642
|
}
|
|
2643
|
-
else if (vertexAttributeKind ===
|
|
2643
|
+
else if (vertexAttributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind && vertex instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4) {
|
|
2644
2644
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(vertex);
|
|
2645
2645
|
}
|
|
2646
2646
|
for (const component of vertex.asArray()) {
|
|
@@ -2663,46 +2663,46 @@ class _Exporter {
|
|
|
2663
2663
|
let vertexAttributes = [];
|
|
2664
2664
|
let index;
|
|
2665
2665
|
switch (vertexBufferKind) {
|
|
2666
|
-
case
|
|
2666
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind: {
|
|
2667
2667
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2668
2668
|
index = k * stride;
|
|
2669
|
-
const vertexData =
|
|
2669
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index);
|
|
2670
2670
|
vertexAttributes.push(vertexData.asArray());
|
|
2671
2671
|
}
|
|
2672
2672
|
break;
|
|
2673
2673
|
}
|
|
2674
|
-
case
|
|
2674
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
2675
2675
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2676
2676
|
index = k * stride;
|
|
2677
|
-
const vertexData =
|
|
2677
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index);
|
|
2678
2678
|
vertexAttributes.push(vertexData.normalize().asArray());
|
|
2679
2679
|
}
|
|
2680
2680
|
break;
|
|
2681
2681
|
}
|
|
2682
|
-
case
|
|
2682
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
2683
2683
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2684
2684
|
index = k * stride;
|
|
2685
|
-
const vertexData =
|
|
2685
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
2686
2686
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
|
|
2687
2687
|
vertexAttributes.push(vertexData.asArray());
|
|
2688
2688
|
}
|
|
2689
2689
|
break;
|
|
2690
2690
|
}
|
|
2691
|
-
case
|
|
2691
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
2692
2692
|
const meshMaterial = babylonTransformNode.material;
|
|
2693
2693
|
const convertToLinear = meshMaterial ? meshMaterial.getClassName() === "StandardMaterial" : true;
|
|
2694
|
-
const vertexData = stride === 3 ? new
|
|
2694
|
+
const vertexData = stride === 3 ? new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3() : new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color4();
|
|
2695
2695
|
const useExactSrgbConversions = this._babylonScene.getEngine().useExactSrgbConversions;
|
|
2696
2696
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2697
2697
|
index = k * stride;
|
|
2698
2698
|
if (stride === 3) {
|
|
2699
|
-
|
|
2699
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.FromArrayToRef(meshAttributeArray, index, vertexData);
|
|
2700
2700
|
if (convertToLinear) {
|
|
2701
2701
|
vertexData.toLinearSpaceToRef(vertexData, useExactSrgbConversions);
|
|
2702
2702
|
}
|
|
2703
2703
|
}
|
|
2704
2704
|
else {
|
|
2705
|
-
|
|
2705
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color4.FromArrayToRef(meshAttributeArray, index, vertexData);
|
|
2706
2706
|
if (convertToLinear) {
|
|
2707
2707
|
vertexData.toLinearSpaceToRef(vertexData, useExactSrgbConversions);
|
|
2708
2708
|
}
|
|
@@ -2711,35 +2711,35 @@ class _Exporter {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
break;
|
|
2713
2713
|
}
|
|
2714
|
-
case
|
|
2715
|
-
case
|
|
2714
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2715
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
2716
2716
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2717
2717
|
index = k * stride;
|
|
2718
|
-
const vertexData =
|
|
2718
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index);
|
|
2719
2719
|
vertexAttributes.push(vertexData.asArray());
|
|
2720
2720
|
}
|
|
2721
2721
|
break;
|
|
2722
2722
|
}
|
|
2723
|
-
case
|
|
2724
|
-
case
|
|
2723
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind:
|
|
2724
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind: {
|
|
2725
2725
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2726
2726
|
index = k * stride;
|
|
2727
|
-
const vertexData =
|
|
2727
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
2728
2728
|
vertexAttributes.push(vertexData.asArray());
|
|
2729
2729
|
}
|
|
2730
2730
|
break;
|
|
2731
2731
|
}
|
|
2732
|
-
case
|
|
2733
|
-
case
|
|
2732
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsKind:
|
|
2733
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsExtraKind: {
|
|
2734
2734
|
for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {
|
|
2735
2735
|
index = k * stride;
|
|
2736
|
-
const vertexData =
|
|
2736
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
2737
2737
|
vertexAttributes.push(vertexData.asArray());
|
|
2738
2738
|
}
|
|
2739
2739
|
break;
|
|
2740
2740
|
}
|
|
2741
2741
|
default: {
|
|
2742
|
-
|
|
2742
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Vertex Buffer Type: " + vertexBufferKind);
|
|
2743
2743
|
vertexAttributes = [];
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
@@ -2762,7 +2762,7 @@ class _Exporter {
|
|
|
2762
2762
|
break;
|
|
2763
2763
|
}
|
|
2764
2764
|
default: {
|
|
2765
|
-
|
|
2765
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Attribute Component kind: " + attributeComponentKind);
|
|
2766
2766
|
return;
|
|
2767
2767
|
}
|
|
2768
2768
|
}
|
|
@@ -2788,14 +2788,14 @@ class _Exporter {
|
|
|
2788
2788
|
writeMorphTargetAttributeData(vertexBufferKind, attributeComponentKind, meshPrimitive, meshAttributeArray, morphTargetAttributeArray, stride, binaryWriter, minMax) {
|
|
2789
2789
|
let vertexAttributes = [];
|
|
2790
2790
|
let index;
|
|
2791
|
-
let difference = new
|
|
2792
|
-
let difference4 = new
|
|
2791
|
+
let difference = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3();
|
|
2792
|
+
let difference4 = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4(0, 0, 0, 0);
|
|
2793
2793
|
switch (vertexBufferKind) {
|
|
2794
|
-
case
|
|
2794
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind: {
|
|
2795
2795
|
for (let k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
2796
2796
|
index = meshPrimitive.indexStart + k * stride;
|
|
2797
|
-
const vertexData =
|
|
2798
|
-
const morphData =
|
|
2797
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index);
|
|
2798
|
+
const morphData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(morphTargetAttributeArray, index);
|
|
2799
2799
|
difference = morphData.subtractToRef(vertexData, difference);
|
|
2800
2800
|
if (minMax) {
|
|
2801
2801
|
minMax.min.copyFromFloats(Math.min(difference.x, minMax.min.x), Math.min(difference.y, minMax.min.y), Math.min(difference.z, minMax.min.z));
|
|
@@ -2805,22 +2805,22 @@ class _Exporter {
|
|
|
2805
2805
|
}
|
|
2806
2806
|
break;
|
|
2807
2807
|
}
|
|
2808
|
-
case
|
|
2808
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
2809
2809
|
for (let k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
2810
2810
|
index = meshPrimitive.indexStart + k * stride;
|
|
2811
|
-
const vertexData =
|
|
2812
|
-
const morphData =
|
|
2811
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index).normalize();
|
|
2812
|
+
const morphData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(morphTargetAttributeArray, index).normalize();
|
|
2813
2813
|
difference = morphData.subtractToRef(vertexData, difference);
|
|
2814
2814
|
vertexAttributes.push(difference.asArray());
|
|
2815
2815
|
}
|
|
2816
2816
|
break;
|
|
2817
2817
|
}
|
|
2818
|
-
case
|
|
2818
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
2819
2819
|
for (let k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
2820
2820
|
index = meshPrimitive.indexStart + k * (stride + 1);
|
|
2821
|
-
const vertexData =
|
|
2821
|
+
const vertexData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
2822
2822
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
|
|
2823
|
-
const morphData =
|
|
2823
|
+
const morphData = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(morphTargetAttributeArray, index);
|
|
2824
2824
|
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(morphData);
|
|
2825
2825
|
difference4 = morphData.subtractToRef(vertexData, difference4);
|
|
2826
2826
|
vertexAttributes.push([difference4.x, difference4.y, difference4.z]);
|
|
@@ -2828,7 +2828,7 @@ class _Exporter {
|
|
|
2828
2828
|
break;
|
|
2829
2829
|
}
|
|
2830
2830
|
default: {
|
|
2831
|
-
|
|
2831
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Vertex Buffer Type: " + vertexBufferKind);
|
|
2832
2832
|
vertexAttributes = [];
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
@@ -2851,7 +2851,7 @@ class _Exporter {
|
|
|
2851
2851
|
break;
|
|
2852
2852
|
}
|
|
2853
2853
|
default: {
|
|
2854
|
-
|
|
2854
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Attribute Component kind: " + attributeComponentKind);
|
|
2855
2855
|
return;
|
|
2856
2856
|
}
|
|
2857
2857
|
}
|
|
@@ -3098,7 +3098,7 @@ class _Exporter {
|
|
|
3098
3098
|
*/
|
|
3099
3099
|
_setNodeTransformation(node, babylonTransformNode) {
|
|
3100
3100
|
if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {
|
|
3101
|
-
|
|
3101
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Pivot points are not supported in the glTF serializer");
|
|
3102
3102
|
}
|
|
3103
3103
|
if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {
|
|
3104
3104
|
node.translation = babylonTransformNode.position.asArray();
|
|
@@ -3106,11 +3106,11 @@ class _Exporter {
|
|
|
3106
3106
|
if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {
|
|
3107
3107
|
node.scale = babylonTransformNode.scaling.asArray();
|
|
3108
3108
|
}
|
|
3109
|
-
const rotationQuaternion =
|
|
3109
|
+
const rotationQuaternion = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(babylonTransformNode.rotation.y, babylonTransformNode.rotation.x, babylonTransformNode.rotation.z);
|
|
3110
3110
|
if (babylonTransformNode.rotationQuaternion) {
|
|
3111
3111
|
rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
|
|
3112
3112
|
}
|
|
3113
|
-
if (!
|
|
3113
|
+
if (!babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(rotationQuaternion)) {
|
|
3114
3114
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3115
3115
|
}
|
|
3116
3116
|
}
|
|
@@ -3119,7 +3119,7 @@ class _Exporter {
|
|
|
3119
3119
|
node.translation = babylonCamera.position.asArray();
|
|
3120
3120
|
}
|
|
3121
3121
|
const rotationQuaternion = babylonCamera.rotationQuaternion; // we target the local transformation if one.
|
|
3122
|
-
if (rotationQuaternion && !
|
|
3122
|
+
if (rotationQuaternion && !babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(rotationQuaternion)) {
|
|
3123
3123
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3124
3124
|
}
|
|
3125
3125
|
}
|
|
@@ -3141,16 +3141,16 @@ class _Exporter {
|
|
|
3141
3141
|
* @param byteStride
|
|
3142
3142
|
*/
|
|
3143
3143
|
_createBufferViewKind(kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride) {
|
|
3144
|
-
const bufferMesh = babylonTransformNode instanceof
|
|
3144
|
+
const bufferMesh = babylonTransformNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh
|
|
3145
3145
|
? babylonTransformNode
|
|
3146
|
-
: babylonTransformNode instanceof
|
|
3146
|
+
: babylonTransformNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh
|
|
3147
3147
|
? babylonTransformNode.sourceMesh
|
|
3148
3148
|
: null;
|
|
3149
3149
|
if (bufferMesh) {
|
|
3150
3150
|
const vertexBuffer = bufferMesh.getVertexBuffer(kind, true);
|
|
3151
3151
|
const vertexData = bufferMesh.getVerticesData(kind, undefined, undefined, true);
|
|
3152
3152
|
if (vertexBuffer && vertexData) {
|
|
3153
|
-
const typeByteLength =
|
|
3153
|
+
const typeByteLength = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(attributeComponentKind);
|
|
3154
3154
|
const byteLength = vertexData.length * typeByteLength;
|
|
3155
3155
|
const bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + " - " + bufferMesh.name);
|
|
3156
3156
|
this._bufferViews.push(bufferView);
|
|
@@ -3173,7 +3173,7 @@ class _Exporter {
|
|
|
3173
3173
|
const target = {};
|
|
3174
3174
|
const mesh = babylonSubMesh.getMesh();
|
|
3175
3175
|
if (babylonMorphTarget.hasNormals) {
|
|
3176
|
-
const vertexNormals = mesh.getVerticesData(
|
|
3176
|
+
const vertexNormals = mesh.getVerticesData(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind, undefined, undefined, true);
|
|
3177
3177
|
const morphNormals = babylonMorphTarget.getNormals();
|
|
3178
3178
|
const count = babylonSubMesh.verticesCount;
|
|
3179
3179
|
const byteStride = 12; // 3 x 4 byte floats
|
|
@@ -3184,10 +3184,10 @@ class _Exporter {
|
|
|
3184
3184
|
const accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "NORMAL", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
3185
3185
|
this._accessors.push(accessor);
|
|
3186
3186
|
target.NORMAL = this._accessors.length - 1;
|
|
3187
|
-
this.writeMorphTargetAttributeData(
|
|
3187
|
+
this.writeMorphTargetAttributeData(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexNormals, morphNormals, byteStride / 4, binaryWriter);
|
|
3188
3188
|
}
|
|
3189
3189
|
if (babylonMorphTarget.hasPositions) {
|
|
3190
|
-
const vertexPositions = mesh.getVerticesData(
|
|
3190
|
+
const vertexPositions = mesh.getVerticesData(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind, undefined, undefined, true);
|
|
3191
3191
|
const morphPositions = babylonMorphTarget.getPositions();
|
|
3192
3192
|
const count = babylonSubMesh.verticesCount;
|
|
3193
3193
|
const byteStride = 12; // 3 x 4 byte floats
|
|
@@ -3195,16 +3195,16 @@ class _Exporter {
|
|
|
3195
3195
|
const bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, babylonMorphTarget.name + "_POSITION");
|
|
3196
3196
|
this._bufferViews.push(bufferView);
|
|
3197
3197
|
const bufferViewIndex = this._bufferViews.length - 1;
|
|
3198
|
-
const minMax = { min: new
|
|
3198
|
+
const minMax = { min: new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(Infinity, Infinity, Infinity), max: new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(-Infinity, -Infinity, -Infinity) };
|
|
3199
3199
|
const accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "POSITION", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
3200
3200
|
this._accessors.push(accessor);
|
|
3201
3201
|
target.POSITION = this._accessors.length - 1;
|
|
3202
|
-
this.writeMorphTargetAttributeData(
|
|
3202
|
+
this.writeMorphTargetAttributeData(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexPositions, morphPositions, byteStride / 4, binaryWriter, minMax);
|
|
3203
3203
|
accessor.min = minMax.min.asArray();
|
|
3204
3204
|
accessor.max = minMax.max.asArray();
|
|
3205
3205
|
}
|
|
3206
3206
|
if (babylonMorphTarget.hasTangents) {
|
|
3207
|
-
const vertexTangents = mesh.getVerticesData(
|
|
3207
|
+
const vertexTangents = mesh.getVerticesData(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind, undefined, undefined, true);
|
|
3208
3208
|
const morphTangents = babylonMorphTarget.getTangents();
|
|
3209
3209
|
const count = babylonSubMesh.verticesCount;
|
|
3210
3210
|
const byteStride = 12; // 3 x 4 byte floats
|
|
@@ -3215,7 +3215,7 @@ class _Exporter {
|
|
|
3215
3215
|
const accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "TANGENT", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
3216
3216
|
this._accessors.push(accessor);
|
|
3217
3217
|
target.TANGENT = this._accessors.length - 1;
|
|
3218
|
-
this.writeMorphTargetAttributeData(
|
|
3218
|
+
this.writeMorphTargetAttributeData(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexTangents, morphTangents, byteStride / 4, binaryWriter);
|
|
3219
3219
|
}
|
|
3220
3220
|
meshPrimitive.targets.push(target);
|
|
3221
3221
|
}
|
|
@@ -3225,16 +3225,16 @@ class _Exporter {
|
|
|
3225
3225
|
* @param babylonMesh The BabylonJS mesh
|
|
3226
3226
|
*/
|
|
3227
3227
|
_getMeshPrimitiveMode(babylonMesh) {
|
|
3228
|
-
if (babylonMesh instanceof
|
|
3229
|
-
return
|
|
3228
|
+
if (babylonMesh instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.LinesMesh) {
|
|
3229
|
+
return babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineListDrawMode;
|
|
3230
3230
|
}
|
|
3231
|
-
if (babylonMesh instanceof
|
|
3232
|
-
const baseMesh = babylonMesh instanceof
|
|
3231
|
+
if (babylonMesh instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh || babylonMesh instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3232
|
+
const baseMesh = babylonMesh instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh ? babylonMesh : babylonMesh.sourceMesh;
|
|
3233
3233
|
if (typeof baseMesh.overrideRenderingFillMode === "number") {
|
|
3234
3234
|
return baseMesh.overrideRenderingFillMode;
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
3237
|
-
return babylonMesh.material ? babylonMesh.material.fillMode :
|
|
3237
|
+
return babylonMesh.material ? babylonMesh.material.fillMode : babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode;
|
|
3238
3238
|
}
|
|
3239
3239
|
/**
|
|
3240
3240
|
* Sets the primitive mode of the glTF mesh primitive
|
|
@@ -3243,35 +3243,35 @@ class _Exporter {
|
|
|
3243
3243
|
*/
|
|
3244
3244
|
_setPrimitiveMode(meshPrimitive, primitiveMode) {
|
|
3245
3245
|
switch (primitiveMode) {
|
|
3246
|
-
case
|
|
3246
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {
|
|
3247
3247
|
// glTF defaults to using Triangle Mode
|
|
3248
3248
|
break;
|
|
3249
3249
|
}
|
|
3250
|
-
case
|
|
3250
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleStripDrawMode: {
|
|
3251
3251
|
meshPrimitive.mode = 5 /* MeshPrimitiveMode.TRIANGLE_STRIP */;
|
|
3252
3252
|
break;
|
|
3253
3253
|
}
|
|
3254
|
-
case
|
|
3254
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFanDrawMode: {
|
|
3255
3255
|
meshPrimitive.mode = 6 /* MeshPrimitiveMode.TRIANGLE_FAN */;
|
|
3256
3256
|
break;
|
|
3257
3257
|
}
|
|
3258
|
-
case
|
|
3258
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.PointListDrawMode: {
|
|
3259
3259
|
meshPrimitive.mode = 0 /* MeshPrimitiveMode.POINTS */;
|
|
3260
3260
|
break;
|
|
3261
3261
|
}
|
|
3262
|
-
case
|
|
3262
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.PointFillMode: {
|
|
3263
3263
|
meshPrimitive.mode = 0 /* MeshPrimitiveMode.POINTS */;
|
|
3264
3264
|
break;
|
|
3265
3265
|
}
|
|
3266
|
-
case
|
|
3266
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineLoopDrawMode: {
|
|
3267
3267
|
meshPrimitive.mode = 2 /* MeshPrimitiveMode.LINE_LOOP */;
|
|
3268
3268
|
break;
|
|
3269
3269
|
}
|
|
3270
|
-
case
|
|
3270
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineListDrawMode: {
|
|
3271
3271
|
meshPrimitive.mode = 1 /* MeshPrimitiveMode.LINES */;
|
|
3272
3272
|
break;
|
|
3273
3273
|
}
|
|
3274
|
-
case
|
|
3274
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineStripDrawMode: {
|
|
3275
3275
|
meshPrimitive.mode = 3 /* MeshPrimitiveMode.LINE_STRIP */;
|
|
3276
3276
|
break;
|
|
3277
3277
|
}
|
|
@@ -3285,48 +3285,48 @@ class _Exporter {
|
|
|
3285
3285
|
*/
|
|
3286
3286
|
_setAttributeKind(meshPrimitive, attributeKind) {
|
|
3287
3287
|
switch (attributeKind) {
|
|
3288
|
-
case
|
|
3288
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind: {
|
|
3289
3289
|
meshPrimitive.attributes.POSITION = this._accessors.length - 1;
|
|
3290
3290
|
break;
|
|
3291
3291
|
}
|
|
3292
|
-
case
|
|
3292
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3293
3293
|
meshPrimitive.attributes.NORMAL = this._accessors.length - 1;
|
|
3294
3294
|
break;
|
|
3295
3295
|
}
|
|
3296
|
-
case
|
|
3296
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
3297
3297
|
meshPrimitive.attributes.COLOR_0 = this._accessors.length - 1;
|
|
3298
3298
|
break;
|
|
3299
3299
|
}
|
|
3300
|
-
case
|
|
3300
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3301
3301
|
meshPrimitive.attributes.TANGENT = this._accessors.length - 1;
|
|
3302
3302
|
break;
|
|
3303
3303
|
}
|
|
3304
|
-
case
|
|
3304
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind: {
|
|
3305
3305
|
meshPrimitive.attributes.TEXCOORD_0 = this._accessors.length - 1;
|
|
3306
3306
|
break;
|
|
3307
3307
|
}
|
|
3308
|
-
case
|
|
3308
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
3309
3309
|
meshPrimitive.attributes.TEXCOORD_1 = this._accessors.length - 1;
|
|
3310
3310
|
break;
|
|
3311
3311
|
}
|
|
3312
|
-
case
|
|
3312
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind: {
|
|
3313
3313
|
meshPrimitive.attributes.JOINTS_0 = this._accessors.length - 1;
|
|
3314
3314
|
break;
|
|
3315
3315
|
}
|
|
3316
|
-
case
|
|
3316
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind: {
|
|
3317
3317
|
meshPrimitive.attributes.JOINTS_1 = this._accessors.length - 1;
|
|
3318
3318
|
break;
|
|
3319
3319
|
}
|
|
3320
|
-
case
|
|
3320
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsKind: {
|
|
3321
3321
|
meshPrimitive.attributes.WEIGHTS_0 = this._accessors.length - 1;
|
|
3322
3322
|
break;
|
|
3323
3323
|
}
|
|
3324
|
-
case
|
|
3324
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsExtraKind: {
|
|
3325
3325
|
meshPrimitive.attributes.WEIGHTS_1 = this._accessors.length - 1;
|
|
3326
3326
|
break;
|
|
3327
3327
|
}
|
|
3328
3328
|
default: {
|
|
3329
|
-
|
|
3329
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Vertex Buffer Type: " + attributeKind);
|
|
3330
3330
|
}
|
|
3331
3331
|
}
|
|
3332
3332
|
}
|
|
@@ -3341,23 +3341,23 @@ class _Exporter {
|
|
|
3341
3341
|
let bufferMesh = null;
|
|
3342
3342
|
let bufferView;
|
|
3343
3343
|
let minMax;
|
|
3344
|
-
if (babylonTransformNode instanceof
|
|
3344
|
+
if (babylonTransformNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3345
3345
|
bufferMesh = babylonTransformNode;
|
|
3346
3346
|
}
|
|
3347
|
-
else if (babylonTransformNode instanceof
|
|
3347
|
+
else if (babylonTransformNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh) {
|
|
3348
3348
|
bufferMesh = babylonTransformNode.sourceMesh;
|
|
3349
3349
|
}
|
|
3350
3350
|
const attributeData = [
|
|
3351
|
-
{ kind:
|
|
3352
|
-
{ kind:
|
|
3353
|
-
{ kind:
|
|
3354
|
-
{ kind:
|
|
3355
|
-
{ kind:
|
|
3356
|
-
{ kind:
|
|
3357
|
-
{ kind:
|
|
3358
|
-
{ kind:
|
|
3359
|
-
{ kind:
|
|
3360
|
-
{ kind:
|
|
3351
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind, accessorType: "VEC3" /* AccessorType.VEC3 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 12 },
|
|
3352
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind, accessorType: "VEC3" /* AccessorType.VEC3 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 12 },
|
|
3353
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3354
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3355
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind, accessorType: "VEC2" /* AccessorType.VEC2 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 8 },
|
|
3356
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind, accessorType: "VEC2" /* AccessorType.VEC2 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 8 },
|
|
3357
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5123 /* AccessorComponentType.UNSIGNED_SHORT */, byteStride: 8 },
|
|
3358
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5123 /* AccessorComponentType.UNSIGNED_SHORT */, byteStride: 8 },
|
|
3359
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3360
|
+
{ kind: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsExtraKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3361
3361
|
];
|
|
3362
3362
|
if (bufferMesh) {
|
|
3363
3363
|
let indexBufferViewIndex = null;
|
|
@@ -3371,8 +3371,8 @@ class _Exporter {
|
|
|
3371
3371
|
if (bufferMesh.isVerticesDataPresent(attributeKind, true)) {
|
|
3372
3372
|
const vertexBuffer = this._getVertexBufferFromMesh(attributeKind, bufferMesh);
|
|
3373
3373
|
attribute.byteStride = vertexBuffer
|
|
3374
|
-
? vertexBuffer.getSize() *
|
|
3375
|
-
:
|
|
3374
|
+
? vertexBuffer.getSize() * babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(attribute.accessorComponentType)
|
|
3375
|
+
: babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.DeduceStride(attributeKind) * 4;
|
|
3376
3376
|
if (attribute.byteStride === 12) {
|
|
3377
3377
|
attribute.accessorType = "VEC3" /* AccessorType.VEC3 */;
|
|
3378
3378
|
}
|
|
@@ -3399,12 +3399,12 @@ class _Exporter {
|
|
|
3399
3399
|
let babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;
|
|
3400
3400
|
let materialIndex = null;
|
|
3401
3401
|
if (babylonMaterial) {
|
|
3402
|
-
if (bufferMesh instanceof
|
|
3402
|
+
if (bufferMesh instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.LinesMesh) {
|
|
3403
3403
|
// get the color from the lines mesh and set it in the material
|
|
3404
3404
|
const material = {
|
|
3405
3405
|
name: bufferMesh.name + " material",
|
|
3406
3406
|
};
|
|
3407
|
-
if (!bufferMesh.color.equals(
|
|
3407
|
+
if (!bufferMesh.color.equals(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White()) || bufferMesh.alpha < 1) {
|
|
3408
3408
|
material.pbrMetallicRoughness = {
|
|
3409
3409
|
baseColorFactor: bufferMesh.color.asArray().concat([bufferMesh.alpha]),
|
|
3410
3410
|
};
|
|
@@ -3412,7 +3412,7 @@ class _Exporter {
|
|
|
3412
3412
|
this._materials.push(material);
|
|
3413
3413
|
materialIndex = this._materials.length - 1;
|
|
3414
3414
|
}
|
|
3415
|
-
else if (babylonMaterial instanceof
|
|
3415
|
+
else if (babylonMaterial instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MultiMaterial) {
|
|
3416
3416
|
const subMaterial = babylonMaterial.subMaterials[submesh.materialIndex];
|
|
3417
3417
|
if (subMaterial) {
|
|
3418
3418
|
babylonMaterial = subMaterial;
|
|
@@ -3428,7 +3428,7 @@ class _Exporter {
|
|
|
3428
3428
|
this._setPrimitiveMode(meshPrimitive, primitiveMode);
|
|
3429
3429
|
for (const attribute of attributeData) {
|
|
3430
3430
|
const attributeKind = attribute.kind;
|
|
3431
|
-
if ((attributeKind ===
|
|
3431
|
+
if ((attributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind || attributeKind === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind) && !this._options.exportUnusedUVs) {
|
|
3432
3432
|
if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {
|
|
3433
3433
|
continue;
|
|
3434
3434
|
}
|
|
@@ -3442,7 +3442,7 @@ class _Exporter {
|
|
|
3442
3442
|
if (bufferViewIndex != undefined) {
|
|
3443
3443
|
// check to see if bufferviewindex has a numeric value assigned.
|
|
3444
3444
|
minMax = { min: null, max: null };
|
|
3445
|
-
if (attributeKind ==
|
|
3445
|
+
if (attributeKind == babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind) {
|
|
3446
3446
|
minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride);
|
|
3447
3447
|
}
|
|
3448
3448
|
const accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, attribute.accessorComponentType, vertexData.length / stride, 0, minMax.min, minMax.max);
|
|
@@ -3460,7 +3460,7 @@ class _Exporter {
|
|
|
3460
3460
|
}
|
|
3461
3461
|
if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
|
|
3462
3462
|
const sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
|
|
3463
|
-
if (sideOrientation === (this._babylonScene.useRightHandedSystem ?
|
|
3463
|
+
if (sideOrientation === (this._babylonScene.useRightHandedSystem ? babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.ClockWiseSideOrientation : babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.CounterClockWiseSideOrientation)) {
|
|
3464
3464
|
let byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
|
|
3465
3465
|
if (byteOffset == null) {
|
|
3466
3466
|
byteOffset = 0;
|
|
@@ -3538,7 +3538,7 @@ class _Exporter {
|
|
|
3538
3538
|
this._babylonScene.cameras.forEach((camera) => {
|
|
3539
3539
|
if (!this._options.shouldExportNode || this._options.shouldExportNode(camera)) {
|
|
3540
3540
|
const glTFCamera = {
|
|
3541
|
-
type: camera.mode ===
|
|
3541
|
+
type: camera.mode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera.PERSPECTIVE_CAMERA ? "perspective" /* CameraType.PERSPECTIVE */ : "orthographic" /* CameraType.ORTHOGRAPHIC */,
|
|
3542
3542
|
};
|
|
3543
3543
|
if (camera.name) {
|
|
3544
3544
|
glTFCamera.name = camera.name;
|
|
@@ -3546,7 +3546,7 @@ class _Exporter {
|
|
|
3546
3546
|
if (glTFCamera.type === "perspective" /* CameraType.PERSPECTIVE */) {
|
|
3547
3547
|
glTFCamera.perspective = {
|
|
3548
3548
|
aspectRatio: camera.getEngine().getAspectRatio(camera),
|
|
3549
|
-
yfov: camera.fovMode ===
|
|
3549
|
+
yfov: camera.fovMode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera.getEngine().getAspectRatio(camera),
|
|
3550
3550
|
znear: camera.minZ,
|
|
3551
3551
|
zfar: camera.maxZ,
|
|
3552
3552
|
};
|
|
@@ -3587,11 +3587,11 @@ class _Exporter {
|
|
|
3587
3587
|
glTFNode.extras = babylonNode.metadata.gltf.extras;
|
|
3588
3588
|
}
|
|
3589
3589
|
}
|
|
3590
|
-
if (babylonNode instanceof
|
|
3590
|
+
if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera) {
|
|
3591
3591
|
glTFNode.camera = cameraMap.get(babylonNode);
|
|
3592
3592
|
}
|
|
3593
3593
|
if (this._options.shouldExportNode && !this._options.shouldExportNode(babylonNode)) {
|
|
3594
|
-
|
|
3594
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Log("Omitting " + babylonNode.name + " from scene.");
|
|
3595
3595
|
}
|
|
3596
3596
|
else {
|
|
3597
3597
|
if (!babylonNode.parent && !this._babylonScene.useRightHandedSystem) {
|
|
@@ -3601,7 +3601,7 @@ class _Exporter {
|
|
|
3601
3601
|
scene.nodes.push(glTFNodeIndex);
|
|
3602
3602
|
}
|
|
3603
3603
|
}
|
|
3604
|
-
if (babylonNode instanceof
|
|
3604
|
+
if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3605
3605
|
if (babylonNode.skeleton) {
|
|
3606
3606
|
glTFNode.skin = skinMap[babylonNode.skeleton.uniqueId];
|
|
3607
3607
|
}
|
|
@@ -3642,7 +3642,7 @@ class _Exporter {
|
|
|
3642
3642
|
const babylonMesh = babylonNode;
|
|
3643
3643
|
if (babylonMesh.subMeshes && babylonMesh.subMeshes.length > 0) {
|
|
3644
3644
|
const material = babylonMesh.material || babylonMesh.getScene().defaultMaterial;
|
|
3645
|
-
if (material instanceof
|
|
3645
|
+
if (material instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MultiMaterial) {
|
|
3646
3646
|
for (const subMaterial of material.subMaterials) {
|
|
3647
3647
|
if (subMaterial) {
|
|
3648
3648
|
exportMaterials.add(subMaterial);
|
|
@@ -3681,7 +3681,7 @@ class _Exporter {
|
|
|
3681
3681
|
return this._createNodeAsync(babylonNode, binaryWriter).then((node) => {
|
|
3682
3682
|
const promise = this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap, binaryWriter);
|
|
3683
3683
|
if (promise == null) {
|
|
3684
|
-
|
|
3684
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`Not exporting node ${babylonNode.name}`);
|
|
3685
3685
|
return Promise.resolve();
|
|
3686
3686
|
}
|
|
3687
3687
|
else {
|
|
@@ -3733,10 +3733,10 @@ class _Exporter {
|
|
|
3733
3733
|
if (babylonNode.name) {
|
|
3734
3734
|
node.name = babylonNode.name;
|
|
3735
3735
|
}
|
|
3736
|
-
if (babylonNode instanceof
|
|
3736
|
+
if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TransformNode) {
|
|
3737
3737
|
// Set transformation
|
|
3738
3738
|
this._setNodeTransformation(node, babylonNode);
|
|
3739
|
-
if (babylonNode instanceof
|
|
3739
|
+
if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3740
3740
|
const morphTargetManager = babylonNode.morphTargetManager;
|
|
3741
3741
|
if (morphTargetManager && morphTargetManager.numTargets > 0) {
|
|
3742
3742
|
mesh.weights = [];
|
|
@@ -3753,7 +3753,7 @@ class _Exporter {
|
|
|
3753
3753
|
return node;
|
|
3754
3754
|
});
|
|
3755
3755
|
}
|
|
3756
|
-
else if (babylonNode instanceof
|
|
3756
|
+
else if (babylonNode instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera) {
|
|
3757
3757
|
this._setCameraTransformation(node, babylonNode);
|
|
3758
3758
|
return node;
|
|
3759
3759
|
}
|
|
@@ -3799,7 +3799,7 @@ class _Exporter {
|
|
|
3799
3799
|
skin.joints.push(nodeMap[transformNode.uniqueId]);
|
|
3800
3800
|
}
|
|
3801
3801
|
else {
|
|
3802
|
-
|
|
3802
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Exporting a bone without a linked transform node is currently unsupported");
|
|
3803
3803
|
}
|
|
3804
3804
|
}
|
|
3805
3805
|
if (skin.joints.length > 0) {
|
|
@@ -3886,7 +3886,7 @@ class _BinaryWriter {
|
|
|
3886
3886
|
this._dataView.setUint8(byteOffset, entry);
|
|
3887
3887
|
}
|
|
3888
3888
|
else {
|
|
3889
|
-
|
|
3889
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
3890
3890
|
}
|
|
3891
3891
|
}
|
|
3892
3892
|
else {
|
|
@@ -3908,7 +3908,7 @@ class _BinaryWriter {
|
|
|
3908
3908
|
this._dataView.setUint16(byteOffset, entry, true);
|
|
3909
3909
|
}
|
|
3910
3910
|
else {
|
|
3911
|
-
|
|
3911
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
3912
3912
|
}
|
|
3913
3913
|
}
|
|
3914
3914
|
else {
|
|
@@ -3928,13 +3928,13 @@ class _BinaryWriter {
|
|
|
3928
3928
|
return this._dataView.getUint32(byteOffset, true);
|
|
3929
3929
|
}
|
|
3930
3930
|
else {
|
|
3931
|
-
|
|
3931
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
3932
3932
|
throw new Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
3933
3933
|
}
|
|
3934
3934
|
}
|
|
3935
3935
|
getVector3Float32FromRef(vector3, byteOffset) {
|
|
3936
3936
|
if (byteOffset + 8 > this._byteOffset) {
|
|
3937
|
-
|
|
3937
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);
|
|
3938
3938
|
}
|
|
3939
3939
|
else {
|
|
3940
3940
|
vector3.x = this._dataView.getFloat32(byteOffset, true);
|
|
@@ -3944,7 +3944,7 @@ class _BinaryWriter {
|
|
|
3944
3944
|
}
|
|
3945
3945
|
setVector3Float32FromRef(vector3, byteOffset) {
|
|
3946
3946
|
if (byteOffset + 8 > this._byteOffset) {
|
|
3947
|
-
|
|
3947
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);
|
|
3948
3948
|
}
|
|
3949
3949
|
else {
|
|
3950
3950
|
this._dataView.setFloat32(byteOffset, vector3.x, true);
|
|
@@ -3954,7 +3954,7 @@ class _BinaryWriter {
|
|
|
3954
3954
|
}
|
|
3955
3955
|
getVector4Float32FromRef(vector4, byteOffset) {
|
|
3956
3956
|
if (byteOffset + 12 > this._byteOffset) {
|
|
3957
|
-
|
|
3957
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);
|
|
3958
3958
|
}
|
|
3959
3959
|
else {
|
|
3960
3960
|
vector4.x = this._dataView.getFloat32(byteOffset, true);
|
|
@@ -3965,7 +3965,7 @@ class _BinaryWriter {
|
|
|
3965
3965
|
}
|
|
3966
3966
|
setVector4Float32FromRef(vector4, byteOffset) {
|
|
3967
3967
|
if (byteOffset + 12 > this._byteOffset) {
|
|
3968
|
-
|
|
3968
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);
|
|
3969
3969
|
}
|
|
3970
3970
|
else {
|
|
3971
3971
|
this._dataView.setFloat32(byteOffset, vector4.x, true);
|
|
@@ -3981,14 +3981,14 @@ class _BinaryWriter {
|
|
|
3981
3981
|
*/
|
|
3982
3982
|
setFloat32(entry, byteOffset) {
|
|
3983
3983
|
if (isNaN(entry)) {
|
|
3984
|
-
|
|
3984
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("Invalid data being written!");
|
|
3985
3985
|
}
|
|
3986
3986
|
if (byteOffset != null) {
|
|
3987
3987
|
if (byteOffset < this._byteOffset) {
|
|
3988
3988
|
this._dataView.setFloat32(byteOffset, entry, true);
|
|
3989
3989
|
}
|
|
3990
3990
|
else {
|
|
3991
|
-
|
|
3991
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary length!");
|
|
3992
3992
|
}
|
|
3993
3993
|
}
|
|
3994
3994
|
if (this._byteOffset + 4 > this._arrayBuffer.byteLength) {
|
|
@@ -4008,7 +4008,7 @@ class _BinaryWriter {
|
|
|
4008
4008
|
this._dataView.setUint32(byteOffset, entry, true);
|
|
4009
4009
|
}
|
|
4010
4010
|
else {
|
|
4011
|
-
|
|
4011
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4012
4012
|
}
|
|
4013
4013
|
}
|
|
4014
4014
|
else {
|
|
@@ -4030,7 +4030,7 @@ class _BinaryWriter {
|
|
|
4030
4030
|
this._dataView.setInt16(byteOffset, entry, true);
|
|
4031
4031
|
}
|
|
4032
4032
|
else {
|
|
4033
|
-
|
|
4033
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4034
4034
|
}
|
|
4035
4035
|
}
|
|
4036
4036
|
else {
|
|
@@ -4052,7 +4052,7 @@ class _BinaryWriter {
|
|
|
4052
4052
|
this._dataView.setInt8(byteOffset, entry);
|
|
4053
4053
|
}
|
|
4054
4054
|
else {
|
|
4055
|
-
|
|
4055
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4056
4056
|
}
|
|
4057
4057
|
}
|
|
4058
4058
|
else {
|
|
@@ -4068,10 +4068,10 @@ class _BinaryWriter {
|
|
|
4068
4068
|
|
|
4069
4069
|
/***/ }),
|
|
4070
4070
|
|
|
4071
|
-
/***/ "../../../dev/serializers/
|
|
4072
|
-
|
|
4073
|
-
!*** ../../../dev/serializers/
|
|
4074
|
-
|
|
4071
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFExporterExtension.ts":
|
|
4072
|
+
/*!**********************************************************************!*\
|
|
4073
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFExporterExtension.ts ***!
|
|
4074
|
+
\**********************************************************************/
|
|
4075
4075
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4076
4076
|
|
|
4077
4077
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -4085,18 +4085,18 @@ var __IGLTFExporterExtensionV2 = 0; // I am here to allow dts to be created
|
|
|
4085
4085
|
|
|
4086
4086
|
/***/ }),
|
|
4087
4087
|
|
|
4088
|
-
/***/ "../../../dev/serializers/
|
|
4089
|
-
|
|
4090
|
-
!*** ../../../dev/serializers/
|
|
4091
|
-
|
|
4088
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFMaterialExporter.ts":
|
|
4089
|
+
/*!*********************************************************************!*\
|
|
4090
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFMaterialExporter.ts ***!
|
|
4091
|
+
\*********************************************************************/
|
|
4092
4092
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4093
4093
|
|
|
4094
4094
|
__webpack_require__.r(__webpack_exports__);
|
|
4095
4095
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4096
4096
|
/* harmony export */ _GLTFMaterialExporter: () => (/* binding */ _GLTFMaterialExporter)
|
|
4097
4097
|
/* harmony export */ });
|
|
4098
|
-
/* harmony import */ var
|
|
4099
|
-
/* harmony import */ var
|
|
4098
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/dumpTools */ "babylonjs/Maths/math.vector");
|
|
4099
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
4100
4100
|
|
|
4101
4101
|
|
|
4102
4102
|
|
|
@@ -4138,7 +4138,7 @@ class _GLTFMaterialExporter {
|
|
|
4138
4138
|
* @param epsilon threshold value
|
|
4139
4139
|
*/
|
|
4140
4140
|
static _FuzzyEquals(color1, color2, epsilon) {
|
|
4141
|
-
return
|
|
4141
|
+
return babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.WithinEpsilon(color1.r, color2.r, epsilon) && babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.WithinEpsilon(color1.g, color2.g, epsilon) && babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.WithinEpsilon(color1.b, color2.b, epsilon);
|
|
4142
4142
|
}
|
|
4143
4143
|
/**
|
|
4144
4144
|
* Gets the materials from a Babylon scene and converts them to glTF materials
|
|
@@ -4156,7 +4156,7 @@ class _GLTFMaterialExporter {
|
|
|
4156
4156
|
promises.push(this._convertPBRMaterialAsync(material, mimeType, hasTextureCoords));
|
|
4157
4157
|
}
|
|
4158
4158
|
else {
|
|
4159
|
-
|
|
4159
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`Unsupported material type: ${material.name}`);
|
|
4160
4160
|
}
|
|
4161
4161
|
});
|
|
4162
4162
|
return Promise.all(promises).then(() => {
|
|
@@ -4227,10 +4227,10 @@ class _GLTFMaterialExporter {
|
|
|
4227
4227
|
*/
|
|
4228
4228
|
_convertToGLTFPBRMetallicRoughness(babylonStandardMaterial) {
|
|
4229
4229
|
// Defines a cubic bezier curve where x is specular power and y is roughness
|
|
4230
|
-
const P0 = new
|
|
4231
|
-
const P1 = new
|
|
4232
|
-
const P2 = new
|
|
4233
|
-
const P3 = new
|
|
4230
|
+
const P0 = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 1);
|
|
4231
|
+
const P1 = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0.1);
|
|
4232
|
+
const P2 = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0.1);
|
|
4233
|
+
const P3 = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(1300, 0.1);
|
|
4234
4234
|
/**
|
|
4235
4235
|
* Given the control points, solve for x based on a given t for a cubic bezier curve
|
|
4236
4236
|
* @param t a value between 0 and 1
|
|
@@ -4259,7 +4259,7 @@ class _GLTFMaterialExporter {
|
|
|
4259
4259
|
}
|
|
4260
4260
|
const diffuse = babylonStandardMaterial.diffuseColor.toLinearSpace(babylonStandardMaterial.getScene().getEngine().useExactSrgbConversions).scale(0.5);
|
|
4261
4261
|
const opacity = babylonStandardMaterial.alpha;
|
|
4262
|
-
const specularPower =
|
|
4262
|
+
const specularPower = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.Clamp(babylonStandardMaterial.specularPower, 0, _GLTFMaterialExporter._MaxSpecularPower);
|
|
4263
4263
|
const roughness = solveForRoughness(specularPower);
|
|
4264
4264
|
const glTFPbrMetallicRoughness = {
|
|
4265
4265
|
baseColorFactor: [diffuse.r, diffuse.g, diffuse.b, opacity],
|
|
@@ -4284,7 +4284,7 @@ class _GLTFMaterialExporter {
|
|
|
4284
4284
|
const b = (diffuse * oneMinusSpecularStrength) / (1.0 - this._DielectricSpecular.r) + specular - 2.0 * this._DielectricSpecular.r;
|
|
4285
4285
|
const c = this._DielectricSpecular.r - specular;
|
|
4286
4286
|
const D = b * b - 4.0 * a * c;
|
|
4287
|
-
return
|
|
4287
|
+
return babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.Clamp((-b + Math.sqrt(D)) / (2.0 * a), 0, 1);
|
|
4288
4288
|
}
|
|
4289
4289
|
/**
|
|
4290
4290
|
* Sets the glTF alpha mode to a glTF material from the Babylon Material
|
|
@@ -4314,7 +4314,7 @@ class _GLTFMaterialExporter {
|
|
|
4314
4314
|
const material = { name: babylonStandardMaterial.name };
|
|
4315
4315
|
if (babylonStandardMaterial.backFaceCulling != null && !babylonStandardMaterial.backFaceCulling) {
|
|
4316
4316
|
if (!babylonStandardMaterial.twoSidedLighting) {
|
|
4317
|
-
|
|
4317
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(babylonStandardMaterial.name + ": Back-face culling disabled and two-sided lighting disabled is not supported in glTF.");
|
|
4318
4318
|
}
|
|
4319
4319
|
material.doubleSided = true;
|
|
4320
4320
|
}
|
|
@@ -4357,14 +4357,14 @@ class _GLTFMaterialExporter {
|
|
|
4357
4357
|
}
|
|
4358
4358
|
}
|
|
4359
4359
|
if (babylonStandardMaterial.alpha < 1.0 || babylonStandardMaterial.opacityTexture) {
|
|
4360
|
-
if (babylonStandardMaterial.alphaMode ===
|
|
4360
|
+
if (babylonStandardMaterial.alphaMode === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.ALPHA_COMBINE) {
|
|
4361
4361
|
material.alphaMode = "BLEND" /* MaterialAlphaMode.BLEND */;
|
|
4362
4362
|
}
|
|
4363
4363
|
else {
|
|
4364
|
-
|
|
4364
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(babylonStandardMaterial.name + ": glTF 2.0 does not support alpha mode: " + babylonStandardMaterial.alphaMode.toString());
|
|
4365
4365
|
}
|
|
4366
4366
|
}
|
|
4367
|
-
if (babylonStandardMaterial.emissiveColor && !_GLTFMaterialExporter._FuzzyEquals(babylonStandardMaterial.emissiveColor,
|
|
4367
|
+
if (babylonStandardMaterial.emissiveColor && !_GLTFMaterialExporter._FuzzyEquals(babylonStandardMaterial.emissiveColor, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Black(), _GLTFMaterialExporter._Epsilon)) {
|
|
4368
4368
|
material.emissiveFactor = babylonStandardMaterial.emissiveColor.asArray();
|
|
4369
4369
|
}
|
|
4370
4370
|
material.pbrMetallicRoughness = pbrMetallicRoughness;
|
|
@@ -4404,14 +4404,14 @@ class _GLTFMaterialExporter {
|
|
|
4404
4404
|
* @returns base64 image string
|
|
4405
4405
|
*/
|
|
4406
4406
|
async _getImageDataAsync(buffer, width, height, mimeType) {
|
|
4407
|
-
const textureType =
|
|
4407
|
+
const textureType = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURETYPE_UNSIGNED_INT;
|
|
4408
4408
|
const hostingScene = this._exporter._babylonScene;
|
|
4409
4409
|
const engine = hostingScene.getEngine();
|
|
4410
4410
|
// Create a temporary texture with the texture buffer data
|
|
4411
|
-
const tempTexture = engine.createRawTexture(buffer, width, height,
|
|
4412
|
-
await
|
|
4411
|
+
const tempTexture = engine.createRawTexture(buffer, width, height, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTUREFORMAT_RGBA, false, true, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_SAMPLINGMODE, null, textureType);
|
|
4412
|
+
await babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TextureTools.ApplyPostProcess("pass", tempTexture, hostingScene, textureType, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURE_NEAREST_SAMPLINGMODE, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTUREFORMAT_RGBA);
|
|
4413
4413
|
const data = await engine._readTexturePixels(tempTexture, width, height);
|
|
4414
|
-
return (await
|
|
4414
|
+
return (await babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.DumpTools.DumpDataAsync(width, height, data, mimeType, undefined, true, true));
|
|
4415
4415
|
}
|
|
4416
4416
|
/**
|
|
4417
4417
|
* Generates a white texture based on the specified width and height
|
|
@@ -4425,7 +4425,7 @@ class _GLTFMaterialExporter {
|
|
|
4425
4425
|
for (let i = 0; i < data.length; i = i + 4) {
|
|
4426
4426
|
data[i] = data[i + 1] = data[i + 2] = data[i + 3] = 0xff;
|
|
4427
4427
|
}
|
|
4428
|
-
const rawTexture =
|
|
4428
|
+
const rawTexture = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.RawTexture.CreateRGBATexture(data, width, height, scene);
|
|
4429
4429
|
return rawTexture;
|
|
4430
4430
|
}
|
|
4431
4431
|
/**
|
|
@@ -4441,8 +4441,8 @@ class _GLTFMaterialExporter {
|
|
|
4441
4441
|
let resizedTexture1;
|
|
4442
4442
|
let resizedTexture2;
|
|
4443
4443
|
if (texture1Size.width < texture2Size.width) {
|
|
4444
|
-
if (texture1 && texture1 instanceof
|
|
4445
|
-
resizedTexture1 =
|
|
4444
|
+
if (texture1 && texture1 instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture) {
|
|
4445
|
+
resizedTexture1 = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TextureTools.CreateResizedCopy(texture1, texture2Size.width, texture2Size.height, true);
|
|
4446
4446
|
}
|
|
4447
4447
|
else {
|
|
4448
4448
|
resizedTexture1 = this._createWhiteTexture(texture2Size.width, texture2Size.height, scene);
|
|
@@ -4450,8 +4450,8 @@ class _GLTFMaterialExporter {
|
|
|
4450
4450
|
resizedTexture2 = texture2;
|
|
4451
4451
|
}
|
|
4452
4452
|
else if (texture1Size.width > texture2Size.width) {
|
|
4453
|
-
if (texture2 && texture2 instanceof
|
|
4454
|
-
resizedTexture2 =
|
|
4453
|
+
if (texture2 && texture2 instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture) {
|
|
4454
|
+
resizedTexture2 = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TextureTools.CreateResizedCopy(texture2, texture1Size.width, texture1Size.height, true);
|
|
4455
4455
|
}
|
|
4456
4456
|
else {
|
|
4457
4457
|
resizedTexture2 = this._createWhiteTexture(texture1Size.width, texture1Size.height, scene);
|
|
@@ -4530,16 +4530,16 @@ class _GLTFMaterialExporter {
|
|
|
4530
4530
|
const metallicRoughnessBuffer = new Uint8Array(byteLength);
|
|
4531
4531
|
const baseColorBuffer = new Uint8Array(byteLength);
|
|
4532
4532
|
const strideSize = 4;
|
|
4533
|
-
const maxBaseColor =
|
|
4533
|
+
const maxBaseColor = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Black();
|
|
4534
4534
|
let maxMetallic = 0;
|
|
4535
4535
|
let maxRoughness = 0;
|
|
4536
4536
|
for (let h = 0; h < height; ++h) {
|
|
4537
4537
|
for (let w = 0; w < width; ++w) {
|
|
4538
4538
|
const offset = (width * h + w) * strideSize;
|
|
4539
|
-
const diffuseColor = new
|
|
4539
|
+
const diffuseColor = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3(diffuseBuffer[offset], diffuseBuffer[offset + 1], diffuseBuffer[offset + 2])
|
|
4540
4540
|
.toLinearSpace(scene.getEngine().useExactSrgbConversions)
|
|
4541
4541
|
.multiply(factors.diffuseColor);
|
|
4542
|
-
const specularColor = new
|
|
4542
|
+
const specularColor = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3(specularGlossinessBuffer[offset], specularGlossinessBuffer[offset + 1], specularGlossinessBuffer[offset + 2])
|
|
4543
4543
|
.toLinearSpace(scene.getEngine().useExactSrgbConversions)
|
|
4544
4544
|
.multiply(factors.specularColor);
|
|
4545
4545
|
const glossiness = specularGlossinessBuffer[offset + 3] * factors.glossiness;
|
|
@@ -4578,19 +4578,19 @@ class _GLTFMaterialExporter {
|
|
|
4578
4578
|
baseColorBuffer[destinationOffset] /= metallicRoughnessFactors.baseColor.r > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors.baseColor.r : 1;
|
|
4579
4579
|
baseColorBuffer[destinationOffset + 1] /= metallicRoughnessFactors.baseColor.g > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors.baseColor.g : 1;
|
|
4580
4580
|
baseColorBuffer[destinationOffset + 2] /= metallicRoughnessFactors.baseColor.b > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors.baseColor.b : 1;
|
|
4581
|
-
const linearBaseColorPixel =
|
|
4581
|
+
const linearBaseColorPixel = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.FromInts(baseColorBuffer[destinationOffset], baseColorBuffer[destinationOffset + 1], baseColorBuffer[destinationOffset + 2]);
|
|
4582
4582
|
const sRGBBaseColorPixel = linearBaseColorPixel.toGammaSpace(scene.getEngine().useExactSrgbConversions);
|
|
4583
4583
|
baseColorBuffer[destinationOffset] = sRGBBaseColorPixel.r * 255;
|
|
4584
4584
|
baseColorBuffer[destinationOffset + 1] = sRGBBaseColorPixel.g * 255;
|
|
4585
4585
|
baseColorBuffer[destinationOffset + 2] = sRGBBaseColorPixel.b * 255;
|
|
4586
|
-
if (!_GLTFMaterialExporter._FuzzyEquals(sRGBBaseColorPixel,
|
|
4586
|
+
if (!_GLTFMaterialExporter._FuzzyEquals(sRGBBaseColorPixel, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White(), _GLTFMaterialExporter._Epsilon)) {
|
|
4587
4587
|
writeOutBaseColorTexture = true;
|
|
4588
4588
|
}
|
|
4589
4589
|
metallicRoughnessBuffer[destinationOffset + 1] /=
|
|
4590
4590
|
metallicRoughnessFactors.roughness > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors.roughness : 1;
|
|
4591
4591
|
metallicRoughnessBuffer[destinationOffset + 2] /= metallicRoughnessFactors.metallic > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors.metallic : 1;
|
|
4592
|
-
const metallicRoughnessPixel =
|
|
4593
|
-
if (!_GLTFMaterialExporter._FuzzyEquals(metallicRoughnessPixel,
|
|
4592
|
+
const metallicRoughnessPixel = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.FromInts(255, metallicRoughnessBuffer[destinationOffset + 1], metallicRoughnessBuffer[destinationOffset + 2]);
|
|
4593
|
+
if (!_GLTFMaterialExporter._FuzzyEquals(metallicRoughnessPixel, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White(), _GLTFMaterialExporter._Epsilon)) {
|
|
4594
4594
|
writeOutMetallicRoughnessTexture = true;
|
|
4595
4595
|
}
|
|
4596
4596
|
}
|
|
@@ -4627,7 +4627,7 @@ class _GLTFMaterialExporter {
|
|
|
4627
4627
|
const baseColorFromSpecular = specularGlossiness.specularColor
|
|
4628
4628
|
.subtract(_GLTFMaterialExporter._DielectricSpecular.scale(1 - metallic))
|
|
4629
4629
|
.scale(1 / Math.max(metallic, _GLTFMaterialExporter._Epsilon));
|
|
4630
|
-
let baseColor =
|
|
4630
|
+
let baseColor = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Lerp(baseColorFromDiffuse, baseColorFromSpecular, metallic * metallic);
|
|
4631
4631
|
baseColor = baseColor.clampToRef(0, 1, baseColor);
|
|
4632
4632
|
const metallicRoughness = {
|
|
4633
4633
|
baseColor: baseColor,
|
|
@@ -4700,7 +4700,7 @@ class _GLTFMaterialExporter {
|
|
|
4700
4700
|
}
|
|
4701
4701
|
_getTextureSampler(texture) {
|
|
4702
4702
|
const sampler = {};
|
|
4703
|
-
if (!texture || !(texture instanceof
|
|
4703
|
+
if (!texture || !(texture instanceof babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture)) {
|
|
4704
4704
|
return sampler;
|
|
4705
4705
|
}
|
|
4706
4706
|
const wrapS = this._getGLTFTextureWrapMode(texture.wrapU);
|
|
@@ -4712,62 +4712,62 @@ class _GLTFMaterialExporter {
|
|
|
4712
4712
|
sampler.wrapT = wrapT;
|
|
4713
4713
|
}
|
|
4714
4714
|
switch (texture.samplingMode) {
|
|
4715
|
-
case
|
|
4715
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_LINEAR: {
|
|
4716
4716
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
4717
4717
|
sampler.minFilter = 9729 /* TextureMinFilter.LINEAR */;
|
|
4718
4718
|
break;
|
|
4719
4719
|
}
|
|
4720
|
-
case
|
|
4720
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_NEAREST: {
|
|
4721
4721
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
4722
4722
|
sampler.minFilter = 9728 /* TextureMinFilter.NEAREST */;
|
|
4723
4723
|
break;
|
|
4724
4724
|
}
|
|
4725
|
-
case
|
|
4725
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_LINEAR: {
|
|
4726
4726
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
4727
4727
|
sampler.minFilter = 9729 /* TextureMinFilter.LINEAR */;
|
|
4728
4728
|
break;
|
|
4729
4729
|
}
|
|
4730
|
-
case
|
|
4730
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_LINEAR_MIPLINEAR: {
|
|
4731
4731
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
4732
4732
|
sampler.minFilter = 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */;
|
|
4733
4733
|
break;
|
|
4734
4734
|
}
|
|
4735
|
-
case
|
|
4735
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_NEAREST: {
|
|
4736
4736
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
4737
4737
|
sampler.minFilter = 9728 /* TextureMinFilter.NEAREST */;
|
|
4738
4738
|
break;
|
|
4739
4739
|
}
|
|
4740
|
-
case
|
|
4740
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_LINEAR_MIPNEAREST: {
|
|
4741
4741
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
4742
4742
|
sampler.minFilter = 9985 /* TextureMinFilter.LINEAR_MIPMAP_NEAREST */;
|
|
4743
4743
|
break;
|
|
4744
4744
|
}
|
|
4745
|
-
case
|
|
4745
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_NEAREST_MIPNEAREST: {
|
|
4746
4746
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
4747
4747
|
sampler.minFilter = 9984 /* TextureMinFilter.NEAREST_MIPMAP_NEAREST */;
|
|
4748
4748
|
break;
|
|
4749
4749
|
}
|
|
4750
|
-
case
|
|
4750
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_NEAREST_MIPLINEAR: {
|
|
4751
4751
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
4752
4752
|
sampler.minFilter = 9986 /* TextureMinFilter.NEAREST_MIPMAP_LINEAR */;
|
|
4753
4753
|
break;
|
|
4754
4754
|
}
|
|
4755
|
-
case
|
|
4755
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_NEAREST_MIPLINEAR: {
|
|
4756
4756
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
4757
4757
|
sampler.minFilter = 9986 /* TextureMinFilter.NEAREST_MIPMAP_LINEAR */;
|
|
4758
4758
|
break;
|
|
4759
4759
|
}
|
|
4760
|
-
case
|
|
4760
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_LINEAR_MIPLINEAR: {
|
|
4761
4761
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
4762
4762
|
sampler.minFilter = 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */;
|
|
4763
4763
|
break;
|
|
4764
4764
|
}
|
|
4765
|
-
case
|
|
4765
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_LINEAR_MIPNEAREST: {
|
|
4766
4766
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
4767
4767
|
sampler.minFilter = 9985 /* TextureMinFilter.LINEAR_MIPMAP_NEAREST */;
|
|
4768
4768
|
break;
|
|
4769
4769
|
}
|
|
4770
|
-
case
|
|
4770
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_NEAREST_MIPNEAREST: {
|
|
4771
4771
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
4772
4772
|
sampler.minFilter = 9984 /* TextureMinFilter.NEAREST_MIPMAP_NEAREST */;
|
|
4773
4773
|
break;
|
|
@@ -4777,17 +4777,17 @@ class _GLTFMaterialExporter {
|
|
|
4777
4777
|
}
|
|
4778
4778
|
_getGLTFTextureWrapMode(wrapMode) {
|
|
4779
4779
|
switch (wrapMode) {
|
|
4780
|
-
case
|
|
4780
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.WRAP_ADDRESSMODE: {
|
|
4781
4781
|
return 10497 /* TextureWrapMode.REPEAT */;
|
|
4782
4782
|
}
|
|
4783
|
-
case
|
|
4783
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.CLAMP_ADDRESSMODE: {
|
|
4784
4784
|
return 33071 /* TextureWrapMode.CLAMP_TO_EDGE */;
|
|
4785
4785
|
}
|
|
4786
|
-
case
|
|
4786
|
+
case babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.MIRROR_ADDRESSMODE: {
|
|
4787
4787
|
return 33648 /* TextureWrapMode.MIRRORED_REPEAT */;
|
|
4788
4788
|
}
|
|
4789
4789
|
default: {
|
|
4790
|
-
|
|
4790
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error(`Unsupported Texture Wrap Mode ${wrapMode}!`);
|
|
4791
4791
|
return 10497 /* TextureWrapMode.REPEAT */;
|
|
4792
4792
|
}
|
|
4793
4793
|
}
|
|
@@ -4867,7 +4867,7 @@ class _GLTFMaterialExporter {
|
|
|
4867
4867
|
const promises = [];
|
|
4868
4868
|
if (metallicRoughness) {
|
|
4869
4869
|
_GLTFMaterialExporter._SetAlphaMode(glTFMaterial, babylonPBRMaterial);
|
|
4870
|
-
if (!(_GLTFMaterialExporter._FuzzyEquals(metallicRoughness.baseColor,
|
|
4870
|
+
if (!(_GLTFMaterialExporter._FuzzyEquals(metallicRoughness.baseColor, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White(), _GLTFMaterialExporter._Epsilon) &&
|
|
4871
4871
|
babylonPBRMaterial.alpha >= _GLTFMaterialExporter._Epsilon)) {
|
|
4872
4872
|
glTFPbrMetallicRoughness.baseColorFactor = [metallicRoughness.baseColor.r, metallicRoughness.baseColor.g, metallicRoughness.baseColor.b, babylonPBRMaterial.alpha];
|
|
4873
4873
|
}
|
|
@@ -4879,7 +4879,7 @@ class _GLTFMaterialExporter {
|
|
|
4879
4879
|
}
|
|
4880
4880
|
if (babylonPBRMaterial.backFaceCulling != null && !babylonPBRMaterial.backFaceCulling) {
|
|
4881
4881
|
if (!babylonPBRMaterial._twoSidedLighting) {
|
|
4882
|
-
|
|
4882
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(babylonPBRMaterial.name + ": Back-face culling disabled and two-sided lighting disabled is not supported in glTF.");
|
|
4883
4883
|
}
|
|
4884
4884
|
glTFMaterial.doubleSided = true;
|
|
4885
4885
|
}
|
|
@@ -4925,7 +4925,7 @@ class _GLTFMaterialExporter {
|
|
|
4925
4925
|
}
|
|
4926
4926
|
}
|
|
4927
4927
|
const emissiveColor = babylonPBRMaterial._emissiveColor;
|
|
4928
|
-
if (!_GLTFMaterialExporter._FuzzyEquals(emissiveColor,
|
|
4928
|
+
if (!_GLTFMaterialExporter._FuzzyEquals(emissiveColor, babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Black(), _GLTFMaterialExporter._Epsilon)) {
|
|
4929
4929
|
glTFMaterial.emissiveFactor = emissiveColor.asArray();
|
|
4930
4930
|
}
|
|
4931
4931
|
glTFMaterial.pbrMetallicRoughness = glTFPbrMetallicRoughness;
|
|
@@ -4935,7 +4935,7 @@ class _GLTFMaterialExporter {
|
|
|
4935
4935
|
return this._finishMaterial(promises, glTFMaterial, babylonPBRMaterial, mimeType);
|
|
4936
4936
|
}
|
|
4937
4937
|
_getPixelsFromTexture(babylonTexture) {
|
|
4938
|
-
const pixels = babylonTexture.textureType ===
|
|
4938
|
+
const pixels = babylonTexture.textureType === babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURETYPE_UNSIGNED_INT
|
|
4939
4939
|
? babylonTexture.readPixels()
|
|
4940
4940
|
: babylonTexture.readPixels();
|
|
4941
4941
|
return pixels;
|
|
@@ -4976,7 +4976,7 @@ class _GLTFMaterialExporter {
|
|
|
4976
4976
|
mimeType = textureMimeType;
|
|
4977
4977
|
break;
|
|
4978
4978
|
default:
|
|
4979
|
-
|
|
4979
|
+
babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`Unsupported media type: ${textureMimeType}`);
|
|
4980
4980
|
break;
|
|
4981
4981
|
}
|
|
4982
4982
|
}
|
|
@@ -5004,7 +5004,7 @@ class _GLTFMaterialExporter {
|
|
|
5004
5004
|
const extension = getFileExtensionFromMimeType(mimeType);
|
|
5005
5005
|
let fileName = baseName + extension;
|
|
5006
5006
|
if (fileName in imageData) {
|
|
5007
|
-
fileName = `${baseName}_${
|
|
5007
|
+
fileName = `${baseName}_${babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.RandomId()}${extension}`;
|
|
5008
5008
|
}
|
|
5009
5009
|
imageData[fileName] = {
|
|
5010
5010
|
data: data,
|
|
@@ -5048,7 +5048,7 @@ class _GLTFMaterialExporter {
|
|
|
5048
5048
|
/**
|
|
5049
5049
|
* Represents the dielectric specular values for R, G and B
|
|
5050
5050
|
*/
|
|
5051
|
-
_GLTFMaterialExporter._DielectricSpecular = new
|
|
5051
|
+
_GLTFMaterialExporter._DielectricSpecular = new babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3(0.04, 0.04, 0.04);
|
|
5052
5052
|
/**
|
|
5053
5053
|
* Allows the maximum specular power to be defined for material calculations
|
|
5054
5054
|
*/
|
|
@@ -5061,17 +5061,17 @@ _GLTFMaterialExporter._Epsilon = 1e-6;
|
|
|
5061
5061
|
|
|
5062
5062
|
/***/ }),
|
|
5063
5063
|
|
|
5064
|
-
/***/ "../../../dev/serializers/
|
|
5065
|
-
|
|
5066
|
-
!*** ../../../dev/serializers/
|
|
5067
|
-
|
|
5064
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFSerializer.ts":
|
|
5065
|
+
/*!***************************************************************!*\
|
|
5066
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFSerializer.ts ***!
|
|
5067
|
+
\***************************************************************/
|
|
5068
5068
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5069
5069
|
|
|
5070
5070
|
__webpack_require__.r(__webpack_exports__);
|
|
5071
5071
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5072
5072
|
/* harmony export */ GLTF2Export: () => (/* binding */ GLTF2Export)
|
|
5073
5073
|
/* harmony export */ });
|
|
5074
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFExporter */ "../../../dev/serializers/
|
|
5074
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
5075
5075
|
|
|
5076
5076
|
/**
|
|
5077
5077
|
* Class for generating glTF data from a Babylon scene.
|
|
@@ -5133,18 +5133,18 @@ class GLTF2Export {
|
|
|
5133
5133
|
|
|
5134
5134
|
/***/ }),
|
|
5135
5135
|
|
|
5136
|
-
/***/ "../../../dev/serializers/
|
|
5137
|
-
|
|
5138
|
-
!*** ../../../dev/serializers/
|
|
5139
|
-
|
|
5136
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/glTFUtilities.ts":
|
|
5137
|
+
/*!**************************************************************!*\
|
|
5138
|
+
!*** ../../../dev/serializers/src/glTF/2.0/glTFUtilities.ts ***!
|
|
5139
|
+
\**************************************************************/
|
|
5140
5140
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5141
5141
|
|
|
5142
5142
|
__webpack_require__.r(__webpack_exports__);
|
|
5143
5143
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5144
5144
|
/* harmony export */ _GLTFUtilities: () => (/* binding */ _GLTFUtilities)
|
|
5145
5145
|
/* harmony export */ });
|
|
5146
|
-
/* harmony import */ var
|
|
5147
|
-
/* harmony import */ var
|
|
5146
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Maths/math.vector */ "babylonjs/Maths/math.vector");
|
|
5147
|
+
/* harmony import */ var babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
5148
5148
|
|
|
5149
5149
|
/**
|
|
5150
5150
|
* @internal
|
|
@@ -5214,7 +5214,7 @@ class _GLTFUtilities {
|
|
|
5214
5214
|
if (vertexCount) {
|
|
5215
5215
|
for (let i = vertexStart, length = vertexStart + vertexCount; i < length; ++i) {
|
|
5216
5216
|
indexOffset = positionStrideSize * i;
|
|
5217
|
-
position =
|
|
5217
|
+
position = babylonjs_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(positions, indexOffset);
|
|
5218
5218
|
vector = position.asArray();
|
|
5219
5219
|
for (let j = 0; j < positionStrideSize; ++j) {
|
|
5220
5220
|
const num = vector[j];
|
|
@@ -5261,10 +5261,10 @@ class _GLTFUtilities {
|
|
|
5261
5261
|
|
|
5262
5262
|
/***/ }),
|
|
5263
5263
|
|
|
5264
|
-
/***/ "../../../dev/serializers/
|
|
5265
|
-
|
|
5266
|
-
!*** ../../../dev/serializers/
|
|
5267
|
-
|
|
5264
|
+
/***/ "../../../dev/serializers/src/glTF/2.0/index.ts":
|
|
5265
|
+
/*!******************************************************!*\
|
|
5266
|
+
!*** ../../../dev/serializers/src/glTF/2.0/index.ts ***!
|
|
5267
|
+
\******************************************************/
|
|
5268
5268
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5269
5269
|
|
|
5270
5270
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -5291,14 +5291,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5291
5291
|
/* harmony export */ _GLTFUtilities: () => (/* reexport safe */ _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__._GLTFUtilities),
|
|
5292
5292
|
/* harmony export */ __IGLTFExporterExtensionV2: () => (/* reexport safe */ _glTFExporterExtension__WEBPACK_IMPORTED_MODULE_3__.__IGLTFExporterExtensionV2)
|
|
5293
5293
|
/* harmony export */ });
|
|
5294
|
-
/* harmony import */ var _glTFAnimation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFAnimation */ "../../../dev/serializers/
|
|
5295
|
-
/* harmony import */ var _glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFData */ "../../../dev/serializers/
|
|
5296
|
-
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFExporter */ "../../../dev/serializers/
|
|
5297
|
-
/* harmony import */ var _glTFExporterExtension__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFExporterExtension */ "../../../dev/serializers/
|
|
5298
|
-
/* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../dev/serializers/
|
|
5299
|
-
/* harmony import */ var _glTFSerializer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./glTFSerializer */ "../../../dev/serializers/
|
|
5300
|
-
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./glTFUtilities */ "../../../dev/serializers/
|
|
5301
|
-
/* harmony import */ var _Extensions_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Extensions/index */ "../../../dev/serializers/
|
|
5294
|
+
/* harmony import */ var _glTFAnimation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFAnimation */ "../../../dev/serializers/src/glTF/2.0/glTFAnimation.ts");
|
|
5295
|
+
/* harmony import */ var _glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFData */ "../../../dev/serializers/src/glTF/2.0/glTFData.ts");
|
|
5296
|
+
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFExporter */ "../../../dev/serializers/src/glTF/2.0/glTFExporter.ts");
|
|
5297
|
+
/* harmony import */ var _glTFExporterExtension__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFExporterExtension */ "../../../dev/serializers/src/glTF/2.0/glTFExporterExtension.ts");
|
|
5298
|
+
/* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../dev/serializers/src/glTF/2.0/glTFMaterialExporter.ts");
|
|
5299
|
+
/* harmony import */ var _glTFSerializer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./glTFSerializer */ "../../../dev/serializers/src/glTF/2.0/glTFSerializer.ts");
|
|
5300
|
+
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./glTFUtilities */ "../../../dev/serializers/src/glTF/2.0/glTFUtilities.ts");
|
|
5301
|
+
/* harmony import */ var _Extensions_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Extensions/index */ "../../../dev/serializers/src/glTF/2.0/Extensions/index.ts");
|
|
5302
5302
|
/* eslint-disable import/no-internal-modules */
|
|
5303
5303
|
|
|
5304
5304
|
|
|
@@ -5312,10 +5312,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5312
5312
|
|
|
5313
5313
|
/***/ }),
|
|
5314
5314
|
|
|
5315
|
-
/***/ "../../../dev/serializers/
|
|
5316
|
-
|
|
5317
|
-
!*** ../../../dev/serializers/
|
|
5318
|
-
|
|
5315
|
+
/***/ "../../../dev/serializers/src/glTF/glTFFileExporter.ts":
|
|
5316
|
+
/*!*************************************************************!*\
|
|
5317
|
+
!*** ../../../dev/serializers/src/glTF/glTFFileExporter.ts ***!
|
|
5318
|
+
\*************************************************************/
|
|
5319
5319
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5320
5320
|
|
|
5321
5321
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -5329,10 +5329,10 @@ var __IGLTFExporterExtension = 0; // I am here to allow dts to be created
|
|
|
5329
5329
|
|
|
5330
5330
|
/***/ }),
|
|
5331
5331
|
|
|
5332
|
-
/***/ "../../../lts/serializers/
|
|
5333
|
-
|
|
5334
|
-
!*** ../../../lts/serializers/
|
|
5335
|
-
|
|
5332
|
+
/***/ "../../../lts/serializers/src/legacy/legacy-glTF2Serializer.ts":
|
|
5333
|
+
/*!*********************************************************************!*\
|
|
5334
|
+
!*** ../../../lts/serializers/src/legacy/legacy-glTF2Serializer.ts ***!
|
|
5335
|
+
\*********************************************************************/
|
|
5336
5336
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5337
5337
|
|
|
5338
5338
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -5360,11 +5360,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5360
5360
|
/* harmony export */ __IGLTFExporterExtension: () => (/* reexport safe */ serializers_glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__.__IGLTFExporterExtension),
|
|
5361
5361
|
/* harmony export */ __IGLTFExporterExtensionV2: () => (/* reexport safe */ serializers_glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.__IGLTFExporterExtensionV2)
|
|
5362
5362
|
/* harmony export */ });
|
|
5363
|
-
/* harmony import */ var serializers_glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serializers/glTF/glTFFileExporter */ "../../../dev/serializers/
|
|
5364
|
-
/* harmony import */ var serializers_glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serializers/glTF/2.0/glTFData */ "../../../dev/serializers/
|
|
5365
|
-
/* harmony import */ var serializers_glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! serializers/glTF/2.0/glTFSerializer */ "../../../dev/serializers/
|
|
5366
|
-
/* harmony import */ var serializers_glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! serializers/glTF/2.0/Extensions/index */ "../../../dev/serializers/
|
|
5367
|
-
/* harmony import */ var serializers_glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! serializers/glTF/2.0/index */ "../../../dev/serializers/
|
|
5363
|
+
/* harmony import */ var serializers_glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serializers/glTF/glTFFileExporter */ "../../../dev/serializers/src/glTF/glTFFileExporter.ts");
|
|
5364
|
+
/* harmony import */ var serializers_glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serializers/glTF/2.0/glTFData */ "../../../dev/serializers/src/glTF/2.0/glTFData.ts");
|
|
5365
|
+
/* harmony import */ var serializers_glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! serializers/glTF/2.0/glTFSerializer */ "../../../dev/serializers/src/glTF/2.0/glTFSerializer.ts");
|
|
5366
|
+
/* harmony import */ var serializers_glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! serializers/glTF/2.0/Extensions/index */ "../../../dev/serializers/src/glTF/2.0/Extensions/index.ts");
|
|
5367
|
+
/* harmony import */ var serializers_glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! serializers/glTF/2.0/index */ "../../../dev/serializers/src/glTF/2.0/index.ts");
|
|
5368
5368
|
/* eslint-disable import/no-internal-modules */
|
|
5369
5369
|
|
|
5370
5370
|
|
|
@@ -5375,36 +5375,36 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5375
5375
|
* This is the entry point for the UMD module.
|
|
5376
5376
|
* The entry point for a future ESM package should be index.ts
|
|
5377
5377
|
*/
|
|
5378
|
-
|
|
5378
|
+
const globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof window !== "undefined" ? window : undefined;
|
|
5379
5379
|
if (typeof globalObject !== "undefined") {
|
|
5380
5380
|
globalObject.BABYLON = globalObject.BABYLON || {};
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
for (
|
|
5387
|
-
|
|
5381
|
+
const BABYLON = globalObject.BABYLON;
|
|
5382
|
+
BABYLON.GLTF2 = BABYLON.GLTF2 || {};
|
|
5383
|
+
BABYLON.GLTF2.Exporter = BABYLON.GLTF2.Exporter || {};
|
|
5384
|
+
BABYLON.GLTF2.Exporter.Extensions = BABYLON.GLTF2.Exporter.Extensions || {};
|
|
5385
|
+
const keys = [];
|
|
5386
|
+
for (const key in serializers_glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__) {
|
|
5387
|
+
BABYLON[key] = serializers_glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
5388
5388
|
keys.push(key);
|
|
5389
5389
|
}
|
|
5390
|
-
for (
|
|
5391
|
-
|
|
5390
|
+
for (const key in serializers_glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__) {
|
|
5391
|
+
BABYLON[key] = serializers_glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
5392
5392
|
keys.push(key);
|
|
5393
5393
|
}
|
|
5394
|
-
for (
|
|
5395
|
-
|
|
5394
|
+
for (const key in serializers_glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__) {
|
|
5395
|
+
BABYLON[key] = serializers_glTF_2_0_glTFSerializer__WEBPACK_IMPORTED_MODULE_2__[key];
|
|
5396
5396
|
keys.push(key);
|
|
5397
5397
|
}
|
|
5398
|
-
for (
|
|
5399
|
-
|
|
5398
|
+
for (const key in serializers_glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__) {
|
|
5399
|
+
BABYLON.GLTF2.Exporter.Extensions[key] = serializers_glTF_2_0_Extensions_index__WEBPACK_IMPORTED_MODULE_3__[key];
|
|
5400
5400
|
keys.push(key);
|
|
5401
5401
|
}
|
|
5402
|
-
for (
|
|
5402
|
+
for (const key in serializers_glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__) {
|
|
5403
5403
|
// Prevent Reassignment.
|
|
5404
5404
|
if (keys.indexOf(key) > -1) {
|
|
5405
5405
|
continue;
|
|
5406
5406
|
}
|
|
5407
|
-
|
|
5407
|
+
BABYLON.GLTF2.Exporter[key] = serializers_glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
5408
5408
|
}
|
|
5409
5409
|
}
|
|
5410
5410
|
|
|
@@ -5413,13 +5413,13 @@ if (typeof globalObject !== "undefined") {
|
|
|
5413
5413
|
|
|
5414
5414
|
/***/ }),
|
|
5415
5415
|
|
|
5416
|
-
/***/ "
|
|
5416
|
+
/***/ "babylonjs/Maths/math.vector":
|
|
5417
5417
|
/*!****************************************************************************************************!*\
|
|
5418
5418
|
!*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
|
|
5419
5419
|
\****************************************************************************************************/
|
|
5420
5420
|
/***/ ((module) => {
|
|
5421
5421
|
|
|
5422
|
-
module.exports =
|
|
5422
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Maths_math_vector__;
|
|
5423
5423
|
|
|
5424
5424
|
/***/ })
|
|
5425
5425
|
|
|
@@ -5514,7 +5514,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5514
5514
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
5515
5515
|
/* harmony export */ serializers: () => (/* reexport module object */ _lts_serializers_legacy_legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_0__)
|
|
5516
5516
|
/* harmony export */ });
|
|
5517
|
-
/* harmony import */ var _lts_serializers_legacy_legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lts/serializers/legacy/legacy-glTF2Serializer */ "../../../lts/serializers/
|
|
5517
|
+
/* harmony import */ var _lts_serializers_legacy_legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lts/serializers/legacy/legacy-glTF2Serializer */ "../../../lts/serializers/src/legacy/legacy-glTF2Serializer.ts");
|
|
5518
5518
|
|
|
5519
5519
|
|
|
5520
5520
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_lts_serializers_legacy_legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_0__);
|