babylonjs-loaders 6.9.0 → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.glTF1FileLoader.js +928 -1399
- package/babylon.glTF1FileLoader.js.map +1 -1
- package/babylon.glTF1FileLoader.min.js +1 -1
- package/babylon.glTF1FileLoader.min.js.map +1 -1
- package/babylon.glTF2FileLoader.js +2345 -3059
- package/babylon.glTF2FileLoader.js.map +1 -1
- package/babylon.glTF2FileLoader.min.js +1 -1
- package/babylon.glTF2FileLoader.min.js.map +1 -1
- package/babylon.glTFFileLoader.js +2882 -3631
- package/babylon.glTFFileLoader.js.map +1 -1
- package/babylon.glTFFileLoader.min.js +1 -1
- package/babylon.glTFFileLoader.min.js.map +1 -1
- package/babylon.objFileLoader.js +292 -310
- package/babylon.objFileLoader.js.map +1 -1
- package/babylon.objFileLoader.min.js +1 -1
- package/babylon.objFileLoader.min.js.map +1 -1
- package/babylon.stlFileLoader.js +77 -78
- package/babylon.stlFileLoader.js.map +1 -1
- package/babylon.stlFileLoader.min.js +1 -1
- package/babylon.stlFileLoader.min.js.map +1 -1
- package/babylonjs.loaders.d.ts +16 -16
- package/babylonjs.loaders.js +3254 -4022
- package/babylonjs.loaders.js.map +1 -1
- package/babylonjs.loaders.min.js +1 -1
- package/babylonjs.loaders.min.js.map +1 -1
- package/babylonjs.loaders.module.d.ts +64 -64
- package/config.json +1 -1
- package/package.json +3 -3
- package/src/glTF1FileLoader.ts +1 -1
- package/src/glTF2FileLoader.ts +1 -1
- package/src/glTFFileLoader.ts +1 -1
- package/src/index.ts +1 -1
- package/src/objFileLoader.ts +1 -1
- package/src/stlFileLoader.ts +1 -1
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +2 -1
- package/webpack.config.js +4 -0
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
exports["babylonjs-loaders"] = factory(require("babylonjs"));
|
|
8
8
|
else
|
|
9
9
|
root["LOADERS"] = factory(root["BABYLON"]);
|
|
10
|
-
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (
|
|
10
|
+
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (__WEBPACK_EXTERNAL_MODULE_core_Misc_observable__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/ "../../../
|
|
15
|
+
/***/ "../../../dev/loaders/dist/glTF/1.0/glTFBinaryExtension.js":
|
|
16
16
|
/*!*****************************************************************!*\
|
|
17
|
-
!*** ../../../
|
|
17
|
+
!*** ../../../dev/loaders/dist/glTF/1.0/glTFBinaryExtension.js ***!
|
|
18
18
|
\*****************************************************************/
|
|
19
19
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
20
|
|
|
@@ -22,80 +22,75 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ GLTFBinaryExtension: () => (/* binding */ GLTFBinaryExtension)
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var
|
|
26
|
-
/* harmony import */ var
|
|
27
|
-
/* harmony import */ var
|
|
28
|
-
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../lts/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js");
|
|
25
|
+
/* harmony import */ var _glTFLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFLoader */ "../../../dev/loaders/dist/glTF/1.0/glTFLoader.js");
|
|
26
|
+
/* harmony import */ var _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFLoaderUtils */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderUtils.js");
|
|
27
|
+
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js");
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
var BinaryExtensionBufferName = "binary_glTF";
|
|
31
|
+
const BinaryExtensionBufferName = "binary_glTF";
|
|
34
32
|
/**
|
|
35
33
|
* @internal
|
|
36
34
|
* @deprecated
|
|
37
35
|
*/
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
return _super.call(this, "KHR_binary_glTF") || this;
|
|
36
|
+
class GLTFBinaryExtension extends _glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderExtension {
|
|
37
|
+
constructor() {
|
|
38
|
+
super("KHR_binary_glTF");
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
loadRuntimeAsync(scene, data, rootUrl, onSuccess) {
|
|
41
|
+
const extensionsUsed = data.json.extensionsUsed;
|
|
45
42
|
if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {
|
|
46
43
|
return false;
|
|
47
44
|
}
|
|
48
45
|
this._bin = data.bin;
|
|
49
46
|
onSuccess(_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
|
|
50
47
|
return true;
|
|
51
|
-
}
|
|
52
|
-
|
|
48
|
+
}
|
|
49
|
+
loadBufferAsync(gltfRuntime, id, onSuccess, onError) {
|
|
53
50
|
if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {
|
|
54
51
|
return false;
|
|
55
52
|
}
|
|
56
53
|
if (id !== BinaryExtensionBufferName) {
|
|
57
54
|
return false;
|
|
58
55
|
}
|
|
59
|
-
this._bin.readAsync(0, this._bin.byteLength).then(onSuccess,
|
|
56
|
+
this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));
|
|
60
57
|
return true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
}
|
|
59
|
+
loadTextureBufferAsync(gltfRuntime, id, onSuccess) {
|
|
60
|
+
const texture = gltfRuntime.textures[id];
|
|
61
|
+
const source = gltfRuntime.images[texture.source];
|
|
65
62
|
if (!source.extensions || !(this.name in source.extensions)) {
|
|
66
63
|
return false;
|
|
67
64
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
const sourceExt = source.extensions[this.name];
|
|
66
|
+
const bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];
|
|
67
|
+
const buffer = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_1__.GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_2__.EComponentType.UNSIGNED_BYTE);
|
|
71
68
|
onSuccess(buffer);
|
|
72
69
|
return true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
}
|
|
71
|
+
loadShaderStringAsync(gltfRuntime, id, onSuccess) {
|
|
72
|
+
const shader = gltfRuntime.shaders[id];
|
|
76
73
|
if (!shader.extensions || !(this.name in shader.extensions)) {
|
|
77
74
|
return false;
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setTimeout(
|
|
83
|
-
|
|
76
|
+
const binaryExtensionShader = shader.extensions[this.name];
|
|
77
|
+
const bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];
|
|
78
|
+
const shaderBytes = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_1__.GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_2__.EComponentType.UNSIGNED_BYTE);
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
const shaderString = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_1__.GLTFUtils.DecodeBufferToText(shaderBytes);
|
|
84
81
|
onSuccess(shaderString);
|
|
85
82
|
});
|
|
86
83
|
return true;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}(_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderExtension));
|
|
90
|
-
|
|
84
|
+
}
|
|
85
|
+
}
|
|
91
86
|
_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoader.RegisterExtension(new GLTFBinaryExtension());
|
|
92
87
|
|
|
93
88
|
|
|
94
89
|
/***/ }),
|
|
95
90
|
|
|
96
|
-
/***/ "../../../
|
|
91
|
+
/***/ "../../../dev/loaders/dist/glTF/1.0/glTFLoader.js":
|
|
97
92
|
/*!********************************************************!*\
|
|
98
|
-
!*** ../../../
|
|
93
|
+
!*** ../../../dev/loaders/dist/glTF/1.0/glTFLoader.js ***!
|
|
99
94
|
\********************************************************/
|
|
100
95
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
101
96
|
|
|
@@ -105,11 +100,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105
100
|
/* harmony export */ GLTFLoaderBase: () => (/* binding */ GLTFLoaderBase),
|
|
106
101
|
/* harmony export */ GLTFLoaderExtension: () => (/* binding */ GLTFLoaderExtension)
|
|
107
102
|
/* harmony export */ });
|
|
108
|
-
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../
|
|
109
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Engines/constants */ "core/Misc/
|
|
103
|
+
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js");
|
|
104
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Engines/constants */ "core/Misc/observable");
|
|
110
105
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
|
|
111
|
-
/* harmony import */ var _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFLoaderUtils */ "../../../
|
|
112
|
-
/* harmony import */ var _glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../glTFFileLoader */ "../../../
|
|
106
|
+
/* harmony import */ var _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFLoaderUtils */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderUtils.js");
|
|
107
|
+
/* harmony import */ var _glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../glTFFileLoader */ "../../../dev/loaders/dist/glTF/glTFFileLoader.js");
|
|
113
108
|
|
|
114
109
|
|
|
115
110
|
|
|
@@ -148,8 +143,8 @@ var ETokenType;
|
|
|
148
143
|
ETokenType[ETokenType["UNKNOWN"] = 2] = "UNKNOWN";
|
|
149
144
|
ETokenType[ETokenType["END_OF_INPUT"] = 3] = "END_OF_INPUT";
|
|
150
145
|
})(ETokenType || (ETokenType = {}));
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
class Tokenizer {
|
|
147
|
+
constructor(toParse) {
|
|
153
148
|
this._pos = 0;
|
|
154
149
|
this.currentToken = ETokenType.UNKNOWN;
|
|
155
150
|
this.currentIdentifier = "";
|
|
@@ -158,7 +153,7 @@ var Tokenizer = /** @class */ (function () {
|
|
|
158
153
|
this._toParse = toParse;
|
|
159
154
|
this._maxPos = toParse.length;
|
|
160
155
|
}
|
|
161
|
-
|
|
156
|
+
getNextToken() {
|
|
162
157
|
if (this.isEnd()) {
|
|
163
158
|
return ETokenType.END_OF_INPUT;
|
|
164
159
|
}
|
|
@@ -173,50 +168,49 @@ var Tokenizer = /** @class */ (function () {
|
|
|
173
168
|
}
|
|
174
169
|
}
|
|
175
170
|
return this.currentToken;
|
|
176
|
-
}
|
|
177
|
-
|
|
171
|
+
}
|
|
172
|
+
peek() {
|
|
178
173
|
return this._toParse[this._pos];
|
|
179
|
-
}
|
|
180
|
-
|
|
174
|
+
}
|
|
175
|
+
read() {
|
|
181
176
|
return this._toParse[this._pos++];
|
|
182
|
-
}
|
|
183
|
-
|
|
177
|
+
}
|
|
178
|
+
forward() {
|
|
184
179
|
this._pos++;
|
|
185
|
-
}
|
|
186
|
-
|
|
180
|
+
}
|
|
181
|
+
isEnd() {
|
|
187
182
|
return this._pos >= this._maxPos;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
}());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
191
185
|
/**
|
|
192
186
|
* Values
|
|
193
187
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
188
|
+
const glTFTransforms = ["MODEL", "VIEW", "PROJECTION", "MODELVIEW", "MODELVIEWPROJECTION", "JOINTMATRIX"];
|
|
189
|
+
const babylonTransforms = ["world", "view", "projection", "worldView", "worldViewProjection", "mBones"];
|
|
190
|
+
const glTFAnimationPaths = ["translation", "rotation", "scale"];
|
|
191
|
+
const babylonAnimationPaths = ["position", "rotationQuaternion", "scaling"];
|
|
198
192
|
/**
|
|
199
193
|
* Parse
|
|
200
194
|
* @param parsedBuffers
|
|
201
195
|
* @param gltfRuntime
|
|
202
196
|
*/
|
|
203
|
-
|
|
204
|
-
for (
|
|
205
|
-
|
|
197
|
+
const parseBuffers = (parsedBuffers, gltfRuntime) => {
|
|
198
|
+
for (const buf in parsedBuffers) {
|
|
199
|
+
const parsedBuffer = parsedBuffers[buf];
|
|
206
200
|
gltfRuntime.buffers[buf] = parsedBuffer;
|
|
207
201
|
gltfRuntime.buffersCount++;
|
|
208
202
|
}
|
|
209
203
|
};
|
|
210
|
-
|
|
211
|
-
for (
|
|
212
|
-
|
|
204
|
+
const parseShaders = (parsedShaders, gltfRuntime) => {
|
|
205
|
+
for (const sha in parsedShaders) {
|
|
206
|
+
const parsedShader = parsedShaders[sha];
|
|
213
207
|
gltfRuntime.shaders[sha] = parsedShader;
|
|
214
208
|
gltfRuntime.shaderscount++;
|
|
215
209
|
}
|
|
216
210
|
};
|
|
217
|
-
|
|
218
|
-
for (
|
|
219
|
-
|
|
211
|
+
const parseObject = (parsedObjects, runtimeProperty, gltfRuntime) => {
|
|
212
|
+
for (const object in parsedObjects) {
|
|
213
|
+
const parsedObject = parsedObjects[object];
|
|
220
214
|
gltfRuntime[runtimeProperty][object] = parsedObject;
|
|
221
215
|
}
|
|
222
216
|
};
|
|
@@ -224,15 +218,15 @@ var parseObject = function (parsedObjects, runtimeProperty, gltfRuntime) {
|
|
|
224
218
|
* Utils
|
|
225
219
|
* @param buffer
|
|
226
220
|
*/
|
|
227
|
-
|
|
221
|
+
const normalizeUVs = (buffer) => {
|
|
228
222
|
if (!buffer) {
|
|
229
223
|
return;
|
|
230
224
|
}
|
|
231
|
-
for (
|
|
225
|
+
for (let i = 0; i < buffer.length / 2; i++) {
|
|
232
226
|
buffer[i * 2 + 1] = 1.0 - buffer[i * 2 + 1];
|
|
233
227
|
}
|
|
234
228
|
};
|
|
235
|
-
|
|
229
|
+
const getAttribute = (attributeParameter) => {
|
|
236
230
|
if (attributeParameter.semantic === "NORMAL") {
|
|
237
231
|
return "normal";
|
|
238
232
|
}
|
|
@@ -249,7 +243,7 @@ var getAttribute = function (attributeParameter) {
|
|
|
249
243
|
return "color";
|
|
250
244
|
}
|
|
251
245
|
else if (attributeParameter.semantic && attributeParameter.semantic.indexOf("TEXCOORD_") !== -1) {
|
|
252
|
-
|
|
246
|
+
const channel = Number(attributeParameter.semantic.split("_")[1]);
|
|
253
247
|
return "uv" + (channel === 0 ? "" : channel + 1);
|
|
254
248
|
}
|
|
255
249
|
return null;
|
|
@@ -258,22 +252,22 @@ var getAttribute = function (attributeParameter) {
|
|
|
258
252
|
* Loads and creates animations
|
|
259
253
|
* @param gltfRuntime
|
|
260
254
|
*/
|
|
261
|
-
|
|
262
|
-
for (
|
|
263
|
-
|
|
255
|
+
const loadAnimations = (gltfRuntime) => {
|
|
256
|
+
for (const anim in gltfRuntime.animations) {
|
|
257
|
+
const animation = gltfRuntime.animations[anim];
|
|
264
258
|
if (!animation.channels || !animation.samplers) {
|
|
265
259
|
continue;
|
|
266
260
|
}
|
|
267
|
-
|
|
268
|
-
for (
|
|
261
|
+
let lastAnimation = null;
|
|
262
|
+
for (let i = 0; i < animation.channels.length; i++) {
|
|
269
263
|
// Get parameters and load buffers
|
|
270
|
-
|
|
271
|
-
|
|
264
|
+
const channel = animation.channels[i];
|
|
265
|
+
const sampler = animation.samplers[channel.sampler];
|
|
272
266
|
if (!sampler) {
|
|
273
267
|
continue;
|
|
274
268
|
}
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
let inputData = null;
|
|
270
|
+
let outputData = null;
|
|
277
271
|
if (animation.parameters) {
|
|
278
272
|
inputData = animation.parameters[sampler.input];
|
|
279
273
|
outputData = animation.parameters[sampler.output];
|
|
@@ -282,10 +276,10 @@ var loadAnimations = function (gltfRuntime) {
|
|
|
282
276
|
inputData = sampler.input;
|
|
283
277
|
outputData = sampler.output;
|
|
284
278
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
279
|
+
const bufferInput = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__.GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);
|
|
280
|
+
const bufferOutput = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__.GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);
|
|
281
|
+
const targetId = channel.target.id;
|
|
282
|
+
let targetNode = gltfRuntime.scene.getNodeById(targetId);
|
|
289
283
|
if (targetNode === null) {
|
|
290
284
|
targetNode = gltfRuntime.scene.getNodeByName(targetId);
|
|
291
285
|
}
|
|
@@ -293,15 +287,15 @@ var loadAnimations = function (gltfRuntime) {
|
|
|
293
287
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Creating animation named " + anim + ". But cannot find node named " + targetId + " to attach to");
|
|
294
288
|
continue;
|
|
295
289
|
}
|
|
296
|
-
|
|
290
|
+
const isBone = targetNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Bone;
|
|
297
291
|
// Get target path (position, rotation or scaling)
|
|
298
|
-
|
|
299
|
-
|
|
292
|
+
let targetPath = channel.target.path;
|
|
293
|
+
const targetPathIndex = glTFAnimationPaths.indexOf(targetPath);
|
|
300
294
|
if (targetPathIndex !== -1) {
|
|
301
295
|
targetPath = babylonAnimationPaths[targetPathIndex];
|
|
302
296
|
}
|
|
303
297
|
// Determine animation type
|
|
304
|
-
|
|
298
|
+
let animationType = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Animation.ANIMATIONTYPE_MATRIX;
|
|
305
299
|
if (!isBone) {
|
|
306
300
|
if (targetPath === "rotationQuaternion") {
|
|
307
301
|
animationType = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Animation.ANIMATIONTYPE_QUATERNION;
|
|
@@ -312,10 +306,10 @@ var loadAnimations = function (gltfRuntime) {
|
|
|
312
306
|
}
|
|
313
307
|
}
|
|
314
308
|
// Create animation and key frames
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
309
|
+
let babylonAnimation = null;
|
|
310
|
+
const keys = [];
|
|
311
|
+
let arrayOffset = 0;
|
|
312
|
+
let modifyKey = false;
|
|
319
313
|
if (isBone && lastAnimation && lastAnimation.getKeys().length === bufferInput.length) {
|
|
320
314
|
babylonAnimation = lastAnimation;
|
|
321
315
|
modifyKey = true;
|
|
@@ -326,8 +320,8 @@ var loadAnimations = function (gltfRuntime) {
|
|
|
326
320
|
gltfRuntime.scene._blockEntityCollection = false;
|
|
327
321
|
}
|
|
328
322
|
// For each frame
|
|
329
|
-
for (
|
|
330
|
-
|
|
323
|
+
for (let j = 0; j < bufferInput.length; j++) {
|
|
324
|
+
let value = null;
|
|
331
325
|
if (targetPath === "rotationQuaternion") {
|
|
332
326
|
// VEC4
|
|
333
327
|
value = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2], bufferOutput[arrayOffset + 3]]);
|
|
@@ -339,12 +333,12 @@ var loadAnimations = function (gltfRuntime) {
|
|
|
339
333
|
arrayOffset += 3;
|
|
340
334
|
}
|
|
341
335
|
if (isBone) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
336
|
+
const bone = targetNode;
|
|
337
|
+
let translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero();
|
|
338
|
+
let rotationQuaternion = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion();
|
|
339
|
+
let scaling = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero();
|
|
346
340
|
// Warning on decompose
|
|
347
|
-
|
|
341
|
+
let mat = bone.getBaseMatrix();
|
|
348
342
|
if (modifyKey && lastAnimation) {
|
|
349
343
|
mat = lastAnimation.getKeys()[j].value;
|
|
350
344
|
}
|
|
@@ -385,12 +379,12 @@ var loadAnimations = function (gltfRuntime) {
|
|
|
385
379
|
* Returns the bones transformation matrix
|
|
386
380
|
* @param node
|
|
387
381
|
*/
|
|
388
|
-
|
|
389
|
-
|
|
382
|
+
const configureBoneTransformation = (node) => {
|
|
383
|
+
let mat = null;
|
|
390
384
|
if (node.translation || node.rotation || node.scale) {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
385
|
+
const scale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(node.scale || [1, 1, 1]);
|
|
386
|
+
const rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray(node.rotation || [0, 0, 0, 1]);
|
|
387
|
+
const position = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(node.translation || [0, 0, 0]);
|
|
394
388
|
mat = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Matrix.Compose(scale, rotation, position);
|
|
395
389
|
}
|
|
396
390
|
else {
|
|
@@ -405,29 +399,29 @@ var configureBoneTransformation = function (node) {
|
|
|
405
399
|
* @param jointName
|
|
406
400
|
* @param newSkeleton
|
|
407
401
|
*/
|
|
408
|
-
|
|
402
|
+
const getParentBone = (gltfRuntime, skins, jointName, newSkeleton) => {
|
|
409
403
|
// Try to find
|
|
410
|
-
for (
|
|
404
|
+
for (let i = 0; i < newSkeleton.bones.length; i++) {
|
|
411
405
|
if (newSkeleton.bones[i].name === jointName) {
|
|
412
406
|
return newSkeleton.bones[i];
|
|
413
407
|
}
|
|
414
408
|
}
|
|
415
409
|
// Not found, search in gltf nodes
|
|
416
|
-
|
|
417
|
-
for (
|
|
418
|
-
|
|
410
|
+
const nodes = gltfRuntime.nodes;
|
|
411
|
+
for (const nde in nodes) {
|
|
412
|
+
const node = nodes[nde];
|
|
419
413
|
if (!node.jointName) {
|
|
420
414
|
continue;
|
|
421
415
|
}
|
|
422
|
-
|
|
423
|
-
for (
|
|
424
|
-
|
|
416
|
+
const children = node.children;
|
|
417
|
+
for (let i = 0; i < children.length; i++) {
|
|
418
|
+
const child = gltfRuntime.nodes[children[i]];
|
|
425
419
|
if (!child.jointName) {
|
|
426
420
|
continue;
|
|
427
421
|
}
|
|
428
422
|
if (child.jointName === jointName) {
|
|
429
|
-
|
|
430
|
-
|
|
423
|
+
const mat = configureBoneTransformation(node);
|
|
424
|
+
const bone = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Bone(node.name || "", newSkeleton, getParentBone(gltfRuntime, skins, node.jointName, newSkeleton), mat);
|
|
431
425
|
bone.id = nde;
|
|
432
426
|
return bone;
|
|
433
427
|
}
|
|
@@ -440,11 +434,11 @@ var getParentBone = function (gltfRuntime, skins, jointName, newSkeleton) {
|
|
|
440
434
|
* @param nodesToRoot
|
|
441
435
|
* @param id
|
|
442
436
|
*/
|
|
443
|
-
|
|
444
|
-
for (
|
|
445
|
-
|
|
446
|
-
for (
|
|
447
|
-
|
|
437
|
+
const getNodeToRoot = (nodesToRoot, id) => {
|
|
438
|
+
for (let i = 0; i < nodesToRoot.length; i++) {
|
|
439
|
+
const nodeToRoot = nodesToRoot[i];
|
|
440
|
+
for (let j = 0; j < nodeToRoot.node.children.length; j++) {
|
|
441
|
+
const child = nodeToRoot.node.children[j];
|
|
448
442
|
if (child === id) {
|
|
449
443
|
return nodeToRoot.bone;
|
|
450
444
|
}
|
|
@@ -457,16 +451,16 @@ var getNodeToRoot = function (nodesToRoot, id) {
|
|
|
457
451
|
* @param gltfRuntime
|
|
458
452
|
* @param jointName
|
|
459
453
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
454
|
+
const getJointNode = (gltfRuntime, jointName) => {
|
|
455
|
+
const nodes = gltfRuntime.nodes;
|
|
456
|
+
let node = nodes[jointName];
|
|
463
457
|
if (node) {
|
|
464
458
|
return {
|
|
465
459
|
node: node,
|
|
466
460
|
id: jointName,
|
|
467
461
|
};
|
|
468
462
|
}
|
|
469
|
-
for (
|
|
463
|
+
for (const nde in nodes) {
|
|
470
464
|
node = nodes[nde];
|
|
471
465
|
if (node.jointName === jointName) {
|
|
472
466
|
return {
|
|
@@ -482,8 +476,8 @@ var getJointNode = function (gltfRuntime, jointName) {
|
|
|
482
476
|
* @param skins
|
|
483
477
|
* @param id
|
|
484
478
|
*/
|
|
485
|
-
|
|
486
|
-
for (
|
|
479
|
+
const nodeIsInJoints = (skins, id) => {
|
|
480
|
+
for (let i = 0; i < skins.jointNames.length; i++) {
|
|
487
481
|
if (skins.jointNames[i] === id) {
|
|
488
482
|
return true;
|
|
489
483
|
}
|
|
@@ -497,27 +491,27 @@ var nodeIsInJoints = function (skins, id) {
|
|
|
497
491
|
* @param skins
|
|
498
492
|
* @param nodesToRoot
|
|
499
493
|
*/
|
|
500
|
-
|
|
494
|
+
const getNodesToRoot = (gltfRuntime, newSkeleton, skins, nodesToRoot) => {
|
|
501
495
|
// Creates nodes for root
|
|
502
|
-
for (
|
|
503
|
-
|
|
504
|
-
|
|
496
|
+
for (const nde in gltfRuntime.nodes) {
|
|
497
|
+
const node = gltfRuntime.nodes[nde];
|
|
498
|
+
const id = nde;
|
|
505
499
|
if (!node.jointName || nodeIsInJoints(skins, node.jointName)) {
|
|
506
500
|
continue;
|
|
507
501
|
}
|
|
508
502
|
// Create node to root bone
|
|
509
|
-
|
|
510
|
-
|
|
503
|
+
const mat = configureBoneTransformation(node);
|
|
504
|
+
const bone = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Bone(node.name || "", newSkeleton, null, mat);
|
|
511
505
|
bone.id = id;
|
|
512
506
|
nodesToRoot.push({ bone: bone, node: node, id: id });
|
|
513
507
|
}
|
|
514
508
|
// Parenting
|
|
515
|
-
for (
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
for (
|
|
519
|
-
|
|
520
|
-
for (
|
|
509
|
+
for (let i = 0; i < nodesToRoot.length; i++) {
|
|
510
|
+
const nodeToRoot = nodesToRoot[i];
|
|
511
|
+
const children = nodeToRoot.node.children;
|
|
512
|
+
for (let j = 0; j < children.length; j++) {
|
|
513
|
+
let child = null;
|
|
514
|
+
for (let k = 0; k < nodesToRoot.length; k++) {
|
|
521
515
|
if (nodesToRoot[k].id === children[j]) {
|
|
522
516
|
child = nodesToRoot[k];
|
|
523
517
|
break;
|
|
@@ -537,7 +531,7 @@ var getNodesToRoot = function (gltfRuntime, newSkeleton, skins, nodesToRoot) {
|
|
|
537
531
|
* @param mesh
|
|
538
532
|
* @param newSkeleton
|
|
539
533
|
*/
|
|
540
|
-
|
|
534
|
+
const importSkeleton = (gltfRuntime, skins, mesh, newSkeleton) => {
|
|
541
535
|
if (!newSkeleton) {
|
|
542
536
|
newSkeleton = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Skeleton(skins.name || "", "", gltfRuntime.scene);
|
|
543
537
|
}
|
|
@@ -545,47 +539,47 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton) {
|
|
|
545
539
|
return newSkeleton;
|
|
546
540
|
}
|
|
547
541
|
// Find the root bones
|
|
548
|
-
|
|
549
|
-
|
|
542
|
+
const nodesToRoot = [];
|
|
543
|
+
const nodesToRootToAdd = [];
|
|
550
544
|
getNodesToRoot(gltfRuntime, newSkeleton, skins, nodesToRoot);
|
|
551
545
|
newSkeleton.bones = [];
|
|
552
546
|
// Joints
|
|
553
|
-
for (
|
|
554
|
-
|
|
547
|
+
for (let i = 0; i < skins.jointNames.length; i++) {
|
|
548
|
+
const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);
|
|
555
549
|
if (!jointNode) {
|
|
556
550
|
continue;
|
|
557
551
|
}
|
|
558
|
-
|
|
552
|
+
const node = jointNode.node;
|
|
559
553
|
if (!node) {
|
|
560
554
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Joint named " + skins.jointNames[i] + " does not exist");
|
|
561
555
|
continue;
|
|
562
556
|
}
|
|
563
|
-
|
|
557
|
+
const id = jointNode.id;
|
|
564
558
|
// Optimize, if the bone already exists...
|
|
565
|
-
|
|
559
|
+
const existingBone = gltfRuntime.scene.getBoneById(id);
|
|
566
560
|
if (existingBone) {
|
|
567
561
|
newSkeleton.bones.push(existingBone);
|
|
568
562
|
continue;
|
|
569
563
|
}
|
|
570
564
|
// Search for parent bone
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
for (
|
|
574
|
-
|
|
575
|
-
if (!
|
|
565
|
+
let foundBone = false;
|
|
566
|
+
let parentBone = null;
|
|
567
|
+
for (let j = 0; j < i; j++) {
|
|
568
|
+
const jointNode = getJointNode(gltfRuntime, skins.jointNames[j]);
|
|
569
|
+
if (!jointNode) {
|
|
576
570
|
continue;
|
|
577
571
|
}
|
|
578
|
-
|
|
572
|
+
const joint = jointNode.node;
|
|
579
573
|
if (!joint) {
|
|
580
574
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Joint named " + skins.jointNames[j] + " does not exist when looking for parent");
|
|
581
575
|
continue;
|
|
582
576
|
}
|
|
583
|
-
|
|
577
|
+
const children = joint.children;
|
|
584
578
|
if (!children) {
|
|
585
579
|
continue;
|
|
586
580
|
}
|
|
587
581
|
foundBone = false;
|
|
588
|
-
for (
|
|
582
|
+
for (let k = 0; k < children.length; k++) {
|
|
589
583
|
if (children[k] === id) {
|
|
590
584
|
parentBone = getParentBone(gltfRuntime, skins, skins.jointNames[j], newSkeleton);
|
|
591
585
|
foundBone = true;
|
|
@@ -597,7 +591,7 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton) {
|
|
|
597
591
|
}
|
|
598
592
|
}
|
|
599
593
|
// Create bone
|
|
600
|
-
|
|
594
|
+
const mat = configureBoneTransformation(node);
|
|
601
595
|
if (!parentBone && nodesToRoot.length > 0) {
|
|
602
596
|
parentBone = getNodeToRoot(nodesToRoot, id);
|
|
603
597
|
if (parentBone) {
|
|
@@ -606,18 +600,18 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton) {
|
|
|
606
600
|
}
|
|
607
601
|
}
|
|
608
602
|
}
|
|
609
|
-
|
|
603
|
+
const bone = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Bone(node.jointName || "", newSkeleton, parentBone, mat);
|
|
610
604
|
bone.id = id;
|
|
611
605
|
}
|
|
612
606
|
// Polish
|
|
613
|
-
|
|
607
|
+
const bones = newSkeleton.bones;
|
|
614
608
|
newSkeleton.bones = [];
|
|
615
|
-
for (
|
|
616
|
-
|
|
609
|
+
for (let i = 0; i < skins.jointNames.length; i++) {
|
|
610
|
+
const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);
|
|
617
611
|
if (!jointNode) {
|
|
618
612
|
continue;
|
|
619
613
|
}
|
|
620
|
-
for (
|
|
614
|
+
for (let j = 0; j < bones.length; j++) {
|
|
621
615
|
if (bones[j].id === jointNode.id) {
|
|
622
616
|
newSkeleton.bones.push(bones[j]);
|
|
623
617
|
break;
|
|
@@ -626,7 +620,7 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton) {
|
|
|
626
620
|
}
|
|
627
621
|
newSkeleton.prepare();
|
|
628
622
|
// Finish
|
|
629
|
-
for (
|
|
623
|
+
for (let i = 0; i < nodesToRootToAdd.length; i++) {
|
|
630
624
|
newSkeleton.bones.push(nodesToRootToAdd[i]);
|
|
631
625
|
}
|
|
632
626
|
return newSkeleton;
|
|
@@ -639,7 +633,7 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton) {
|
|
|
639
633
|
* @param id
|
|
640
634
|
* @param newMesh
|
|
641
635
|
*/
|
|
642
|
-
|
|
636
|
+
const importMesh = (gltfRuntime, node, meshes, id, newMesh) => {
|
|
643
637
|
if (!newMesh) {
|
|
644
638
|
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
|
645
639
|
newMesh = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh(node.name || "", gltfRuntime.scene);
|
|
@@ -650,31 +644,31 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
650
644
|
if (!node.babylonNode) {
|
|
651
645
|
return newMesh;
|
|
652
646
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
for (
|
|
660
|
-
|
|
661
|
-
|
|
647
|
+
const subMaterials = [];
|
|
648
|
+
let vertexData = null;
|
|
649
|
+
const verticesStarts = new Array();
|
|
650
|
+
const verticesCounts = new Array();
|
|
651
|
+
const indexStarts = new Array();
|
|
652
|
+
const indexCounts = new Array();
|
|
653
|
+
for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {
|
|
654
|
+
const meshId = meshes[meshIndex];
|
|
655
|
+
const mesh = gltfRuntime.meshes[meshId];
|
|
662
656
|
if (!mesh) {
|
|
663
657
|
continue;
|
|
664
658
|
}
|
|
665
659
|
// Positions, normals and UVs
|
|
666
|
-
for (
|
|
660
|
+
for (let i = 0; i < mesh.primitives.length; i++) {
|
|
667
661
|
// Temporary vertex data
|
|
668
|
-
|
|
669
|
-
|
|
662
|
+
const tempVertexData = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexData();
|
|
663
|
+
const primitive = mesh.primitives[i];
|
|
670
664
|
if (primitive.mode !== 4) {
|
|
671
665
|
// continue;
|
|
672
666
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
667
|
+
const attributes = primitive.attributes;
|
|
668
|
+
let accessor = null;
|
|
669
|
+
let buffer = null;
|
|
676
670
|
// Set positions, normal and uvs
|
|
677
|
-
for (
|
|
671
|
+
for (const semantic in attributes) {
|
|
678
672
|
// Link accessor and buffer view
|
|
679
673
|
accessor = gltfRuntime.accessors[attributes[semantic]];
|
|
680
674
|
buffer = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__.GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);
|
|
@@ -685,7 +679,7 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
685
679
|
else if (semantic === "POSITION") {
|
|
686
680
|
if (_glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__.GLTFFileLoader.HomogeneousCoordinates) {
|
|
687
681
|
tempVertexData.positions = new Float32Array(buffer.length - buffer.length / 4);
|
|
688
|
-
for (
|
|
682
|
+
for (let j = 0; j < buffer.length; j += 4) {
|
|
689
683
|
tempVertexData.positions[j] = buffer[j];
|
|
690
684
|
tempVertexData.positions[j + 1] = buffer[j + 1];
|
|
691
685
|
tempVertexData.positions[j + 2] = buffer[j + 2];
|
|
@@ -698,9 +692,9 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
698
692
|
verticesCounts.push(tempVertexData.positions.length);
|
|
699
693
|
}
|
|
700
694
|
else if (semantic.indexOf("TEXCOORD_") !== -1) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
695
|
+
const channel = Number(semantic.split("_")[1]);
|
|
696
|
+
const uvKind = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.UVKind + (channel === 0 ? "" : channel + 1);
|
|
697
|
+
const uvs = new Float32Array(buffer.length);
|
|
704
698
|
uvs.set(buffer);
|
|
705
699
|
normalizeUVs(uvs);
|
|
706
700
|
tempVertexData.set(uvs, uvKind);
|
|
@@ -728,8 +722,8 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
728
722
|
}
|
|
729
723
|
else {
|
|
730
724
|
// Set indices on the fly
|
|
731
|
-
|
|
732
|
-
for (
|
|
725
|
+
const indices = [];
|
|
726
|
+
for (let j = 0; j < tempVertexData.positions.length / 3; j++) {
|
|
733
727
|
indices.push(j);
|
|
734
728
|
}
|
|
735
729
|
tempVertexData.indices = new Int32Array(indices);
|
|
@@ -742,14 +736,14 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
742
736
|
vertexData.merge(tempVertexData);
|
|
743
737
|
}
|
|
744
738
|
// Sub material
|
|
745
|
-
|
|
746
|
-
subMaterials.push(
|
|
739
|
+
const material = gltfRuntime.scene.getMaterialById(primitive.material);
|
|
740
|
+
subMaterials.push(material === null ? _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__.GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material);
|
|
747
741
|
// Update vertices start and index start
|
|
748
742
|
verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);
|
|
749
743
|
indexStarts.push(indexStarts.length === 0 ? 0 : indexStarts[indexStarts.length - 1] + indexCounts[indexCounts.length - 2]);
|
|
750
744
|
}
|
|
751
745
|
}
|
|
752
|
-
|
|
746
|
+
let material;
|
|
753
747
|
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
|
754
748
|
if (subMaterials.length > 1) {
|
|
755
749
|
material = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.MultiMaterial("multimat" + id, gltfRuntime.scene);
|
|
@@ -771,14 +765,14 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
771
765
|
gltfRuntime.scene._blockEntityCollection = false;
|
|
772
766
|
// Apply submeshes
|
|
773
767
|
newMesh.subMeshes = [];
|
|
774
|
-
|
|
775
|
-
for (
|
|
776
|
-
|
|
777
|
-
|
|
768
|
+
let index = 0;
|
|
769
|
+
for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {
|
|
770
|
+
const meshId = meshes[meshIndex];
|
|
771
|
+
const mesh = gltfRuntime.meshes[meshId];
|
|
778
772
|
if (!mesh) {
|
|
779
773
|
continue;
|
|
780
774
|
}
|
|
781
|
-
for (
|
|
775
|
+
for (let i = 0; i < mesh.primitives.length; i++) {
|
|
782
776
|
if (mesh.primitives[i].mode !== 4) {
|
|
783
777
|
//continue;
|
|
784
778
|
}
|
|
@@ -796,7 +790,7 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
|
796
790
|
* @param rotation
|
|
797
791
|
* @param scaling
|
|
798
792
|
*/
|
|
799
|
-
|
|
793
|
+
const configureNode = (newNode, position, rotation, scaling) => {
|
|
800
794
|
if (newNode.position) {
|
|
801
795
|
newNode.position = position;
|
|
802
796
|
}
|
|
@@ -812,12 +806,12 @@ var configureNode = function (newNode, position, rotation, scaling) {
|
|
|
812
806
|
* @param newNode
|
|
813
807
|
* @param node
|
|
814
808
|
*/
|
|
815
|
-
|
|
809
|
+
const configureNodeFromMatrix = (newNode, node) => {
|
|
816
810
|
if (node.matrix) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
811
|
+
const position = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
|
|
812
|
+
const rotation = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion();
|
|
813
|
+
const scaling = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);
|
|
814
|
+
const mat = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Matrix.FromArray(node.matrix);
|
|
821
815
|
mat.decompose(scaling, rotation, position);
|
|
822
816
|
configureNode(newNode, position, rotation, scaling);
|
|
823
817
|
}
|
|
@@ -832,8 +826,8 @@ var configureNodeFromMatrix = function (newNode, node) {
|
|
|
832
826
|
* @param node
|
|
833
827
|
* @param id
|
|
834
828
|
*/
|
|
835
|
-
|
|
836
|
-
|
|
829
|
+
const importNode = (gltfRuntime, node, id) => {
|
|
830
|
+
let lastNode = null;
|
|
837
831
|
if (gltfRuntime.importOnlyMeshes && (node.skin || node.meshes)) {
|
|
838
832
|
if (gltfRuntime.importMeshesNames && gltfRuntime.importMeshesNames.length > 0 && gltfRuntime.importMeshesNames.indexOf(node.name || "") === -1) {
|
|
839
833
|
return null;
|
|
@@ -842,8 +836,8 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
842
836
|
// Meshes
|
|
843
837
|
if (node.skin) {
|
|
844
838
|
if (node.meshes) {
|
|
845
|
-
|
|
846
|
-
|
|
839
|
+
const skin = gltfRuntime.skins[node.skin];
|
|
840
|
+
const newMesh = importMesh(gltfRuntime, node, node.meshes, id, node.babylonNode);
|
|
847
841
|
newMesh.skeleton = gltfRuntime.scene.getLastSkeletonById(node.skin);
|
|
848
842
|
if (newMesh.skeleton === null) {
|
|
849
843
|
newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton);
|
|
@@ -858,16 +852,16 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
858
852
|
/**
|
|
859
853
|
* Improve meshes property
|
|
860
854
|
*/
|
|
861
|
-
|
|
855
|
+
const newMesh = importMesh(gltfRuntime, node, node.mesh ? [node.mesh] : node.meshes, id, node.babylonNode);
|
|
862
856
|
lastNode = newMesh;
|
|
863
857
|
}
|
|
864
858
|
// Lights
|
|
865
859
|
else if (node.light && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {
|
|
866
|
-
|
|
860
|
+
const light = gltfRuntime.lights[node.light];
|
|
867
861
|
if (light) {
|
|
868
862
|
if (light.type === "ambient") {
|
|
869
|
-
|
|
870
|
-
|
|
863
|
+
const ambienLight = light[light.type];
|
|
864
|
+
const hemiLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.HemisphericLight(node.light, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), gltfRuntime.scene);
|
|
871
865
|
hemiLight.name = node.name || "";
|
|
872
866
|
if (ambienLight.color) {
|
|
873
867
|
hemiLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(ambienLight.color);
|
|
@@ -875,8 +869,8 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
875
869
|
lastNode = hemiLight;
|
|
876
870
|
}
|
|
877
871
|
else if (light.type === "directional") {
|
|
878
|
-
|
|
879
|
-
|
|
872
|
+
const directionalLight = light[light.type];
|
|
873
|
+
const dirLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.DirectionalLight(node.light, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), gltfRuntime.scene);
|
|
880
874
|
dirLight.name = node.name || "";
|
|
881
875
|
if (directionalLight.color) {
|
|
882
876
|
dirLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(directionalLight.color);
|
|
@@ -884,8 +878,8 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
884
878
|
lastNode = dirLight;
|
|
885
879
|
}
|
|
886
880
|
else if (light.type === "point") {
|
|
887
|
-
|
|
888
|
-
|
|
881
|
+
const pointLight = light[light.type];
|
|
882
|
+
const ptLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointLight(node.light, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), gltfRuntime.scene);
|
|
889
883
|
ptLight.name = node.name || "";
|
|
890
884
|
if (pointLight.color) {
|
|
891
885
|
ptLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(pointLight.color);
|
|
@@ -893,8 +887,8 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
893
887
|
lastNode = ptLight;
|
|
894
888
|
}
|
|
895
889
|
else if (light.type === "spot") {
|
|
896
|
-
|
|
897
|
-
|
|
890
|
+
const spotLight = light[light.type];
|
|
891
|
+
const spLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.SpotLight(node.light, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), 0, 0, gltfRuntime.scene);
|
|
898
892
|
spLight.name = node.name || "";
|
|
899
893
|
if (spotLight.color) {
|
|
900
894
|
spLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(spotLight.color);
|
|
@@ -911,11 +905,11 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
911
905
|
}
|
|
912
906
|
// Cameras
|
|
913
907
|
else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {
|
|
914
|
-
|
|
908
|
+
const camera = gltfRuntime.cameras[node.camera];
|
|
915
909
|
if (camera) {
|
|
916
910
|
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
|
917
911
|
if (camera.type === "orthographic") {
|
|
918
|
-
|
|
912
|
+
const orthoCamera = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.FreeCamera(node.camera, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), gltfRuntime.scene, false);
|
|
919
913
|
orthoCamera.name = node.name || "";
|
|
920
914
|
orthoCamera.mode = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Camera.ORTHOGRAPHIC_CAMERA;
|
|
921
915
|
orthoCamera.attachControl();
|
|
@@ -923,8 +917,8 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
923
917
|
orthoCamera._parentContainer = gltfRuntime.assetContainer;
|
|
924
918
|
}
|
|
925
919
|
else if (camera.type === "perspective") {
|
|
926
|
-
|
|
927
|
-
|
|
920
|
+
const perspectiveCamera = camera[camera.type];
|
|
921
|
+
const persCamera = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.FreeCamera(node.camera, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.Zero(), gltfRuntime.scene, false);
|
|
928
922
|
persCamera.name = node.name || "";
|
|
929
923
|
persCamera.attachControl();
|
|
930
924
|
if (!perspectiveCamera.aspectRatio) {
|
|
@@ -947,7 +941,7 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
947
941
|
}
|
|
948
942
|
else if (lastNode === null) {
|
|
949
943
|
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
|
950
|
-
|
|
944
|
+
const dummy = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh(node.name || "", gltfRuntime.scene);
|
|
951
945
|
dummy._parentContainer = gltfRuntime.assetContainer;
|
|
952
946
|
gltfRuntime.scene._blockEntityCollection = false;
|
|
953
947
|
node.babylonNode = dummy;
|
|
@@ -959,9 +953,9 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
959
953
|
configureNodeFromMatrix(lastNode, node);
|
|
960
954
|
}
|
|
961
955
|
else {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
956
|
+
const translation = node.translation || [0, 0, 0];
|
|
957
|
+
const rotation = node.rotation || [0, 0, 0, 1];
|
|
958
|
+
const scale = node.scale || [1, 1, 1];
|
|
965
959
|
configureNode(lastNode, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(translation), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray(rotation), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(scale));
|
|
966
960
|
}
|
|
967
961
|
lastNode.updateCache(true);
|
|
@@ -976,10 +970,9 @@ var importNode = function (gltfRuntime, node, id) {
|
|
|
976
970
|
* @param parent
|
|
977
971
|
* @param meshIncluded
|
|
978
972
|
*/
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
var newNode = null;
|
|
973
|
+
const traverseNodes = (gltfRuntime, id, parent, meshIncluded = false) => {
|
|
974
|
+
const node = gltfRuntime.nodes[id];
|
|
975
|
+
let newNode = null;
|
|
983
976
|
if (gltfRuntime.importOnlyMeshes && !meshIncluded && gltfRuntime.importMeshesNames) {
|
|
984
977
|
if (gltfRuntime.importMeshesNames.indexOf(node.name || "") !== -1 || gltfRuntime.importMeshesNames.length === 0) {
|
|
985
978
|
meshIncluded = true;
|
|
@@ -999,7 +992,7 @@ var traverseNodes = function (gltfRuntime, id, parent, meshIncluded) {
|
|
|
999
992
|
}
|
|
1000
993
|
}
|
|
1001
994
|
if (node.children) {
|
|
1002
|
-
for (
|
|
995
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
1003
996
|
traverseNodes(gltfRuntime, node.children[i], newNode, meshIncluded);
|
|
1004
997
|
}
|
|
1005
998
|
}
|
|
@@ -1008,26 +1001,26 @@ var traverseNodes = function (gltfRuntime, id, parent, meshIncluded) {
|
|
|
1008
1001
|
* do stuff after buffers, shaders are loaded (e.g. hook up materials, load animations, etc.)
|
|
1009
1002
|
* @param gltfRuntime
|
|
1010
1003
|
*/
|
|
1011
|
-
|
|
1004
|
+
const postLoad = (gltfRuntime) => {
|
|
1012
1005
|
// Nodes
|
|
1013
|
-
|
|
1006
|
+
let currentScene = gltfRuntime.currentScene;
|
|
1014
1007
|
if (currentScene) {
|
|
1015
|
-
for (
|
|
1008
|
+
for (let i = 0; i < currentScene.nodes.length; i++) {
|
|
1016
1009
|
traverseNodes(gltfRuntime, currentScene.nodes[i], null);
|
|
1017
1010
|
}
|
|
1018
1011
|
}
|
|
1019
1012
|
else {
|
|
1020
|
-
for (
|
|
1013
|
+
for (const thing in gltfRuntime.scenes) {
|
|
1021
1014
|
currentScene = gltfRuntime.scenes[thing];
|
|
1022
|
-
for (
|
|
1015
|
+
for (let i = 0; i < currentScene.nodes.length; i++) {
|
|
1023
1016
|
traverseNodes(gltfRuntime, currentScene.nodes[i], null);
|
|
1024
1017
|
}
|
|
1025
1018
|
}
|
|
1026
1019
|
}
|
|
1027
1020
|
// Set animations
|
|
1028
1021
|
loadAnimations(gltfRuntime);
|
|
1029
|
-
for (
|
|
1030
|
-
|
|
1022
|
+
for (let i = 0; i < gltfRuntime.scene.skeletons.length; i++) {
|
|
1023
|
+
const skeleton = gltfRuntime.scene.skeletons[i];
|
|
1031
1024
|
gltfRuntime.scene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);
|
|
1032
1025
|
}
|
|
1033
1026
|
};
|
|
@@ -1041,17 +1034,17 @@ var postLoad = function (gltfRuntime) {
|
|
|
1041
1034
|
* @param material
|
|
1042
1035
|
* @param onSuccess
|
|
1043
1036
|
*/
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
for (
|
|
1047
|
-
|
|
1048
|
-
|
|
1037
|
+
const onBindShaderMaterial = (mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess) => {
|
|
1038
|
+
const materialValues = material.values || technique.parameters;
|
|
1039
|
+
for (const unif in unTreatedUniforms) {
|
|
1040
|
+
const uniform = unTreatedUniforms[unif];
|
|
1041
|
+
const type = uniform.type;
|
|
1049
1042
|
if (type === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EParameterType.FLOAT_MAT2 || type === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EParameterType.FLOAT_MAT3 || type === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EParameterType.FLOAT_MAT4) {
|
|
1050
1043
|
if (uniform.semantic && !uniform.source && !uniform.node) {
|
|
1051
1044
|
_glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__.GLTFUtils.SetMatrix(gltfRuntime.scene, mesh, uniform, unif, shaderMaterial.getEffect());
|
|
1052
1045
|
}
|
|
1053
1046
|
else if (uniform.semantic && (uniform.source || uniform.node)) {
|
|
1054
|
-
|
|
1047
|
+
let source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || "");
|
|
1055
1048
|
if (source === null) {
|
|
1056
1049
|
source = gltfRuntime.scene.getNodeById(uniform.source || uniform.node || "");
|
|
1057
1050
|
}
|
|
@@ -1062,12 +1055,12 @@ var onBindShaderMaterial = function (mesh, gltfRuntime, unTreatedUniforms, shade
|
|
|
1062
1055
|
}
|
|
1063
1056
|
}
|
|
1064
1057
|
else {
|
|
1065
|
-
|
|
1058
|
+
const value = materialValues[technique.uniforms[unif]];
|
|
1066
1059
|
if (!value) {
|
|
1067
1060
|
continue;
|
|
1068
1061
|
}
|
|
1069
1062
|
if (type === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EParameterType.SAMPLER_2D) {
|
|
1070
|
-
|
|
1063
|
+
const texture = gltfRuntime.textures[material.values ? value : uniform.value].babylonTexture;
|
|
1071
1064
|
if (texture === null || texture === undefined) {
|
|
1072
1065
|
continue;
|
|
1073
1066
|
}
|
|
@@ -1088,22 +1081,25 @@ var onBindShaderMaterial = function (mesh, gltfRuntime, unTreatedUniforms, shade
|
|
|
1088
1081
|
* @param technique
|
|
1089
1082
|
* @param material
|
|
1090
1083
|
*/
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1084
|
+
const prepareShaderMaterialUniforms = (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms) => {
|
|
1085
|
+
const materialValues = material.values || technique.parameters;
|
|
1086
|
+
const techniqueUniforms = technique.uniforms;
|
|
1087
|
+
/**
|
|
1088
|
+
* Prepare values here (not matrices)
|
|
1089
|
+
*/
|
|
1090
|
+
for (const unif in unTreatedUniforms) {
|
|
1091
|
+
const uniform = unTreatedUniforms[unif];
|
|
1092
|
+
const type = uniform.type;
|
|
1093
|
+
let value = materialValues[techniqueUniforms[unif]];
|
|
1098
1094
|
if (value === undefined) {
|
|
1099
1095
|
// In case the value is the same for all materials
|
|
1100
1096
|
value = uniform.value;
|
|
1101
1097
|
}
|
|
1102
1098
|
if (!value) {
|
|
1103
|
-
|
|
1099
|
+
continue;
|
|
1104
1100
|
}
|
|
1105
|
-
|
|
1106
|
-
return
|
|
1101
|
+
const onLoadTexture = (uniformName) => {
|
|
1102
|
+
return (texture) => {
|
|
1107
1103
|
if (uniform.value && uniformName) {
|
|
1108
1104
|
// Static uniform
|
|
1109
1105
|
shaderMaterial.setTexture(uniformName, texture);
|
|
@@ -1113,7 +1109,7 @@ var prepareShaderMaterialUniforms = function (gltfRuntime, shaderMaterial, techn
|
|
|
1113
1109
|
};
|
|
1114
1110
|
// Texture (sampler2D)
|
|
1115
1111
|
if (type === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EParameterType.SAMPLER_2D) {
|
|
1116
|
-
GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif),
|
|
1112
|
+
GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif), () => onLoadTexture(null));
|
|
1117
1113
|
}
|
|
1118
1114
|
// Others
|
|
1119
1115
|
else {
|
|
@@ -1122,12 +1118,6 @@ var prepareShaderMaterialUniforms = function (gltfRuntime, shaderMaterial, techn
|
|
|
1122
1118
|
delete unTreatedUniforms[unif];
|
|
1123
1119
|
}
|
|
1124
1120
|
}
|
|
1125
|
-
};
|
|
1126
|
-
/**
|
|
1127
|
-
* Prepare values here (not matrices)
|
|
1128
|
-
*/
|
|
1129
|
-
for (var unif in unTreatedUniforms) {
|
|
1130
|
-
_loop_1(unif);
|
|
1131
1121
|
}
|
|
1132
1122
|
};
|
|
1133
1123
|
/**
|
|
@@ -1136,8 +1126,8 @@ var prepareShaderMaterialUniforms = function (gltfRuntime, shaderMaterial, techn
|
|
|
1136
1126
|
* @param shaderMaterial
|
|
1137
1127
|
* @param onError
|
|
1138
1128
|
*/
|
|
1139
|
-
|
|
1140
|
-
return
|
|
1129
|
+
const onShaderCompileError = (program, shaderMaterial, onError) => {
|
|
1130
|
+
return (effect, error) => {
|
|
1141
1131
|
shaderMaterial.dispose(true);
|
|
1142
1132
|
onError("Cannot compile program named " + program.name + ". Error: " + error + ". Default material will be applied");
|
|
1143
1133
|
};
|
|
@@ -1151,10 +1141,10 @@ var onShaderCompileError = function (program, shaderMaterial, onError) {
|
|
|
1151
1141
|
* @param unTreatedUniforms
|
|
1152
1142
|
* @param onSuccess
|
|
1153
1143
|
*/
|
|
1154
|
-
|
|
1155
|
-
return
|
|
1144
|
+
const onShaderCompileSuccess = (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess) => {
|
|
1145
|
+
return (_) => {
|
|
1156
1146
|
prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);
|
|
1157
|
-
shaderMaterial.onBind =
|
|
1147
|
+
shaderMaterial.onBind = (mesh) => {
|
|
1158
1148
|
onBindShaderMaterial(mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess);
|
|
1159
1149
|
};
|
|
1160
1150
|
};
|
|
@@ -1164,13 +1154,13 @@ var onShaderCompileSuccess = function (gltfRuntime, shaderMaterial, technique, m
|
|
|
1164
1154
|
* @param tokenizer
|
|
1165
1155
|
* @param technique
|
|
1166
1156
|
*/
|
|
1167
|
-
|
|
1168
|
-
for (
|
|
1169
|
-
|
|
1170
|
-
|
|
1157
|
+
const parseShaderUniforms = (tokenizer, technique, unTreatedUniforms) => {
|
|
1158
|
+
for (const unif in technique.uniforms) {
|
|
1159
|
+
const uniform = technique.uniforms[unif];
|
|
1160
|
+
const uniformParameter = technique.parameters[uniform];
|
|
1171
1161
|
if (tokenizer.currentIdentifier === unif) {
|
|
1172
1162
|
if (uniformParameter.semantic && !uniformParameter.source && !uniformParameter.node) {
|
|
1173
|
-
|
|
1163
|
+
const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);
|
|
1174
1164
|
if (transformIndex !== -1) {
|
|
1175
1165
|
delete unTreatedUniforms[unif];
|
|
1176
1166
|
return babylonTransforms[transformIndex];
|
|
@@ -1184,21 +1174,19 @@ var parseShaderUniforms = function (tokenizer, technique, unTreatedUniforms) {
|
|
|
1184
1174
|
* All shaders loaded. Create materials one by one
|
|
1185
1175
|
* @param gltfRuntime
|
|
1186
1176
|
*/
|
|
1187
|
-
|
|
1177
|
+
const importMaterials = (gltfRuntime) => {
|
|
1188
1178
|
// Create materials
|
|
1189
|
-
for (
|
|
1190
|
-
GLTFLoaderExtension.LoadMaterialAsync(gltfRuntime, mat,
|
|
1179
|
+
for (const mat in gltfRuntime.materials) {
|
|
1180
|
+
GLTFLoaderExtension.LoadMaterialAsync(gltfRuntime, mat, () => { }, () => { });
|
|
1191
1181
|
}
|
|
1192
1182
|
};
|
|
1193
1183
|
/**
|
|
1194
1184
|
* Implementation of the base glTF spec
|
|
1195
1185
|
* @internal
|
|
1196
1186
|
*/
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
GLTFLoaderBase.CreateRuntime = function (parsedData, scene, rootUrl) {
|
|
1201
|
-
var gltfRuntime = {
|
|
1187
|
+
class GLTFLoaderBase {
|
|
1188
|
+
static CreateRuntime(parsedData, scene, rootUrl) {
|
|
1189
|
+
const gltfRuntime = {
|
|
1202
1190
|
extensions: {},
|
|
1203
1191
|
accessors: {},
|
|
1204
1192
|
buffers: {},
|
|
@@ -1291,22 +1279,22 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1291
1279
|
gltfRuntime.currentScene = parsedData.scenes[parsedData.scene];
|
|
1292
1280
|
}
|
|
1293
1281
|
return gltfRuntime;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1282
|
+
}
|
|
1283
|
+
static LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress) {
|
|
1284
|
+
const buffer = gltfRuntime.buffers[id];
|
|
1297
1285
|
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.IsBase64(buffer.uri)) {
|
|
1298
|
-
setTimeout(
|
|
1286
|
+
setTimeout(() => onSuccess(new Uint8Array(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.DecodeBase64(buffer.uri))));
|
|
1299
1287
|
}
|
|
1300
1288
|
else {
|
|
1301
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.LoadFile(gltfRuntime.rootUrl + buffer.uri,
|
|
1289
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.LoadFile(gltfRuntime.rootUrl + buffer.uri, (data) => onSuccess(new Uint8Array(data)), onProgress, undefined, true, (request) => {
|
|
1302
1290
|
if (request) {
|
|
1303
1291
|
onError(request.status + " " + request.statusText);
|
|
1304
1292
|
}
|
|
1305
1293
|
});
|
|
1306
1294
|
}
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1295
|
+
}
|
|
1296
|
+
static LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1297
|
+
const texture = gltfRuntime.textures[id];
|
|
1310
1298
|
if (!texture || !texture.source) {
|
|
1311
1299
|
onError("");
|
|
1312
1300
|
return;
|
|
@@ -1315,34 +1303,34 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1315
1303
|
onSuccess(null);
|
|
1316
1304
|
return;
|
|
1317
1305
|
}
|
|
1318
|
-
|
|
1306
|
+
const source = gltfRuntime.images[texture.source];
|
|
1319
1307
|
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.IsBase64(source.uri)) {
|
|
1320
|
-
setTimeout(
|
|
1308
|
+
setTimeout(() => onSuccess(new Uint8Array(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.DecodeBase64(source.uri))));
|
|
1321
1309
|
}
|
|
1322
1310
|
else {
|
|
1323
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.LoadFile(gltfRuntime.rootUrl + source.uri,
|
|
1311
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.LoadFile(gltfRuntime.rootUrl + source.uri, (data) => onSuccess(new Uint8Array(data)), undefined, undefined, true, (request) => {
|
|
1324
1312
|
if (request) {
|
|
1325
1313
|
onError(request.status + " " + request.statusText);
|
|
1326
1314
|
}
|
|
1327
1315
|
});
|
|
1328
1316
|
}
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1317
|
+
}
|
|
1318
|
+
static CreateTextureAsync(gltfRuntime, id, buffer, onSuccess) {
|
|
1319
|
+
const texture = gltfRuntime.textures[id];
|
|
1332
1320
|
if (texture.babylonTexture) {
|
|
1333
1321
|
onSuccess(texture.babylonTexture);
|
|
1334
1322
|
return;
|
|
1335
1323
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1324
|
+
const sampler = gltfRuntime.samplers[texture.sampler];
|
|
1325
|
+
const createMipMaps = sampler.minFilter === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureFilterType.NEAREST_MIPMAP_NEAREST ||
|
|
1338
1326
|
sampler.minFilter === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureFilterType.NEAREST_MIPMAP_LINEAR ||
|
|
1339
1327
|
sampler.minFilter === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureFilterType.LINEAR_MIPMAP_NEAREST ||
|
|
1340
1328
|
sampler.minFilter === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureFilterType.LINEAR_MIPMAP_LINEAR;
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1329
|
+
const samplingMode = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Texture.BILINEAR_SAMPLINGMODE;
|
|
1330
|
+
const blob = buffer == null ? new Blob() : new Blob([buffer]);
|
|
1331
|
+
const blobURL = URL.createObjectURL(blob);
|
|
1332
|
+
const revokeBlobURL = () => URL.revokeObjectURL(blobURL);
|
|
1333
|
+
const newTexture = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);
|
|
1346
1334
|
if (sampler.wrapS !== undefined) {
|
|
1347
1335
|
newTexture.wrapU = _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_2__.GLTFUtils.GetWrapMode(sampler.wrapS);
|
|
1348
1336
|
}
|
|
@@ -1352,35 +1340,35 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1352
1340
|
newTexture.name = id;
|
|
1353
1341
|
texture.babylonTexture = newTexture;
|
|
1354
1342
|
onSuccess(newTexture);
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1343
|
+
}
|
|
1344
|
+
static LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1345
|
+
const shader = gltfRuntime.shaders[id];
|
|
1358
1346
|
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.IsBase64(shader.uri)) {
|
|
1359
|
-
|
|
1347
|
+
const shaderString = atob(shader.uri.split(",")[1]);
|
|
1360
1348
|
if (onSuccess) {
|
|
1361
1349
|
onSuccess(shaderString);
|
|
1362
1350
|
}
|
|
1363
1351
|
}
|
|
1364
1352
|
else {
|
|
1365
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false,
|
|
1353
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, (request) => {
|
|
1366
1354
|
if (request && onError) {
|
|
1367
1355
|
onError(request.status + " " + request.statusText);
|
|
1368
1356
|
}
|
|
1369
1357
|
});
|
|
1370
1358
|
}
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
|
|
1359
|
+
}
|
|
1360
|
+
static LoadMaterialAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1361
|
+
const material = gltfRuntime.materials[id];
|
|
1374
1362
|
if (!material.technique) {
|
|
1375
1363
|
if (onError) {
|
|
1376
1364
|
onError("No technique found.");
|
|
1377
1365
|
}
|
|
1378
1366
|
return;
|
|
1379
1367
|
}
|
|
1380
|
-
|
|
1368
|
+
const technique = gltfRuntime.techniques[material.technique];
|
|
1381
1369
|
if (!technique) {
|
|
1382
1370
|
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
|
1383
|
-
|
|
1371
|
+
const defaultMaterial = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.StandardMaterial(id, gltfRuntime.scene);
|
|
1384
1372
|
defaultMaterial._parentContainer = gltfRuntime.assetContainer;
|
|
1385
1373
|
gltfRuntime.scene._blockEntityCollection = false;
|
|
1386
1374
|
defaultMaterial.diffuseColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3(0.5, 0.5, 0.5);
|
|
@@ -1388,25 +1376,25 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1388
1376
|
onSuccess(defaultMaterial);
|
|
1389
1377
|
return;
|
|
1390
1378
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1379
|
+
const program = gltfRuntime.programs[technique.program];
|
|
1380
|
+
const states = technique.states;
|
|
1381
|
+
const vertexShader = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Effect.ShadersStore[program.vertexShader + "VertexShader"];
|
|
1382
|
+
const pixelShader = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Effect.ShadersStore[program.fragmentShader + "PixelShader"];
|
|
1383
|
+
let newVertexShader = "";
|
|
1384
|
+
let newPixelShader = "";
|
|
1385
|
+
const vertexTokenizer = new Tokenizer(vertexShader);
|
|
1386
|
+
const pixelTokenizer = new Tokenizer(pixelShader);
|
|
1387
|
+
const unTreatedUniforms = {};
|
|
1388
|
+
const uniforms = [];
|
|
1389
|
+
const attributes = [];
|
|
1390
|
+
const samplers = [];
|
|
1403
1391
|
// Fill uniform, sampler2D and attributes
|
|
1404
|
-
for (
|
|
1405
|
-
|
|
1406
|
-
|
|
1392
|
+
for (const unif in technique.uniforms) {
|
|
1393
|
+
const uniform = technique.uniforms[unif];
|
|
1394
|
+
const uniformParameter = technique.parameters[uniform];
|
|
1407
1395
|
unTreatedUniforms[unif] = uniformParameter;
|
|
1408
1396
|
if (uniformParameter.semantic && !uniformParameter.node && !uniformParameter.source) {
|
|
1409
|
-
|
|
1397
|
+
const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);
|
|
1410
1398
|
if (transformIndex !== -1) {
|
|
1411
1399
|
uniforms.push(babylonTransforms[transformIndex]);
|
|
1412
1400
|
delete unTreatedUniforms[unif];
|
|
@@ -1422,27 +1410,27 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1422
1410
|
uniforms.push(unif);
|
|
1423
1411
|
}
|
|
1424
1412
|
}
|
|
1425
|
-
for (
|
|
1426
|
-
|
|
1427
|
-
|
|
1413
|
+
for (const attr in technique.attributes) {
|
|
1414
|
+
const attribute = technique.attributes[attr];
|
|
1415
|
+
const attributeParameter = technique.parameters[attribute];
|
|
1428
1416
|
if (attributeParameter.semantic) {
|
|
1429
|
-
|
|
1430
|
-
if (
|
|
1431
|
-
attributes.push(
|
|
1417
|
+
const name = getAttribute(attributeParameter);
|
|
1418
|
+
if (name) {
|
|
1419
|
+
attributes.push(name);
|
|
1432
1420
|
}
|
|
1433
1421
|
}
|
|
1434
1422
|
}
|
|
1435
1423
|
// Configure vertex shader
|
|
1436
1424
|
while (!vertexTokenizer.isEnd() && vertexTokenizer.getNextToken()) {
|
|
1437
|
-
|
|
1425
|
+
const tokenType = vertexTokenizer.currentToken;
|
|
1438
1426
|
if (tokenType !== ETokenType.IDENTIFIER) {
|
|
1439
1427
|
newVertexShader += vertexTokenizer.currentString;
|
|
1440
1428
|
continue;
|
|
1441
1429
|
}
|
|
1442
|
-
|
|
1443
|
-
for (
|
|
1444
|
-
|
|
1445
|
-
|
|
1430
|
+
let foundAttribute = false;
|
|
1431
|
+
for (const attr in technique.attributes) {
|
|
1432
|
+
const attribute = technique.attributes[attr];
|
|
1433
|
+
const attributeParameter = technique.parameters[attribute];
|
|
1446
1434
|
if (vertexTokenizer.currentIdentifier === attr && attributeParameter.semantic) {
|
|
1447
1435
|
newVertexShader += getAttribute(attributeParameter);
|
|
1448
1436
|
foundAttribute = true;
|
|
@@ -1456,7 +1444,7 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1456
1444
|
}
|
|
1457
1445
|
// Configure pixel shader
|
|
1458
1446
|
while (!pixelTokenizer.isEnd() && pixelTokenizer.getNextToken()) {
|
|
1459
|
-
|
|
1447
|
+
const tokenType = pixelTokenizer.currentToken;
|
|
1460
1448
|
if (tokenType !== ETokenType.IDENTIFIER) {
|
|
1461
1449
|
newPixelShader += pixelTokenizer.currentString;
|
|
1462
1450
|
continue;
|
|
@@ -1464,11 +1452,11 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1464
1452
|
newPixelShader += parseShaderUniforms(pixelTokenizer, technique, unTreatedUniforms);
|
|
1465
1453
|
}
|
|
1466
1454
|
// Create shader material
|
|
1467
|
-
|
|
1455
|
+
const shaderPath = {
|
|
1468
1456
|
vertex: program.vertexShader + id,
|
|
1469
1457
|
fragment: program.fragmentShader + id,
|
|
1470
1458
|
};
|
|
1471
|
-
|
|
1459
|
+
const options = {
|
|
1472
1460
|
attributes: attributes,
|
|
1473
1461
|
uniforms: uniforms,
|
|
1474
1462
|
samplers: samplers,
|
|
@@ -1476,16 +1464,16 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1476
1464
|
};
|
|
1477
1465
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Effect.ShadersStore[program.vertexShader + id + "VertexShader"] = newVertexShader;
|
|
1478
1466
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Effect.ShadersStore[program.fragmentShader + id + "PixelShader"] = newPixelShader;
|
|
1479
|
-
|
|
1467
|
+
const shaderMaterial = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial(id, gltfRuntime.scene, shaderPath, options);
|
|
1480
1468
|
shaderMaterial.onError = onShaderCompileError(program, shaderMaterial, onError);
|
|
1481
1469
|
shaderMaterial.onCompiled = onShaderCompileSuccess(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess);
|
|
1482
1470
|
shaderMaterial.sideOrientation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.CounterClockWiseSideOrientation;
|
|
1483
1471
|
if (states && states.functions) {
|
|
1484
|
-
|
|
1472
|
+
const functions = states.functions;
|
|
1485
1473
|
if (functions.cullFace && functions.cullFace[0] !== _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ECullingType.BACK) {
|
|
1486
1474
|
shaderMaterial.backFaceCulling = false;
|
|
1487
1475
|
}
|
|
1488
|
-
|
|
1476
|
+
const blendFunc = functions.blendFuncSeparate;
|
|
1489
1477
|
if (blendFunc) {
|
|
1490
1478
|
if (blendFunc[0] === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EBlendingFunction.SRC_ALPHA &&
|
|
1491
1479
|
blendFunc[1] === _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EBlendingFunction.ONE_MINUS_SRC_ALPHA &&
|
|
@@ -1525,32 +1513,27 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
|
1525
1513
|
}
|
|
1526
1514
|
}
|
|
1527
1515
|
}
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
}());
|
|
1531
|
-
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1532
1518
|
/**
|
|
1533
1519
|
* glTF V1 Loader
|
|
1534
1520
|
* @internal
|
|
1535
1521
|
* @deprecated
|
|
1536
1522
|
*/
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
GLTFLoader.RegisterExtension = function (extension) {
|
|
1523
|
+
class GLTFLoader {
|
|
1524
|
+
static RegisterExtension(extension) {
|
|
1541
1525
|
if (GLTFLoader.Extensions[extension.name]) {
|
|
1542
1526
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error('Tool with the same name "' + extension.name + '" already exists');
|
|
1543
1527
|
return;
|
|
1544
1528
|
}
|
|
1545
1529
|
GLTFLoader.Extensions[extension.name] = extension;
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1530
|
+
}
|
|
1531
|
+
dispose() {
|
|
1548
1532
|
// do nothing
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
var _this = this;
|
|
1533
|
+
}
|
|
1534
|
+
_importMeshAsync(meshesNames, scene, data, rootUrl, assetContainer, onSuccess, onProgress, onError) {
|
|
1552
1535
|
scene.useRightHandedSystem = true;
|
|
1553
|
-
GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl,
|
|
1536
|
+
GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, (gltfRuntime) => {
|
|
1554
1537
|
gltfRuntime.assetContainer = assetContainer;
|
|
1555
1538
|
gltfRuntime.importOnlyMeshes = true;
|
|
1556
1539
|
if (meshesNames === "") {
|
|
@@ -1567,25 +1550,25 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1567
1550
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Warn("Argument meshesNames must be of type string or string[]");
|
|
1568
1551
|
}
|
|
1569
1552
|
// Create nodes
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1553
|
+
this._createNodes(gltfRuntime);
|
|
1554
|
+
const meshes = new Array();
|
|
1555
|
+
const skeletons = new Array();
|
|
1573
1556
|
// Fill arrays of meshes and skeletons
|
|
1574
|
-
for (
|
|
1575
|
-
|
|
1557
|
+
for (const nde in gltfRuntime.nodes) {
|
|
1558
|
+
const node = gltfRuntime.nodes[nde];
|
|
1576
1559
|
if (node.babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.AbstractMesh) {
|
|
1577
1560
|
meshes.push(node.babylonNode);
|
|
1578
1561
|
}
|
|
1579
1562
|
}
|
|
1580
|
-
for (
|
|
1581
|
-
|
|
1563
|
+
for (const skl in gltfRuntime.skins) {
|
|
1564
|
+
const skin = gltfRuntime.skins[skl];
|
|
1582
1565
|
if (skin.babylonSkeleton instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Skeleton) {
|
|
1583
1566
|
skeletons.push(skin.babylonSkeleton);
|
|
1584
1567
|
}
|
|
1585
1568
|
}
|
|
1586
1569
|
// Load buffers, shaders, materials, etc.
|
|
1587
|
-
|
|
1588
|
-
|
|
1570
|
+
this._loadBuffersAsync(gltfRuntime, () => {
|
|
1571
|
+
this._loadShadersAsync(gltfRuntime, () => {
|
|
1589
1572
|
importMaterials(gltfRuntime);
|
|
1590
1573
|
postLoad(gltfRuntime);
|
|
1591
1574
|
if (!_glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__.GLTFFileLoader.IncrementalLoading && onSuccess) {
|
|
@@ -1598,7 +1581,7 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1598
1581
|
}
|
|
1599
1582
|
}, onError);
|
|
1600
1583
|
return true;
|
|
1601
|
-
}
|
|
1584
|
+
}
|
|
1602
1585
|
/**
|
|
1603
1586
|
* Imports one or more meshes from a loaded gltf file and adds them to the scene
|
|
1604
1587
|
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
|
@@ -1609,10 +1592,9 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1609
1592
|
* @param onProgress event that fires when loading progress has occured
|
|
1610
1593
|
* @returns a promise containg the loaded meshes, particles, skeletons and animations
|
|
1611
1594
|
*/
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
_this._importMeshAsync(meshesNames, scene, data, rootUrl, assetContainer, function (meshes, skeletons) {
|
|
1595
|
+
importMeshAsync(meshesNames, scene, assetContainer, data, rootUrl, onProgress) {
|
|
1596
|
+
return new Promise((resolve, reject) => {
|
|
1597
|
+
this._importMeshAsync(meshesNames, scene, data, rootUrl, assetContainer, (meshes, skeletons) => {
|
|
1616
1598
|
resolve({
|
|
1617
1599
|
meshes: meshes,
|
|
1618
1600
|
particleSystems: [],
|
|
@@ -1622,22 +1604,21 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1622
1604
|
transformNodes: [],
|
|
1623
1605
|
geometries: [],
|
|
1624
1606
|
});
|
|
1625
|
-
}, onProgress,
|
|
1607
|
+
}, onProgress, (message) => {
|
|
1626
1608
|
reject(new Error(message));
|
|
1627
1609
|
});
|
|
1628
1610
|
});
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
var _this = this;
|
|
1611
|
+
}
|
|
1612
|
+
_loadAsync(scene, data, rootUrl, onSuccess, onProgress, onError) {
|
|
1632
1613
|
scene.useRightHandedSystem = true;
|
|
1633
|
-
GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl,
|
|
1614
|
+
GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, (gltfRuntime) => {
|
|
1634
1615
|
// Load runtime extensios
|
|
1635
|
-
GLTFLoaderExtension.LoadRuntimeExtensionsAsync(gltfRuntime,
|
|
1616
|
+
GLTFLoaderExtension.LoadRuntimeExtensionsAsync(gltfRuntime, () => {
|
|
1636
1617
|
// Create nodes
|
|
1637
|
-
|
|
1618
|
+
this._createNodes(gltfRuntime);
|
|
1638
1619
|
// Load buffers, shaders, materials, etc.
|
|
1639
|
-
|
|
1640
|
-
|
|
1620
|
+
this._loadBuffersAsync(gltfRuntime, () => {
|
|
1621
|
+
this._loadShadersAsync(gltfRuntime, () => {
|
|
1641
1622
|
importMaterials(gltfRuntime);
|
|
1642
1623
|
postLoad(gltfRuntime);
|
|
1643
1624
|
if (!_glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__.GLTFFileLoader.IncrementalLoading) {
|
|
@@ -1650,7 +1631,7 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1650
1631
|
}
|
|
1651
1632
|
}, onError);
|
|
1652
1633
|
}, onError);
|
|
1653
|
-
}
|
|
1634
|
+
}
|
|
1654
1635
|
/**
|
|
1655
1636
|
* Imports all objects from a loaded gltf file and adds them to the scene
|
|
1656
1637
|
* @param scene the scene the objects should be added to
|
|
@@ -1659,20 +1640,19 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1659
1640
|
* @param onProgress event that fires when loading progress has occured
|
|
1660
1641
|
* @returns a promise which completes when objects have been loaded to the scene
|
|
1661
1642
|
*/
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
_this._loadAsync(scene, data, rootUrl, function () {
|
|
1643
|
+
loadAsync(scene, data, rootUrl, onProgress) {
|
|
1644
|
+
return new Promise((resolve, reject) => {
|
|
1645
|
+
this._loadAsync(scene, data, rootUrl, () => {
|
|
1666
1646
|
resolve();
|
|
1667
|
-
}, onProgress,
|
|
1647
|
+
}, onProgress, (message) => {
|
|
1668
1648
|
reject(new Error(message));
|
|
1669
1649
|
});
|
|
1670
1650
|
});
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
GLTFLoaderExtension.LoadShaderStringAsync(gltfRuntime, sha,
|
|
1651
|
+
}
|
|
1652
|
+
_loadShadersAsync(gltfRuntime, onload) {
|
|
1653
|
+
let hasShaders = false;
|
|
1654
|
+
const processShader = (sha, shader) => {
|
|
1655
|
+
GLTFLoaderExtension.LoadShaderStringAsync(gltfRuntime, sha, (shaderString) => {
|
|
1676
1656
|
if (shaderString instanceof ArrayBuffer) {
|
|
1677
1657
|
return;
|
|
1678
1658
|
}
|
|
@@ -1683,13 +1663,13 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1683
1663
|
if (gltfRuntime.loadedShaderCount === gltfRuntime.shaderscount) {
|
|
1684
1664
|
onload();
|
|
1685
1665
|
}
|
|
1686
|
-
},
|
|
1666
|
+
}, () => {
|
|
1687
1667
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Error when loading shader program named " + sha + " located at " + shader.uri);
|
|
1688
1668
|
});
|
|
1689
1669
|
};
|
|
1690
|
-
for (
|
|
1670
|
+
for (const sha in gltfRuntime.shaders) {
|
|
1691
1671
|
hasShaders = true;
|
|
1692
|
-
|
|
1672
|
+
const shader = gltfRuntime.shaders[sha];
|
|
1693
1673
|
if (shader) {
|
|
1694
1674
|
processShader.bind(this, sha, shader)();
|
|
1695
1675
|
}
|
|
@@ -1700,11 +1680,11 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1700
1680
|
if (!hasShaders) {
|
|
1701
1681
|
onload();
|
|
1702
1682
|
}
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
GLTFLoaderExtension.LoadBufferAsync(gltfRuntime, buf,
|
|
1683
|
+
}
|
|
1684
|
+
_loadBuffersAsync(gltfRuntime, onLoad) {
|
|
1685
|
+
let hasBuffers = false;
|
|
1686
|
+
const processBuffer = (buf, buffer) => {
|
|
1687
|
+
GLTFLoaderExtension.LoadBufferAsync(gltfRuntime, buf, (bufferView) => {
|
|
1708
1688
|
gltfRuntime.loadedBufferCount++;
|
|
1709
1689
|
if (bufferView) {
|
|
1710
1690
|
if (bufferView.byteLength != gltfRuntime.buffers[buf].byteLength) {
|
|
@@ -1715,13 +1695,13 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1715
1695
|
if (gltfRuntime.loadedBufferCount === gltfRuntime.buffersCount) {
|
|
1716
1696
|
onLoad();
|
|
1717
1697
|
}
|
|
1718
|
-
},
|
|
1698
|
+
}, () => {
|
|
1719
1699
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Error when loading buffer named " + buf + " located at " + buffer.uri);
|
|
1720
1700
|
});
|
|
1721
1701
|
};
|
|
1722
|
-
for (
|
|
1702
|
+
for (const buf in gltfRuntime.buffers) {
|
|
1723
1703
|
hasBuffers = true;
|
|
1724
|
-
|
|
1704
|
+
const buffer = gltfRuntime.buffers[buf];
|
|
1725
1705
|
if (buffer) {
|
|
1726
1706
|
processBuffer.bind(this, buf, buffer)();
|
|
1727
1707
|
}
|
|
@@ -1732,40 +1712,35 @@ var GLTFLoader = /** @class */ (function () {
|
|
|
1732
1712
|
if (!hasBuffers) {
|
|
1733
1713
|
onLoad();
|
|
1734
1714
|
}
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1715
|
+
}
|
|
1716
|
+
_createNodes(gltfRuntime) {
|
|
1717
|
+
let currentScene = gltfRuntime.currentScene;
|
|
1738
1718
|
if (currentScene) {
|
|
1739
1719
|
// Only one scene even if multiple scenes are defined
|
|
1740
|
-
for (
|
|
1720
|
+
for (let i = 0; i < currentScene.nodes.length; i++) {
|
|
1741
1721
|
traverseNodes(gltfRuntime, currentScene.nodes[i], null);
|
|
1742
1722
|
}
|
|
1743
1723
|
}
|
|
1744
1724
|
else {
|
|
1745
1725
|
// Load all scenes
|
|
1746
|
-
for (
|
|
1726
|
+
for (const thing in gltfRuntime.scenes) {
|
|
1747
1727
|
currentScene = gltfRuntime.scenes[thing];
|
|
1748
|
-
for (
|
|
1728
|
+
for (let i = 0; i < currentScene.nodes.length; i++) {
|
|
1749
1729
|
traverseNodes(gltfRuntime, currentScene.nodes[i], null);
|
|
1750
1730
|
}
|
|
1751
1731
|
}
|
|
1752
1732
|
}
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
}());
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
GLTFLoader.Extensions = {};
|
|
1757
1736
|
/** @internal */
|
|
1758
|
-
|
|
1759
|
-
|
|
1737
|
+
class GLTFLoaderExtension {
|
|
1738
|
+
constructor(name) {
|
|
1760
1739
|
this._name = name;
|
|
1761
1740
|
}
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
},
|
|
1766
|
-
enumerable: false,
|
|
1767
|
-
configurable: true
|
|
1768
|
-
});
|
|
1741
|
+
get name() {
|
|
1742
|
+
return this._name;
|
|
1743
|
+
}
|
|
1769
1744
|
/**
|
|
1770
1745
|
* Defines an override for loading the runtime
|
|
1771
1746
|
* Return true to stop further extensions from loading the runtime
|
|
@@ -1775,9 +1750,9 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1775
1750
|
* @param onSuccess
|
|
1776
1751
|
* @param onError
|
|
1777
1752
|
*/
|
|
1778
|
-
|
|
1753
|
+
loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError) {
|
|
1779
1754
|
return false;
|
|
1780
|
-
}
|
|
1755
|
+
}
|
|
1781
1756
|
/**
|
|
1782
1757
|
* Defines an onverride for creating gltf runtime
|
|
1783
1758
|
* Return true to stop further extensions from creating the runtime
|
|
@@ -1785,9 +1760,9 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1785
1760
|
* @param onSuccess
|
|
1786
1761
|
* @param onError
|
|
1787
1762
|
*/
|
|
1788
|
-
|
|
1763
|
+
loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError) {
|
|
1789
1764
|
return false;
|
|
1790
|
-
}
|
|
1765
|
+
}
|
|
1791
1766
|
/**
|
|
1792
1767
|
* Defines an override for loading buffers
|
|
1793
1768
|
* Return true to stop further extensions from loading this buffer
|
|
@@ -1797,9 +1772,9 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1797
1772
|
* @param onError
|
|
1798
1773
|
* @param onProgress
|
|
1799
1774
|
*/
|
|
1800
|
-
|
|
1775
|
+
loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress) {
|
|
1801
1776
|
return false;
|
|
1802
|
-
}
|
|
1777
|
+
}
|
|
1803
1778
|
/**
|
|
1804
1779
|
* Defines an override for loading texture buffers
|
|
1805
1780
|
* Return true to stop further extensions from loading this texture data
|
|
@@ -1808,9 +1783,9 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1808
1783
|
* @param onSuccess
|
|
1809
1784
|
* @param onError
|
|
1810
1785
|
*/
|
|
1811
|
-
|
|
1786
|
+
loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1812
1787
|
return false;
|
|
1813
|
-
}
|
|
1788
|
+
}
|
|
1814
1789
|
/**
|
|
1815
1790
|
* Defines an override for creating textures
|
|
1816
1791
|
* Return true to stop further extensions from loading this texture
|
|
@@ -1820,9 +1795,9 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1820
1795
|
* @param onSuccess
|
|
1821
1796
|
* @param onError
|
|
1822
1797
|
*/
|
|
1823
|
-
|
|
1798
|
+
createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError) {
|
|
1824
1799
|
return false;
|
|
1825
|
-
}
|
|
1800
|
+
}
|
|
1826
1801
|
/**
|
|
1827
1802
|
* Defines an override for loading shader strings
|
|
1828
1803
|
* Return true to stop further extensions from loading this shader data
|
|
@@ -1831,9 +1806,9 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1831
1806
|
* @param onSuccess
|
|
1832
1807
|
* @param onError
|
|
1833
1808
|
*/
|
|
1834
|
-
|
|
1809
|
+
loadShaderStringAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1835
1810
|
return false;
|
|
1836
|
-
}
|
|
1811
|
+
}
|
|
1837
1812
|
/**
|
|
1838
1813
|
* Defines an override for loading materials
|
|
1839
1814
|
* Return true to stop further extensions from loading this material
|
|
@@ -1842,95 +1817,93 @@ var GLTFLoaderExtension = /** @class */ (function () {
|
|
|
1842
1817
|
* @param onSuccess
|
|
1843
1818
|
* @param onError
|
|
1844
1819
|
*/
|
|
1845
|
-
|
|
1820
|
+
loadMaterialAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1846
1821
|
return false;
|
|
1847
|
-
}
|
|
1822
|
+
}
|
|
1848
1823
|
// ---------
|
|
1849
1824
|
// Utilities
|
|
1850
1825
|
// ---------
|
|
1851
|
-
|
|
1852
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1826
|
+
static LoadRuntimeAsync(scene, data, rootUrl, onSuccess, onError) {
|
|
1827
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1853
1828
|
return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);
|
|
1854
|
-
},
|
|
1855
|
-
setTimeout(
|
|
1829
|
+
}, () => {
|
|
1830
|
+
setTimeout(() => {
|
|
1856
1831
|
if (!onSuccess) {
|
|
1857
1832
|
return;
|
|
1858
1833
|
}
|
|
1859
1834
|
onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
|
|
1860
1835
|
});
|
|
1861
1836
|
});
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1837
|
+
}
|
|
1838
|
+
static LoadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError) {
|
|
1839
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1865
1840
|
return loaderExtension.loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError);
|
|
1866
|
-
},
|
|
1867
|
-
setTimeout(
|
|
1841
|
+
}, () => {
|
|
1842
|
+
setTimeout(() => {
|
|
1868
1843
|
onSuccess();
|
|
1869
1844
|
});
|
|
1870
1845
|
});
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1846
|
+
}
|
|
1847
|
+
static LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress) {
|
|
1848
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1874
1849
|
return loaderExtension.loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);
|
|
1875
|
-
},
|
|
1850
|
+
}, () => {
|
|
1876
1851
|
GLTFLoaderBase.LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);
|
|
1877
1852
|
});
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
GLTFLoaderExtension._LoadTextureBufferAsync(gltfRuntime, id,
|
|
1853
|
+
}
|
|
1854
|
+
static LoadTextureAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1855
|
+
GLTFLoaderExtension._LoadTextureBufferAsync(gltfRuntime, id, (buffer) => {
|
|
1881
1856
|
if (buffer) {
|
|
1882
1857
|
GLTFLoaderExtension._CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
|
|
1883
1858
|
}
|
|
1884
1859
|
}, onError);
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1860
|
+
}
|
|
1861
|
+
static LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1862
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1888
1863
|
return loaderExtension.loadShaderStringAsync(gltfRuntime, id, onSuccess, onError);
|
|
1889
|
-
},
|
|
1864
|
+
}, () => {
|
|
1890
1865
|
GLTFLoaderBase.LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError);
|
|
1891
1866
|
});
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1867
|
+
}
|
|
1868
|
+
static LoadMaterialAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1869
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1895
1870
|
return loaderExtension.loadMaterialAsync(gltfRuntime, id, onSuccess, onError);
|
|
1896
|
-
},
|
|
1871
|
+
}, () => {
|
|
1897
1872
|
GLTFLoaderBase.LoadMaterialAsync(gltfRuntime, id, onSuccess, onError);
|
|
1898
1873
|
});
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1874
|
+
}
|
|
1875
|
+
static _LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError) {
|
|
1876
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1902
1877
|
return loaderExtension.loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);
|
|
1903
|
-
},
|
|
1878
|
+
}, () => {
|
|
1904
1879
|
GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);
|
|
1905
1880
|
});
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
GLTFLoaderExtension._ApplyExtensions(
|
|
1881
|
+
}
|
|
1882
|
+
static _CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError) {
|
|
1883
|
+
GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {
|
|
1909
1884
|
return loaderExtension.createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
|
|
1910
|
-
},
|
|
1885
|
+
}, () => {
|
|
1911
1886
|
GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess);
|
|
1912
1887
|
});
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
for (
|
|
1916
|
-
|
|
1888
|
+
}
|
|
1889
|
+
static _ApplyExtensions(func, defaultFunc) {
|
|
1890
|
+
for (const extensionName in GLTFLoader.Extensions) {
|
|
1891
|
+
const loaderExtension = GLTFLoader.Extensions[extensionName];
|
|
1917
1892
|
if (func(loaderExtension)) {
|
|
1918
1893
|
return;
|
|
1919
1894
|
}
|
|
1920
1895
|
}
|
|
1921
1896
|
defaultFunc();
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
_glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__.GLTFFileLoader._CreateGLTF1Loader = function () { return new GLTFLoader(); };
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
_glTFFileLoader__WEBPACK_IMPORTED_MODULE_3__.GLTFFileLoader._CreateGLTF1Loader = () => new GLTFLoader();
|
|
1927
1900
|
|
|
1928
1901
|
|
|
1929
1902
|
/***/ }),
|
|
1930
1903
|
|
|
1931
|
-
/***/ "../../../
|
|
1904
|
+
/***/ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js":
|
|
1932
1905
|
/*!******************************************************************!*\
|
|
1933
|
-
!*** ../../../
|
|
1906
|
+
!*** ../../../dev/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js ***!
|
|
1934
1907
|
\******************************************************************/
|
|
1935
1908
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1936
1909
|
|
|
@@ -2044,9 +2017,9 @@ var EBlendingFunction;
|
|
|
2044
2017
|
|
|
2045
2018
|
/***/ }),
|
|
2046
2019
|
|
|
2047
|
-
/***/ "../../../
|
|
2020
|
+
/***/ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderUtils.js":
|
|
2048
2021
|
/*!*************************************************************!*\
|
|
2049
|
-
!*** ../../../
|
|
2022
|
+
!*** ../../../dev/loaders/dist/glTF/1.0/glTFLoaderUtils.js ***!
|
|
2050
2023
|
\*************************************************************/
|
|
2051
2024
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2052
2025
|
|
|
@@ -2054,8 +2027,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2054
2027
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2055
2028
|
/* harmony export */ GLTFUtils: () => (/* binding */ GLTFUtils)
|
|
2056
2029
|
/* harmony export */ });
|
|
2057
|
-
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../
|
|
2058
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/Textures/texture */ "core/Misc/
|
|
2030
|
+
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js");
|
|
2031
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/Textures/texture */ "core/Misc/observable");
|
|
2059
2032
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
|
|
2060
2033
|
|
|
2061
2034
|
|
|
@@ -2068,9 +2041,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2068
2041
|
* @internal
|
|
2069
2042
|
* @deprecated
|
|
2070
2043
|
*/
|
|
2071
|
-
|
|
2072
|
-
function GLTFUtils() {
|
|
2073
|
-
}
|
|
2044
|
+
class GLTFUtils {
|
|
2074
2045
|
/**
|
|
2075
2046
|
* Sets the given "parameter" matrix
|
|
2076
2047
|
* @param scene the Scene object
|
|
@@ -2079,8 +2050,8 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2079
2050
|
* @param uniformName the name of the shader's uniform
|
|
2080
2051
|
* @param shaderMaterial the shader material
|
|
2081
2052
|
*/
|
|
2082
|
-
|
|
2083
|
-
|
|
2053
|
+
static SetMatrix(scene, source, parameter, uniformName, shaderMaterial) {
|
|
2054
|
+
let mat = null;
|
|
2084
2055
|
if (parameter.semantic === "MODEL") {
|
|
2085
2056
|
mat = source.getWorldMatrix();
|
|
2086
2057
|
}
|
|
@@ -2132,7 +2103,7 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2132
2103
|
break;
|
|
2133
2104
|
}
|
|
2134
2105
|
}
|
|
2135
|
-
}
|
|
2106
|
+
}
|
|
2136
2107
|
/**
|
|
2137
2108
|
* Sets the given "parameter" matrix
|
|
2138
2109
|
* @param shaderMaterial the shader material
|
|
@@ -2140,7 +2111,7 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2140
2111
|
* @param value the value of the uniform
|
|
2141
2112
|
* @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
|
|
2142
2113
|
*/
|
|
2143
|
-
|
|
2114
|
+
static SetUniform(shaderMaterial, uniform, value, type) {
|
|
2144
2115
|
switch (type) {
|
|
2145
2116
|
case _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EParameterType.FLOAT:
|
|
2146
2117
|
shaderMaterial.setFloat(uniform, value);
|
|
@@ -2157,12 +2128,12 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2157
2128
|
default:
|
|
2158
2129
|
return false;
|
|
2159
2130
|
}
|
|
2160
|
-
}
|
|
2131
|
+
}
|
|
2161
2132
|
/**
|
|
2162
2133
|
* Returns the wrap mode of the texture
|
|
2163
2134
|
* @param mode the mode value
|
|
2164
2135
|
*/
|
|
2165
|
-
|
|
2136
|
+
static GetWrapMode(mode) {
|
|
2166
2137
|
switch (mode) {
|
|
2167
2138
|
case _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureWrapMode.CLAMP_TO_EDGE:
|
|
2168
2139
|
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
|
|
@@ -2173,14 +2144,14 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2173
2144
|
default:
|
|
2174
2145
|
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Texture.WRAP_ADDRESSMODE;
|
|
2175
2146
|
}
|
|
2176
|
-
}
|
|
2147
|
+
}
|
|
2177
2148
|
/**
|
|
2178
2149
|
* Returns the byte stride giving an accessor
|
|
2179
2150
|
* @param accessor the GLTF accessor objet
|
|
2180
2151
|
*/
|
|
2181
|
-
|
|
2152
|
+
static GetByteStrideFromType(accessor) {
|
|
2182
2153
|
// Needs this function since "byteStride" isn't requiered in glTF format
|
|
2183
|
-
|
|
2154
|
+
const type = accessor.type;
|
|
2184
2155
|
switch (type) {
|
|
2185
2156
|
case "VEC2":
|
|
2186
2157
|
return 2;
|
|
@@ -2197,13 +2168,13 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2197
2168
|
default:
|
|
2198
2169
|
return 1;
|
|
2199
2170
|
}
|
|
2200
|
-
}
|
|
2171
|
+
}
|
|
2201
2172
|
/**
|
|
2202
2173
|
* Returns the texture filter mode giving a mode value
|
|
2203
2174
|
* @param mode the filter mode value
|
|
2204
2175
|
* @returns the filter mode (TODO - needs to be a type?)
|
|
2205
2176
|
*/
|
|
2206
|
-
|
|
2177
|
+
static GetTextureFilterMode(mode) {
|
|
2207
2178
|
switch (mode) {
|
|
2208
2179
|
case _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureFilterType.LINEAR:
|
|
2209
2180
|
case _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.ETextureFilterType.LINEAR_MIPMAP_NEAREST:
|
|
@@ -2215,14 +2186,14 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2215
2186
|
default:
|
|
2216
2187
|
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Texture.BILINEAR_SAMPLINGMODE;
|
|
2217
2188
|
}
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2189
|
+
}
|
|
2190
|
+
static GetBufferFromBufferView(gltfRuntime, bufferView, byteOffset, byteLength, componentType) {
|
|
2220
2191
|
byteOffset = bufferView.byteOffset + byteOffset;
|
|
2221
|
-
|
|
2192
|
+
const loadedBufferView = gltfRuntime.loadedBufferViews[bufferView.buffer];
|
|
2222
2193
|
if (byteOffset + byteLength > loadedBufferView.byteLength) {
|
|
2223
2194
|
throw new Error("Buffer access is out of range");
|
|
2224
2195
|
}
|
|
2225
|
-
|
|
2196
|
+
const buffer = loadedBufferView.buffer;
|
|
2226
2197
|
byteOffset += loadedBufferView.byteOffset;
|
|
2227
2198
|
switch (componentType) {
|
|
2228
2199
|
case _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_0__.EComponentType.BYTE:
|
|
@@ -2236,35 +2207,35 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2236
2207
|
default:
|
|
2237
2208
|
return new Float32Array(buffer, byteOffset, byteLength);
|
|
2238
2209
|
}
|
|
2239
|
-
}
|
|
2210
|
+
}
|
|
2240
2211
|
/**
|
|
2241
2212
|
* Returns a buffer from its accessor
|
|
2242
2213
|
* @param gltfRuntime the GLTF runtime
|
|
2243
2214
|
* @param accessor the GLTF accessor
|
|
2244
2215
|
*/
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2216
|
+
static GetBufferFromAccessor(gltfRuntime, accessor) {
|
|
2217
|
+
const bufferView = gltfRuntime.bufferViews[accessor.bufferView];
|
|
2218
|
+
const byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);
|
|
2248
2219
|
return GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);
|
|
2249
|
-
}
|
|
2220
|
+
}
|
|
2250
2221
|
/**
|
|
2251
2222
|
* Decodes a buffer view into a string
|
|
2252
2223
|
* @param view the buffer view
|
|
2253
2224
|
*/
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
for (
|
|
2225
|
+
static DecodeBufferToText(view) {
|
|
2226
|
+
let result = "";
|
|
2227
|
+
const length = view.byteLength;
|
|
2228
|
+
for (let i = 0; i < length; ++i) {
|
|
2258
2229
|
result += String.fromCharCode(view[i]);
|
|
2259
2230
|
}
|
|
2260
2231
|
return result;
|
|
2261
|
-
}
|
|
2232
|
+
}
|
|
2262
2233
|
/**
|
|
2263
2234
|
* Returns the default material of gltf. Related to
|
|
2264
2235
|
* https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
|
|
2265
2236
|
* @param scene the Babylon.js scene
|
|
2266
2237
|
*/
|
|
2267
|
-
|
|
2238
|
+
static GetDefaultMaterial(scene) {
|
|
2268
2239
|
if (!GLTFUtils._DefaultMaterial) {
|
|
2269
2240
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Effect.ShadersStore["GLTFDefaultMaterialVertexShader"] = [
|
|
2270
2241
|
"precision highp float;",
|
|
@@ -2289,11 +2260,11 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2289
2260
|
" gl_FragColor = u_emission;",
|
|
2290
2261
|
"}",
|
|
2291
2262
|
].join("\n");
|
|
2292
|
-
|
|
2263
|
+
const shaderPath = {
|
|
2293
2264
|
vertex: "GLTFDefaultMaterial",
|
|
2294
2265
|
fragment: "GLTFDefaultMaterial",
|
|
2295
2266
|
};
|
|
2296
|
-
|
|
2267
|
+
const options = {
|
|
2297
2268
|
attributes: ["position"],
|
|
2298
2269
|
uniforms: ["worldView", "projection", "u_emission"],
|
|
2299
2270
|
samplers: new Array(),
|
|
@@ -2303,18 +2274,17 @@ var GLTFUtils = /** @class */ (function () {
|
|
|
2303
2274
|
GLTFUtils._DefaultMaterial.setColor4("u_emission", new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color4(0.5, 0.5, 0.5, 1.0));
|
|
2304
2275
|
}
|
|
2305
2276
|
return GLTFUtils._DefaultMaterial;
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
}());
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
// The GLTF default material
|
|
2280
|
+
GLTFUtils._DefaultMaterial = null;
|
|
2311
2281
|
|
|
2312
2282
|
|
|
2313
2283
|
/***/ }),
|
|
2314
2284
|
|
|
2315
|
-
/***/ "../../../
|
|
2285
|
+
/***/ "../../../dev/loaders/dist/glTF/1.0/glTFMaterialsCommonExtension.js":
|
|
2316
2286
|
/*!**************************************************************************!*\
|
|
2317
|
-
!*** ../../../
|
|
2287
|
+
!*** ../../../dev/loaders/dist/glTF/1.0/glTFMaterialsCommonExtension.js ***!
|
|
2318
2288
|
\**************************************************************************/
|
|
2319
2289
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2320
2290
|
|
|
@@ -2322,9 +2292,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2322
2292
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2323
2293
|
/* harmony export */ GLTFMaterialsCommonExtension: () => (/* binding */ GLTFMaterialsCommonExtension)
|
|
2324
2294
|
/* harmony export */ });
|
|
2325
|
-
/* harmony import */ var
|
|
2326
|
-
/* harmony import */ var
|
|
2327
|
-
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Lights/spotLight */ "core/Misc/tools");
|
|
2295
|
+
/* harmony import */ var _glTFLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFLoader */ "../../../dev/loaders/dist/glTF/1.0/glTFLoader.js");
|
|
2296
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Lights/spotLight */ "core/Misc/observable");
|
|
2328
2297
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__);
|
|
2329
2298
|
|
|
2330
2299
|
|
|
@@ -2336,58 +2305,56 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2336
2305
|
|
|
2337
2306
|
|
|
2338
2307
|
|
|
2339
|
-
|
|
2340
2308
|
/**
|
|
2341
2309
|
* @internal
|
|
2342
2310
|
* @deprecated
|
|
2343
2311
|
*/
|
|
2344
|
-
|
|
2345
|
-
(
|
|
2346
|
-
|
|
2347
|
-
return _super.call(this, "KHR_materials_common") || this;
|
|
2312
|
+
class GLTFMaterialsCommonExtension extends _glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderExtension {
|
|
2313
|
+
constructor() {
|
|
2314
|
+
super("KHR_materials_common");
|
|
2348
2315
|
}
|
|
2349
|
-
|
|
2316
|
+
loadRuntimeExtensionsAsync(gltfRuntime) {
|
|
2350
2317
|
if (!gltfRuntime.extensions) {
|
|
2351
2318
|
return false;
|
|
2352
2319
|
}
|
|
2353
|
-
|
|
2320
|
+
const extension = gltfRuntime.extensions[this.name];
|
|
2354
2321
|
if (!extension) {
|
|
2355
2322
|
return false;
|
|
2356
2323
|
}
|
|
2357
2324
|
// Create lights
|
|
2358
|
-
|
|
2325
|
+
const lights = extension.lights;
|
|
2359
2326
|
if (lights) {
|
|
2360
|
-
for (
|
|
2361
|
-
|
|
2327
|
+
for (const thing in lights) {
|
|
2328
|
+
const light = lights[thing];
|
|
2362
2329
|
switch (light.type) {
|
|
2363
2330
|
case "ambient": {
|
|
2364
|
-
|
|
2365
|
-
|
|
2331
|
+
const ambientLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.HemisphericLight(light.name, new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0), gltfRuntime.scene);
|
|
2332
|
+
const ambient = light.ambient;
|
|
2366
2333
|
if (ambient) {
|
|
2367
2334
|
ambientLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(ambient.color || [1, 1, 1]);
|
|
2368
2335
|
}
|
|
2369
2336
|
break;
|
|
2370
2337
|
}
|
|
2371
2338
|
case "point": {
|
|
2372
|
-
|
|
2373
|
-
|
|
2339
|
+
const pointLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointLight(light.name, new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(10, 10, 10), gltfRuntime.scene);
|
|
2340
|
+
const point = light.point;
|
|
2374
2341
|
if (point) {
|
|
2375
2342
|
pointLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(point.color || [1, 1, 1]);
|
|
2376
2343
|
}
|
|
2377
2344
|
break;
|
|
2378
2345
|
}
|
|
2379
2346
|
case "directional": {
|
|
2380
|
-
|
|
2381
|
-
|
|
2347
|
+
const dirLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.DirectionalLight(light.name, new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, -1, 0), gltfRuntime.scene);
|
|
2348
|
+
const directional = light.directional;
|
|
2382
2349
|
if (directional) {
|
|
2383
2350
|
dirLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(directional.color || [1, 1, 1]);
|
|
2384
2351
|
}
|
|
2385
2352
|
break;
|
|
2386
2353
|
}
|
|
2387
2354
|
case "spot": {
|
|
2388
|
-
|
|
2355
|
+
const spot = light.spot;
|
|
2389
2356
|
if (spot) {
|
|
2390
|
-
|
|
2357
|
+
const spotLight = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.SpotLight(light.name, new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 10, 0), new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, -1, 0), spot.fallOffAngle || Math.PI, spot.fallOffExponent || 0.0, gltfRuntime.scene);
|
|
2391
2358
|
spotLight.diffuse = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(spot.color || [1, 1, 1]);
|
|
2392
2359
|
}
|
|
2393
2360
|
break;
|
|
@@ -2399,17 +2366,17 @@ var GLTFMaterialsCommonExtension = /** @class */ (function (_super) {
|
|
|
2399
2366
|
}
|
|
2400
2367
|
}
|
|
2401
2368
|
return false;
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2369
|
+
}
|
|
2370
|
+
loadMaterialAsync(gltfRuntime, id, onSuccess, onError) {
|
|
2371
|
+
const material = gltfRuntime.materials[id];
|
|
2405
2372
|
if (!material || !material.extensions) {
|
|
2406
2373
|
return false;
|
|
2407
2374
|
}
|
|
2408
|
-
|
|
2375
|
+
const extension = material.extensions[this.name];
|
|
2409
2376
|
if (!extension) {
|
|
2410
2377
|
return false;
|
|
2411
2378
|
}
|
|
2412
|
-
|
|
2379
|
+
const standardMaterial = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.StandardMaterial(id, gltfRuntime.scene);
|
|
2413
2380
|
standardMaterial.sideOrientation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.CounterClockWiseSideOrientation;
|
|
2414
2381
|
if (extension.technique === "CONSTANT") {
|
|
2415
2382
|
standardMaterial.disableLighting = true;
|
|
@@ -2446,25 +2413,23 @@ var GLTFMaterialsCommonExtension = /** @class */ (function (_super) {
|
|
|
2446
2413
|
standardMaterial.specularColor = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArray(extension.values.specular || [0, 0, 0]);
|
|
2447
2414
|
}
|
|
2448
2415
|
return true;
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2416
|
+
}
|
|
2417
|
+
_loadTexture(gltfRuntime, id, material, propertyPath, onError) {
|
|
2451
2418
|
// Create buffer from texture url
|
|
2452
|
-
_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id,
|
|
2419
|
+
_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, (buffer) => {
|
|
2453
2420
|
// Create texture from buffer
|
|
2454
|
-
_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer,
|
|
2421
|
+
_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, (texture) => (material[propertyPath] = texture));
|
|
2455
2422
|
}, onError);
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
}(_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderExtension));
|
|
2459
|
-
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2460
2425
|
_glTFLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());
|
|
2461
2426
|
|
|
2462
2427
|
|
|
2463
2428
|
/***/ }),
|
|
2464
2429
|
|
|
2465
|
-
/***/ "../../../
|
|
2430
|
+
/***/ "../../../dev/loaders/dist/glTF/1.0/index.js":
|
|
2466
2431
|
/*!***************************************************!*\
|
|
2467
|
-
!*** ../../../
|
|
2432
|
+
!*** ../../../dev/loaders/dist/glTF/1.0/index.js ***!
|
|
2468
2433
|
\***************************************************/
|
|
2469
2434
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2470
2435
|
|
|
@@ -2485,11 +2450,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2485
2450
|
/* harmony export */ GLTFMaterialsCommonExtension: () => (/* reexport safe */ _glTFMaterialsCommonExtension__WEBPACK_IMPORTED_MODULE_4__.GLTFMaterialsCommonExtension),
|
|
2486
2451
|
/* harmony export */ GLTFUtils: () => (/* reexport safe */ _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_3__.GLTFUtils)
|
|
2487
2452
|
/* harmony export */ });
|
|
2488
|
-
/* harmony import */ var _glTFBinaryExtension__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFBinaryExtension */ "../../../
|
|
2489
|
-
/* harmony import */ var _glTFLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFLoader */ "../../../
|
|
2490
|
-
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../
|
|
2491
|
-
/* harmony import */ var _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFLoaderUtils */ "../../../
|
|
2492
|
-
/* harmony import */ var _glTFMaterialsCommonExtension__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFMaterialsCommonExtension */ "../../../
|
|
2453
|
+
/* harmony import */ var _glTFBinaryExtension__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFBinaryExtension */ "../../../dev/loaders/dist/glTF/1.0/glTFBinaryExtension.js");
|
|
2454
|
+
/* harmony import */ var _glTFLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFLoader */ "../../../dev/loaders/dist/glTF/1.0/glTFLoader.js");
|
|
2455
|
+
/* harmony import */ var _glTFLoaderInterfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFLoaderInterfaces */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js");
|
|
2456
|
+
/* harmony import */ var _glTFLoaderUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFLoaderUtils */ "../../../dev/loaders/dist/glTF/1.0/glTFLoaderUtils.js");
|
|
2457
|
+
/* harmony import */ var _glTFMaterialsCommonExtension__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFMaterialsCommonExtension */ "../../../dev/loaders/dist/glTF/1.0/glTFMaterialsCommonExtension.js");
|
|
2493
2458
|
|
|
2494
2459
|
|
|
2495
2460
|
|
|
@@ -2499,9 +2464,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2499
2464
|
|
|
2500
2465
|
/***/ }),
|
|
2501
2466
|
|
|
2502
|
-
/***/ "../../../
|
|
2467
|
+
/***/ "../../../dev/loaders/dist/glTF/glTFFileLoader.js":
|
|
2503
2468
|
/*!********************************************************!*\
|
|
2504
|
-
!*** ../../../
|
|
2469
|
+
!*** ../../../dev/loaders/dist/glTF/glTFFileLoader.js ***!
|
|
2505
2470
|
\********************************************************/
|
|
2506
2471
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2507
2472
|
|
|
@@ -2512,9 +2477,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2512
2477
|
/* harmony export */ GLTFLoaderCoordinateSystemMode: () => (/* binding */ GLTFLoaderCoordinateSystemMode),
|
|
2513
2478
|
/* harmony export */ GLTFLoaderState: () => (/* binding */ GLTFLoaderState)
|
|
2514
2479
|
/* harmony export */ });
|
|
2515
|
-
/* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/error */ "core/Misc/
|
|
2480
|
+
/* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/error */ "core/Misc/observable");
|
|
2516
2481
|
/* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__);
|
|
2517
|
-
/* harmony import */ var _glTFValidation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFValidation */ "../../../
|
|
2482
|
+
/* harmony import */ var _glTFValidation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFValidation */ "../../../dev/loaders/dist/glTF/glTFValidation.js");
|
|
2518
2483
|
|
|
2519
2484
|
|
|
2520
2485
|
|
|
@@ -2596,8 +2561,8 @@ var GLTFLoaderState;
|
|
|
2596
2561
|
/**
|
|
2597
2562
|
* File loader for loading glTF files into a scene.
|
|
2598
2563
|
*/
|
|
2599
|
-
|
|
2600
|
-
|
|
2564
|
+
class GLTFFileLoader {
|
|
2565
|
+
constructor() {
|
|
2601
2566
|
// --------------
|
|
2602
2567
|
// Common options
|
|
2603
2568
|
// --------------
|
|
@@ -2677,7 +2642,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
2677
2642
|
* Function called before loading a url referenced by the asset.
|
|
2678
2643
|
* @param url
|
|
2679
2644
|
*/
|
|
2680
|
-
this.preprocessUrlAsync =
|
|
2645
|
+
this.preprocessUrlAsync = (url) => Promise.resolve(url);
|
|
2681
2646
|
/**
|
|
2682
2647
|
* Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
|
2683
2648
|
* Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
|
|
@@ -2755,200 +2720,151 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
2755
2720
|
/** @internal */
|
|
2756
2721
|
this._endPerformanceCounter = this._endPerformanceCounterDisabled;
|
|
2757
2722
|
}
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
}
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
this.
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
this._loggingEnabled = value;
|
|
2890
|
-
if (this._loggingEnabled) {
|
|
2891
|
-
this._log = this._logEnabled;
|
|
2892
|
-
}
|
|
2893
|
-
else {
|
|
2894
|
-
this._log = this._logDisabled;
|
|
2895
|
-
}
|
|
2896
|
-
},
|
|
2897
|
-
enumerable: false,
|
|
2898
|
-
configurable: true
|
|
2899
|
-
});
|
|
2900
|
-
Object.defineProperty(GLTFFileLoader.prototype, "capturePerformanceCounters", {
|
|
2901
|
-
/**
|
|
2902
|
-
* Defines if the loader should capture performance counters.
|
|
2903
|
-
*/
|
|
2904
|
-
get: function () {
|
|
2905
|
-
return this._capturePerformanceCounters;
|
|
2906
|
-
},
|
|
2907
|
-
set: function (value) {
|
|
2908
|
-
if (this._capturePerformanceCounters === value) {
|
|
2909
|
-
return;
|
|
2910
|
-
}
|
|
2911
|
-
this._capturePerformanceCounters = value;
|
|
2912
|
-
if (this._capturePerformanceCounters) {
|
|
2913
|
-
this._startPerformanceCounter = this._startPerformanceCounterEnabled;
|
|
2914
|
-
this._endPerformanceCounter = this._endPerformanceCounterEnabled;
|
|
2915
|
-
}
|
|
2916
|
-
else {
|
|
2917
|
-
this._startPerformanceCounter = this._startPerformanceCounterDisabled;
|
|
2918
|
-
this._endPerformanceCounter = this._endPerformanceCounterDisabled;
|
|
2919
|
-
}
|
|
2920
|
-
},
|
|
2921
|
-
enumerable: false,
|
|
2922
|
-
configurable: true
|
|
2923
|
-
});
|
|
2924
|
-
Object.defineProperty(GLTFFileLoader.prototype, "onValidated", {
|
|
2925
|
-
/**
|
|
2926
|
-
* Callback raised after a loader extension is created.
|
|
2927
|
-
*/
|
|
2928
|
-
set: function (callback) {
|
|
2929
|
-
if (this._onValidatedObserver) {
|
|
2930
|
-
this.onValidatedObservable.remove(this._onValidatedObserver);
|
|
2931
|
-
}
|
|
2932
|
-
this._onValidatedObserver = this.onValidatedObservable.add(callback);
|
|
2933
|
-
},
|
|
2934
|
-
enumerable: false,
|
|
2935
|
-
configurable: true
|
|
2936
|
-
});
|
|
2723
|
+
/**
|
|
2724
|
+
* Raised when the asset has been parsed
|
|
2725
|
+
*/
|
|
2726
|
+
set onParsed(callback) {
|
|
2727
|
+
if (this._onParsedObserver) {
|
|
2728
|
+
this.onParsedObservable.remove(this._onParsedObserver);
|
|
2729
|
+
}
|
|
2730
|
+
this._onParsedObserver = this.onParsedObservable.add(callback);
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
|
2734
|
+
* Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
|
|
2735
|
+
*/
|
|
2736
|
+
set onMeshLoaded(callback) {
|
|
2737
|
+
if (this._onMeshLoadedObserver) {
|
|
2738
|
+
this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver);
|
|
2739
|
+
}
|
|
2740
|
+
this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
|
|
2744
|
+
*/
|
|
2745
|
+
set onTextureLoaded(callback) {
|
|
2746
|
+
if (this._onTextureLoadedObserver) {
|
|
2747
|
+
this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver);
|
|
2748
|
+
}
|
|
2749
|
+
this._onTextureLoadedObserver = this.onTextureLoadedObservable.add(callback);
|
|
2750
|
+
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Callback raised when the loader creates a material after parsing the glTF properties of the material.
|
|
2753
|
+
*/
|
|
2754
|
+
set onMaterialLoaded(callback) {
|
|
2755
|
+
if (this._onMaterialLoadedObserver) {
|
|
2756
|
+
this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver);
|
|
2757
|
+
}
|
|
2758
|
+
this._onMaterialLoadedObserver = this.onMaterialLoadedObservable.add(callback);
|
|
2759
|
+
}
|
|
2760
|
+
/**
|
|
2761
|
+
* Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
|
|
2762
|
+
*/
|
|
2763
|
+
set onCameraLoaded(callback) {
|
|
2764
|
+
if (this._onCameraLoadedObserver) {
|
|
2765
|
+
this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver);
|
|
2766
|
+
}
|
|
2767
|
+
this._onCameraLoadedObserver = this.onCameraLoadedObservable.add(callback);
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* Callback raised when the asset is completely loaded, immediately before the loader is disposed.
|
|
2771
|
+
* For assets with LODs, raised when all of the LODs are complete.
|
|
2772
|
+
* For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
|
|
2773
|
+
*/
|
|
2774
|
+
set onComplete(callback) {
|
|
2775
|
+
if (this._onCompleteObserver) {
|
|
2776
|
+
this.onCompleteObservable.remove(this._onCompleteObserver);
|
|
2777
|
+
}
|
|
2778
|
+
this._onCompleteObserver = this.onCompleteObservable.add(callback);
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2781
|
+
* Callback raised when an error occurs.
|
|
2782
|
+
*/
|
|
2783
|
+
set onError(callback) {
|
|
2784
|
+
if (this._onErrorObserver) {
|
|
2785
|
+
this.onErrorObservable.remove(this._onErrorObserver);
|
|
2786
|
+
}
|
|
2787
|
+
this._onErrorObserver = this.onErrorObservable.add(callback);
|
|
2788
|
+
}
|
|
2789
|
+
/**
|
|
2790
|
+
* Callback raised after the loader is disposed.
|
|
2791
|
+
*/
|
|
2792
|
+
set onDispose(callback) {
|
|
2793
|
+
if (this._onDisposeObserver) {
|
|
2794
|
+
this.onDisposeObservable.remove(this._onDisposeObserver);
|
|
2795
|
+
}
|
|
2796
|
+
this._onDisposeObserver = this.onDisposeObservable.add(callback);
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Callback raised after a loader extension is created.
|
|
2800
|
+
*/
|
|
2801
|
+
set onExtensionLoaded(callback) {
|
|
2802
|
+
if (this._onExtensionLoadedObserver) {
|
|
2803
|
+
this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver);
|
|
2804
|
+
}
|
|
2805
|
+
this._onExtensionLoadedObserver = this.onExtensionLoadedObservable.add(callback);
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* Defines if the loader logging is enabled.
|
|
2809
|
+
*/
|
|
2810
|
+
get loggingEnabled() {
|
|
2811
|
+
return this._loggingEnabled;
|
|
2812
|
+
}
|
|
2813
|
+
set loggingEnabled(value) {
|
|
2814
|
+
if (this._loggingEnabled === value) {
|
|
2815
|
+
return;
|
|
2816
|
+
}
|
|
2817
|
+
this._loggingEnabled = value;
|
|
2818
|
+
if (this._loggingEnabled) {
|
|
2819
|
+
this._log = this._logEnabled;
|
|
2820
|
+
}
|
|
2821
|
+
else {
|
|
2822
|
+
this._log = this._logDisabled;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
/**
|
|
2826
|
+
* Defines if the loader should capture performance counters.
|
|
2827
|
+
*/
|
|
2828
|
+
get capturePerformanceCounters() {
|
|
2829
|
+
return this._capturePerformanceCounters;
|
|
2830
|
+
}
|
|
2831
|
+
set capturePerformanceCounters(value) {
|
|
2832
|
+
if (this._capturePerformanceCounters === value) {
|
|
2833
|
+
return;
|
|
2834
|
+
}
|
|
2835
|
+
this._capturePerformanceCounters = value;
|
|
2836
|
+
if (this._capturePerformanceCounters) {
|
|
2837
|
+
this._startPerformanceCounter = this._startPerformanceCounterEnabled;
|
|
2838
|
+
this._endPerformanceCounter = this._endPerformanceCounterEnabled;
|
|
2839
|
+
}
|
|
2840
|
+
else {
|
|
2841
|
+
this._startPerformanceCounter = this._startPerformanceCounterDisabled;
|
|
2842
|
+
this._endPerformanceCounter = this._endPerformanceCounterDisabled;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Callback raised after a loader extension is created.
|
|
2847
|
+
*/
|
|
2848
|
+
set onValidated(callback) {
|
|
2849
|
+
if (this._onValidatedObserver) {
|
|
2850
|
+
this.onValidatedObservable.remove(this._onValidatedObserver);
|
|
2851
|
+
}
|
|
2852
|
+
this._onValidatedObserver = this.onValidatedObservable.add(callback);
|
|
2853
|
+
}
|
|
2937
2854
|
/**
|
|
2938
2855
|
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
|
2939
2856
|
*/
|
|
2940
|
-
|
|
2857
|
+
dispose() {
|
|
2941
2858
|
if (this._loader) {
|
|
2942
2859
|
this._loader.dispose();
|
|
2943
2860
|
this._loader = null;
|
|
2944
2861
|
}
|
|
2945
|
-
for (
|
|
2946
|
-
var request = _a[_i];
|
|
2862
|
+
for (const request of this._requests) {
|
|
2947
2863
|
request.abort();
|
|
2948
2864
|
}
|
|
2949
2865
|
this._requests.length = 0;
|
|
2950
2866
|
delete this._progressCallback;
|
|
2951
|
-
this.preprocessUrlAsync =
|
|
2867
|
+
this.preprocessUrlAsync = (url) => Promise.resolve(url);
|
|
2952
2868
|
this.onMeshLoadedObservable.clear();
|
|
2953
2869
|
this.onSkinLoadedObservable.clear();
|
|
2954
2870
|
this.onTextureLoadedObservable.clear();
|
|
@@ -2958,132 +2874,128 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
2958
2874
|
this.onExtensionLoadedObservable.clear();
|
|
2959
2875
|
this.onDisposeObservable.notifyObservers(undefined);
|
|
2960
2876
|
this.onDisposeObservable.clear();
|
|
2961
|
-
}
|
|
2877
|
+
}
|
|
2962
2878
|
/**
|
|
2963
2879
|
* @internal
|
|
2964
2880
|
*/
|
|
2965
|
-
|
|
2966
|
-
var _this = this;
|
|
2881
|
+
loadFile(scene, fileOrUrl, rootUrl, onSuccess, onProgress, useArrayBuffer, onError, name) {
|
|
2967
2882
|
if (ArrayBuffer.isView(fileOrUrl)) {
|
|
2968
2883
|
this._loadBinary(scene, fileOrUrl, rootUrl, onSuccess, onError, name);
|
|
2969
2884
|
return null;
|
|
2970
2885
|
}
|
|
2971
2886
|
this._progressCallback = onProgress;
|
|
2972
|
-
|
|
2887
|
+
const fileName = fileOrUrl.name || core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Tools.GetFilename(fileOrUrl);
|
|
2973
2888
|
if (useArrayBuffer) {
|
|
2974
2889
|
if (this.useRangeRequests) {
|
|
2975
2890
|
if (this.validate) {
|
|
2976
2891
|
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("glTF validation is not supported when range requests are enabled");
|
|
2977
2892
|
}
|
|
2978
|
-
|
|
2979
|
-
abort:
|
|
2893
|
+
const fileRequest = {
|
|
2894
|
+
abort: () => { },
|
|
2980
2895
|
onCompleteObservable: new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable(),
|
|
2981
2896
|
};
|
|
2982
|
-
|
|
2983
|
-
readAsync:
|
|
2984
|
-
return new Promise(
|
|
2985
|
-
|
|
2897
|
+
const dataBuffer = {
|
|
2898
|
+
readAsync: (byteOffset, byteLength) => {
|
|
2899
|
+
return new Promise((resolve, reject) => {
|
|
2900
|
+
this._loadFile(scene, fileOrUrl, (data) => {
|
|
2986
2901
|
resolve(new Uint8Array(data));
|
|
2987
|
-
}, true,
|
|
2902
|
+
}, true, (error) => {
|
|
2988
2903
|
reject(error);
|
|
2989
|
-
},
|
|
2990
|
-
webRequest.setRequestHeader("Range",
|
|
2904
|
+
}, (webRequest) => {
|
|
2905
|
+
webRequest.setRequestHeader("Range", `bytes=${byteOffset}-${byteOffset + byteLength - 1}`);
|
|
2991
2906
|
});
|
|
2992
2907
|
});
|
|
2993
2908
|
},
|
|
2994
2909
|
byteLength: 0,
|
|
2995
2910
|
};
|
|
2996
|
-
this._unpackBinaryAsync(new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataReader(dataBuffer)).then(
|
|
2997
|
-
|
|
2911
|
+
this._unpackBinaryAsync(new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataReader(dataBuffer)).then((loaderData) => {
|
|
2912
|
+
fileRequest.onCompleteObservable.notifyObservers(fileRequest);
|
|
2998
2913
|
onSuccess(loaderData);
|
|
2999
|
-
}, onError ?
|
|
3000
|
-
return
|
|
2914
|
+
}, onError ? (error) => onError(undefined, error) : undefined);
|
|
2915
|
+
return fileRequest;
|
|
3001
2916
|
}
|
|
3002
|
-
return this._loadFile(scene, fileOrUrl,
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
readAsync:
|
|
2917
|
+
return this._loadFile(scene, fileOrUrl, (data) => {
|
|
2918
|
+
this._validate(scene, new Uint8Array(data), rootUrl, fileName);
|
|
2919
|
+
this._unpackBinaryAsync(new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataReader({
|
|
2920
|
+
readAsync: (byteOffset, byteLength) => readAsync(data, byteOffset, byteLength),
|
|
3006
2921
|
byteLength: data.byteLength,
|
|
3007
|
-
})).then(
|
|
2922
|
+
})).then((loaderData) => {
|
|
3008
2923
|
onSuccess(loaderData);
|
|
3009
|
-
}, onError ?
|
|
2924
|
+
}, onError ? (error) => onError(undefined, error) : undefined);
|
|
3010
2925
|
}, true, onError);
|
|
3011
2926
|
}
|
|
3012
|
-
return this._loadFile(scene, fileOrUrl,
|
|
3013
|
-
|
|
3014
|
-
onSuccess({ json:
|
|
2927
|
+
return this._loadFile(scene, fileOrUrl, (data) => {
|
|
2928
|
+
this._validate(scene, new Uint8Array(data), rootUrl, fileName);
|
|
2929
|
+
onSuccess({ json: this._parseJson(data) });
|
|
3015
2930
|
}, useArrayBuffer, onError);
|
|
3016
|
-
}
|
|
2931
|
+
}
|
|
3017
2932
|
/**
|
|
3018
2933
|
* @internal
|
|
3019
2934
|
*/
|
|
3020
|
-
|
|
2935
|
+
_loadBinary(scene, data, rootUrl, onSuccess, onError, fileName) {
|
|
3021
2936
|
this._validate(scene, data, rootUrl, fileName);
|
|
3022
2937
|
this._unpackBinaryAsync(new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataReader({
|
|
3023
|
-
readAsync:
|
|
2938
|
+
readAsync: (byteOffset, byteLength) => readViewAsync(data, byteOffset, byteLength),
|
|
3024
2939
|
byteLength: data.byteLength,
|
|
3025
|
-
})).then(
|
|
2940
|
+
})).then((loaderData) => {
|
|
3026
2941
|
onSuccess(loaderData);
|
|
3027
|
-
}, onError ?
|
|
3028
|
-
}
|
|
2942
|
+
}, onError ? (error) => onError(undefined, error) : undefined);
|
|
2943
|
+
}
|
|
3029
2944
|
/**
|
|
3030
2945
|
* @internal
|
|
3031
2946
|
*/
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
return _this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);
|
|
2947
|
+
importMeshAsync(meshesNames, scene, data, rootUrl, onProgress, fileName) {
|
|
2948
|
+
return Promise.resolve().then(() => {
|
|
2949
|
+
this.onParsedObservable.notifyObservers(data);
|
|
2950
|
+
this.onParsedObservable.clear();
|
|
2951
|
+
this._log(`Loading ${fileName || ""}`);
|
|
2952
|
+
this._loader = this._getLoader(data);
|
|
2953
|
+
return this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);
|
|
3040
2954
|
});
|
|
3041
|
-
}
|
|
2955
|
+
}
|
|
3042
2956
|
/**
|
|
3043
2957
|
* @internal
|
|
3044
2958
|
*/
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
return _this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);
|
|
2959
|
+
loadAsync(scene, data, rootUrl, onProgress, fileName) {
|
|
2960
|
+
return Promise.resolve().then(() => {
|
|
2961
|
+
this.onParsedObservable.notifyObservers(data);
|
|
2962
|
+
this.onParsedObservable.clear();
|
|
2963
|
+
this._log(`Loading ${fileName || ""}`);
|
|
2964
|
+
this._loader = this._getLoader(data);
|
|
2965
|
+
return this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);
|
|
3053
2966
|
});
|
|
3054
|
-
}
|
|
2967
|
+
}
|
|
3055
2968
|
/**
|
|
3056
2969
|
* @internal
|
|
3057
2970
|
*/
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
_this._loader = _this._getLoader(data);
|
|
2971
|
+
loadAssetContainerAsync(scene, data, rootUrl, onProgress, fileName) {
|
|
2972
|
+
return Promise.resolve().then(() => {
|
|
2973
|
+
this.onParsedObservable.notifyObservers(data);
|
|
2974
|
+
this.onParsedObservable.clear();
|
|
2975
|
+
this._log(`Loading ${fileName || ""}`);
|
|
2976
|
+
this._loader = this._getLoader(data);
|
|
3065
2977
|
// Prepare the asset container.
|
|
3066
|
-
|
|
2978
|
+
const container = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.AssetContainer(scene);
|
|
3067
2979
|
// Get materials/textures when loading to add to container
|
|
3068
|
-
|
|
3069
|
-
|
|
2980
|
+
const materials = [];
|
|
2981
|
+
this.onMaterialLoadedObservable.add((material) => {
|
|
3070
2982
|
materials.push(material);
|
|
3071
2983
|
});
|
|
3072
|
-
|
|
3073
|
-
|
|
2984
|
+
const textures = [];
|
|
2985
|
+
this.onTextureLoadedObservable.add((texture) => {
|
|
3074
2986
|
textures.push(texture);
|
|
3075
2987
|
});
|
|
3076
|
-
|
|
3077
|
-
|
|
2988
|
+
const cameras = [];
|
|
2989
|
+
this.onCameraLoadedObservable.add((camera) => {
|
|
3078
2990
|
cameras.push(camera);
|
|
3079
2991
|
});
|
|
3080
|
-
|
|
3081
|
-
|
|
2992
|
+
const morphTargetManagers = [];
|
|
2993
|
+
this.onMeshLoadedObservable.add((mesh) => {
|
|
3082
2994
|
if (mesh.morphTargetManager) {
|
|
3083
2995
|
morphTargetManagers.push(mesh.morphTargetManager);
|
|
3084
2996
|
}
|
|
3085
2997
|
});
|
|
3086
|
-
return
|
|
2998
|
+
return this._loader.importMeshAsync(null, scene, container, data, rootUrl, onProgress, fileName).then((result) => {
|
|
3087
2999
|
Array.prototype.push.apply(container.geometries, result.geometries);
|
|
3088
3000
|
Array.prototype.push.apply(container.meshes, result.meshes);
|
|
3089
3001
|
Array.prototype.push.apply(container.particleSystems, result.particleSystems);
|
|
@@ -3098,145 +3010,135 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
3098
3010
|
return container;
|
|
3099
3011
|
});
|
|
3100
3012
|
});
|
|
3101
|
-
}
|
|
3013
|
+
}
|
|
3102
3014
|
/**
|
|
3103
3015
|
* @internal
|
|
3104
3016
|
*/
|
|
3105
|
-
|
|
3017
|
+
canDirectLoad(data) {
|
|
3106
3018
|
return ((data.indexOf("asset") !== -1 && data.indexOf("version") !== -1) ||
|
|
3107
3019
|
data.startsWith("data:base64," + GLTFFileLoader._MagicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.
|
|
3108
3020
|
data.startsWith("data:;base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
|
3109
3021
|
data.startsWith("data:application/octet-stream;base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
|
3110
3022
|
data.startsWith("data:model/gltf-binary;base64," + GLTFFileLoader._MagicBase64Encoded));
|
|
3111
|
-
}
|
|
3023
|
+
}
|
|
3112
3024
|
/**
|
|
3113
3025
|
* @internal
|
|
3114
3026
|
*/
|
|
3115
|
-
|
|
3027
|
+
directLoad(scene, data) {
|
|
3116
3028
|
if (data.startsWith("base64," + GLTFFileLoader._MagicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.
|
|
3117
3029
|
data.startsWith(";base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
|
3118
3030
|
data.startsWith("application/octet-stream;base64," + GLTFFileLoader._MagicBase64Encoded) ||
|
|
3119
3031
|
data.startsWith("model/gltf-binary;base64," + GLTFFileLoader._MagicBase64Encoded)) {
|
|
3120
|
-
|
|
3121
|
-
this._validate(scene, new Uint8Array(
|
|
3032
|
+
const arrayBuffer = (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DecodeBase64UrlToBinary)(data);
|
|
3033
|
+
this._validate(scene, new Uint8Array(arrayBuffer));
|
|
3122
3034
|
return this._unpackBinaryAsync(new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataReader({
|
|
3123
|
-
readAsync:
|
|
3124
|
-
byteLength:
|
|
3035
|
+
readAsync: (byteOffset, byteLength) => readAsync(arrayBuffer, byteOffset, byteLength),
|
|
3036
|
+
byteLength: arrayBuffer.byteLength,
|
|
3125
3037
|
}));
|
|
3126
3038
|
}
|
|
3127
3039
|
this._validate(scene, data);
|
|
3128
3040
|
return Promise.resolve({ json: this._parseJson(data) });
|
|
3129
|
-
}
|
|
3041
|
+
}
|
|
3130
3042
|
/** @internal */
|
|
3131
|
-
|
|
3043
|
+
createPlugin() {
|
|
3132
3044
|
return new GLTFFileLoader();
|
|
3133
|
-
}
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
},
|
|
3141
|
-
enumerable: false,
|
|
3142
|
-
configurable: true
|
|
3143
|
-
});
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* The loader state or null if the loader is not active.
|
|
3048
|
+
*/
|
|
3049
|
+
get loaderState() {
|
|
3050
|
+
return this._state;
|
|
3051
|
+
}
|
|
3144
3052
|
/**
|
|
3145
3053
|
* Returns a promise that resolves when the asset is completely loaded.
|
|
3146
3054
|
* @returns a promise that resolves when the asset is completely loaded.
|
|
3147
3055
|
*/
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
_this.onCompleteObservable.addOnce(function () {
|
|
3056
|
+
whenCompleteAsync() {
|
|
3057
|
+
return new Promise((resolve, reject) => {
|
|
3058
|
+
this.onCompleteObservable.addOnce(() => {
|
|
3152
3059
|
resolve();
|
|
3153
3060
|
});
|
|
3154
|
-
|
|
3061
|
+
this.onErrorObservable.addOnce((reason) => {
|
|
3155
3062
|
reject(reason);
|
|
3156
3063
|
});
|
|
3157
3064
|
});
|
|
3158
|
-
}
|
|
3065
|
+
}
|
|
3159
3066
|
/**
|
|
3160
3067
|
* @internal
|
|
3161
3068
|
*/
|
|
3162
|
-
|
|
3069
|
+
_setState(state) {
|
|
3163
3070
|
if (this._state === state) {
|
|
3164
3071
|
return;
|
|
3165
3072
|
}
|
|
3166
3073
|
this._state = state;
|
|
3167
3074
|
this.onLoaderStateChangedObservable.notifyObservers(this._state);
|
|
3168
3075
|
this._log(GLTFLoaderState[this._state]);
|
|
3169
|
-
}
|
|
3076
|
+
}
|
|
3170
3077
|
/**
|
|
3171
3078
|
* @internal
|
|
3172
3079
|
*/
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
_this._onProgress(event, request);
|
|
3080
|
+
_loadFile(scene, fileOrUrl, onSuccess, useArrayBuffer, onError, onOpened) {
|
|
3081
|
+
const request = scene._loadFile(fileOrUrl, onSuccess, (event) => {
|
|
3082
|
+
this._onProgress(event, request);
|
|
3177
3083
|
}, true, useArrayBuffer, onError, onOpened);
|
|
3178
|
-
request.onCompleteObservable.add(
|
|
3179
|
-
|
|
3084
|
+
request.onCompleteObservable.add((request) => {
|
|
3085
|
+
this._requests.splice(this._requests.indexOf(request), 1);
|
|
3180
3086
|
});
|
|
3181
3087
|
this._requests.push(request);
|
|
3182
3088
|
return request;
|
|
3183
|
-
}
|
|
3184
|
-
|
|
3089
|
+
}
|
|
3090
|
+
_onProgress(event, request) {
|
|
3185
3091
|
if (!this._progressCallback) {
|
|
3186
3092
|
return;
|
|
3187
3093
|
}
|
|
3188
3094
|
request._lengthComputable = event.lengthComputable;
|
|
3189
3095
|
request._loaded = event.loaded;
|
|
3190
3096
|
request._total = event.total;
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
for (
|
|
3195
|
-
|
|
3196
|
-
if (request_1._lengthComputable === undefined || request_1._loaded === undefined || request_1._total === undefined) {
|
|
3097
|
+
let lengthComputable = true;
|
|
3098
|
+
let loaded = 0;
|
|
3099
|
+
let total = 0;
|
|
3100
|
+
for (const request of this._requests) {
|
|
3101
|
+
if (request._lengthComputable === undefined || request._loaded === undefined || request._total === undefined) {
|
|
3197
3102
|
return;
|
|
3198
3103
|
}
|
|
3199
|
-
lengthComputable = lengthComputable &&
|
|
3200
|
-
loaded +=
|
|
3201
|
-
total +=
|
|
3104
|
+
lengthComputable = lengthComputable && request._lengthComputable;
|
|
3105
|
+
loaded += request._loaded;
|
|
3106
|
+
total += request._total;
|
|
3202
3107
|
}
|
|
3203
3108
|
this._progressCallback({
|
|
3204
3109
|
lengthComputable: lengthComputable,
|
|
3205
3110
|
loaded: loaded,
|
|
3206
3111
|
total: lengthComputable ? total : 0,
|
|
3207
3112
|
});
|
|
3208
|
-
}
|
|
3209
|
-
|
|
3210
|
-
var _this = this;
|
|
3211
|
-
if (rootUrl === void 0) { rootUrl = ""; }
|
|
3212
|
-
if (fileName === void 0) { fileName = ""; }
|
|
3113
|
+
}
|
|
3114
|
+
_validate(scene, data, rootUrl = "", fileName = "") {
|
|
3213
3115
|
if (!this.validate) {
|
|
3214
3116
|
return;
|
|
3215
3117
|
}
|
|
3216
3118
|
this._startPerformanceCounter("Validate JSON");
|
|
3217
|
-
_glTFValidation__WEBPACK_IMPORTED_MODULE_1__.GLTFValidation.ValidateAsync(data, rootUrl, fileName,
|
|
3218
|
-
return
|
|
3219
|
-
}).then(
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
},
|
|
3224
|
-
|
|
3225
|
-
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(
|
|
3226
|
-
|
|
3119
|
+
_glTFValidation__WEBPACK_IMPORTED_MODULE_1__.GLTFValidation.ValidateAsync(data, rootUrl, fileName, (uri) => {
|
|
3120
|
+
return this.preprocessUrlAsync(rootUrl + uri).then((url) => scene._loadFileAsync(url, undefined, true, true));
|
|
3121
|
+
}).then((result) => {
|
|
3122
|
+
this._endPerformanceCounter("Validate JSON");
|
|
3123
|
+
this.onValidatedObservable.notifyObservers(result);
|
|
3124
|
+
this.onValidatedObservable.clear();
|
|
3125
|
+
}, (reason) => {
|
|
3126
|
+
this._endPerformanceCounter("Validate JSON");
|
|
3127
|
+
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(`Failed to validate: ${reason.message}`);
|
|
3128
|
+
this.onValidatedObservable.clear();
|
|
3227
3129
|
});
|
|
3228
|
-
}
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
this._log(
|
|
3232
|
-
asset.minVersion && this._log(
|
|
3233
|
-
asset.generator && this._log(
|
|
3234
|
-
|
|
3130
|
+
}
|
|
3131
|
+
_getLoader(loaderData) {
|
|
3132
|
+
const asset = loaderData.json.asset || {};
|
|
3133
|
+
this._log(`Asset version: ${asset.version}`);
|
|
3134
|
+
asset.minVersion && this._log(`Asset minimum version: ${asset.minVersion}`);
|
|
3135
|
+
asset.generator && this._log(`Asset generator: ${asset.generator}`);
|
|
3136
|
+
const version = GLTFFileLoader._parseVersion(asset.version);
|
|
3235
3137
|
if (!version) {
|
|
3236
3138
|
throw new Error("Invalid version: " + asset.version);
|
|
3237
3139
|
}
|
|
3238
3140
|
if (asset.minVersion !== undefined) {
|
|
3239
|
-
|
|
3141
|
+
const minVersion = GLTFFileLoader._parseVersion(asset.minVersion);
|
|
3240
3142
|
if (!minVersion) {
|
|
3241
3143
|
throw new Error("Invalid minimum version: " + asset.minVersion);
|
|
3242
3144
|
}
|
|
@@ -3244,113 +3146,111 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
3244
3146
|
throw new Error("Incompatible minimum version: " + asset.minVersion);
|
|
3245
3147
|
}
|
|
3246
3148
|
}
|
|
3247
|
-
|
|
3149
|
+
const createLoaders = {
|
|
3248
3150
|
1: GLTFFileLoader._CreateGLTF1Loader,
|
|
3249
3151
|
2: GLTFFileLoader._CreateGLTF2Loader,
|
|
3250
3152
|
};
|
|
3251
|
-
|
|
3153
|
+
const createLoader = createLoaders[version.major];
|
|
3252
3154
|
if (!createLoader) {
|
|
3253
3155
|
throw new Error("Unsupported version: " + asset.version);
|
|
3254
3156
|
}
|
|
3255
3157
|
return createLoader(this);
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3158
|
+
}
|
|
3159
|
+
_parseJson(json) {
|
|
3258
3160
|
this._startPerformanceCounter("Parse JSON");
|
|
3259
|
-
this._log(
|
|
3260
|
-
|
|
3161
|
+
this._log(`JSON length: ${json.length}`);
|
|
3162
|
+
const parsed = JSON.parse(json);
|
|
3261
3163
|
this._endPerformanceCounter("Parse JSON");
|
|
3262
3164
|
return parsed;
|
|
3263
|
-
}
|
|
3264
|
-
|
|
3265
|
-
var _this = this;
|
|
3165
|
+
}
|
|
3166
|
+
_unpackBinaryAsync(dataReader) {
|
|
3266
3167
|
this._startPerformanceCounter("Unpack Binary");
|
|
3267
3168
|
// Read magic + version + length + json length + json format
|
|
3268
|
-
return dataReader.loadAsync(20).then(
|
|
3269
|
-
|
|
3169
|
+
return dataReader.loadAsync(20).then(() => {
|
|
3170
|
+
const Binary = {
|
|
3270
3171
|
Magic: 0x46546c67,
|
|
3271
3172
|
};
|
|
3272
|
-
|
|
3173
|
+
const magic = dataReader.readUint32();
|
|
3273
3174
|
if (magic !== Binary.Magic) {
|
|
3274
3175
|
throw new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.RuntimeError("Unexpected magic: " + magic, core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.ErrorCodes.GLTFLoaderUnexpectedMagicError);
|
|
3275
3176
|
}
|
|
3276
|
-
|
|
3277
|
-
if (
|
|
3278
|
-
|
|
3177
|
+
const version = dataReader.readUint32();
|
|
3178
|
+
if (this.loggingEnabled) {
|
|
3179
|
+
this._log(`Binary version: ${version}`);
|
|
3279
3180
|
}
|
|
3280
|
-
|
|
3281
|
-
if (!
|
|
3282
|
-
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn(
|
|
3181
|
+
const length = dataReader.readUint32();
|
|
3182
|
+
if (!this.useRangeRequests && length !== dataReader.buffer.byteLength) {
|
|
3183
|
+
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn(`Length in header does not match actual data length: ${length} != ${dataReader.buffer.byteLength}`);
|
|
3283
3184
|
}
|
|
3284
|
-
|
|
3185
|
+
let unpacked;
|
|
3285
3186
|
switch (version) {
|
|
3286
3187
|
case 1: {
|
|
3287
|
-
unpacked =
|
|
3188
|
+
unpacked = this._unpackBinaryV1Async(dataReader, length);
|
|
3288
3189
|
break;
|
|
3289
3190
|
}
|
|
3290
3191
|
case 2: {
|
|
3291
|
-
unpacked =
|
|
3192
|
+
unpacked = this._unpackBinaryV2Async(dataReader, length);
|
|
3292
3193
|
break;
|
|
3293
3194
|
}
|
|
3294
3195
|
default: {
|
|
3295
3196
|
throw new Error("Unsupported version: " + version);
|
|
3296
3197
|
}
|
|
3297
3198
|
}
|
|
3298
|
-
|
|
3199
|
+
this._endPerformanceCounter("Unpack Binary");
|
|
3299
3200
|
return unpacked;
|
|
3300
3201
|
});
|
|
3301
|
-
}
|
|
3302
|
-
|
|
3303
|
-
|
|
3202
|
+
}
|
|
3203
|
+
_unpackBinaryV1Async(dataReader, length) {
|
|
3204
|
+
const ContentFormat = {
|
|
3304
3205
|
JSON: 0,
|
|
3305
3206
|
};
|
|
3306
|
-
|
|
3307
|
-
|
|
3207
|
+
const contentLength = dataReader.readUint32();
|
|
3208
|
+
const contentFormat = dataReader.readUint32();
|
|
3308
3209
|
if (contentFormat !== ContentFormat.JSON) {
|
|
3309
|
-
throw new Error(
|
|
3210
|
+
throw new Error(`Unexpected content format: ${contentFormat}`);
|
|
3310
3211
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3212
|
+
const bodyLength = length - dataReader.byteOffset;
|
|
3213
|
+
const data = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };
|
|
3313
3214
|
if (bodyLength !== 0) {
|
|
3314
|
-
|
|
3215
|
+
const startByteOffset = dataReader.byteOffset;
|
|
3315
3216
|
data.bin = {
|
|
3316
|
-
readAsync:
|
|
3217
|
+
readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),
|
|
3317
3218
|
byteLength: bodyLength,
|
|
3318
3219
|
};
|
|
3319
3220
|
}
|
|
3320
3221
|
return Promise.resolve(data);
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
var ChunkFormat = {
|
|
3222
|
+
}
|
|
3223
|
+
_unpackBinaryV2Async(dataReader, length) {
|
|
3224
|
+
const ChunkFormat = {
|
|
3325
3225
|
JSON: 0x4e4f534a,
|
|
3326
3226
|
BIN: 0x004e4942,
|
|
3327
3227
|
};
|
|
3328
3228
|
// Read the JSON chunk header.
|
|
3329
|
-
|
|
3330
|
-
|
|
3229
|
+
const chunkLength = dataReader.readUint32();
|
|
3230
|
+
const chunkFormat = dataReader.readUint32();
|
|
3331
3231
|
if (chunkFormat !== ChunkFormat.JSON) {
|
|
3332
3232
|
throw new Error("First chunk format is not JSON");
|
|
3333
3233
|
}
|
|
3334
3234
|
// Bail if there are no other chunks.
|
|
3335
3235
|
if (dataReader.byteOffset + chunkLength === length) {
|
|
3336
|
-
return dataReader.loadAsync(chunkLength).then(
|
|
3337
|
-
return { json:
|
|
3236
|
+
return dataReader.loadAsync(chunkLength).then(() => {
|
|
3237
|
+
return { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };
|
|
3338
3238
|
});
|
|
3339
3239
|
}
|
|
3340
3240
|
// Read the JSON chunk and the length and type of the next chunk.
|
|
3341
|
-
return dataReader.loadAsync(chunkLength + 8).then(
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3241
|
+
return dataReader.loadAsync(chunkLength + 8).then(() => {
|
|
3242
|
+
const data = { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };
|
|
3243
|
+
const readAsync = () => {
|
|
3244
|
+
const chunkLength = dataReader.readUint32();
|
|
3245
|
+
const chunkFormat = dataReader.readUint32();
|
|
3346
3246
|
switch (chunkFormat) {
|
|
3347
3247
|
case ChunkFormat.JSON: {
|
|
3348
3248
|
throw new Error("Unexpected JSON chunk");
|
|
3349
3249
|
}
|
|
3350
3250
|
case ChunkFormat.BIN: {
|
|
3351
|
-
|
|
3251
|
+
const startByteOffset = dataReader.byteOffset;
|
|
3352
3252
|
data.bin = {
|
|
3353
|
-
readAsync:
|
|
3253
|
+
readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),
|
|
3354
3254
|
byteLength: chunkLength,
|
|
3355
3255
|
};
|
|
3356
3256
|
dataReader.skipBytes(chunkLength);
|
|
@@ -3369,15 +3269,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
3369
3269
|
};
|
|
3370
3270
|
return readAsync();
|
|
3371
3271
|
});
|
|
3372
|
-
}
|
|
3373
|
-
|
|
3272
|
+
}
|
|
3273
|
+
static _parseVersion(version) {
|
|
3374
3274
|
if (version === "1.0" || version === "1.0.1") {
|
|
3375
3275
|
return {
|
|
3376
3276
|
major: 1,
|
|
3377
3277
|
minor: 0,
|
|
3378
3278
|
};
|
|
3379
3279
|
}
|
|
3380
|
-
|
|
3280
|
+
const match = (version + "").match(/^(\d+)\.(\d+)/);
|
|
3381
3281
|
if (!match) {
|
|
3382
3282
|
return null;
|
|
3383
3283
|
}
|
|
@@ -3385,8 +3285,8 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
3385
3285
|
major: parseInt(match[1]),
|
|
3386
3286
|
minor: parseInt(match[2]),
|
|
3387
3287
|
};
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3288
|
+
}
|
|
3289
|
+
static _compareVersion(a, b) {
|
|
3390
3290
|
if (a.major > b.major) {
|
|
3391
3291
|
return 1;
|
|
3392
3292
|
}
|
|
@@ -3400,51 +3300,50 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
|
3400
3300
|
return -1;
|
|
3401
3301
|
}
|
|
3402
3302
|
return 0;
|
|
3403
|
-
}
|
|
3303
|
+
}
|
|
3404
3304
|
/**
|
|
3405
3305
|
* @internal
|
|
3406
3306
|
*/
|
|
3407
|
-
|
|
3307
|
+
_logOpen(message) {
|
|
3408
3308
|
this._log(message);
|
|
3409
3309
|
this._logIndentLevel++;
|
|
3410
|
-
}
|
|
3310
|
+
}
|
|
3411
3311
|
/** @internal */
|
|
3412
|
-
|
|
3312
|
+
_logClose() {
|
|
3413
3313
|
--this._logIndentLevel;
|
|
3414
|
-
}
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Logger.Log(
|
|
3418
|
-
}
|
|
3419
|
-
|
|
3420
|
-
|
|
3314
|
+
}
|
|
3315
|
+
_logEnabled(message) {
|
|
3316
|
+
const spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);
|
|
3317
|
+
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Logger.Log(`${spaces}${message}`);
|
|
3318
|
+
}
|
|
3319
|
+
_logDisabled(message) { }
|
|
3320
|
+
_startPerformanceCounterEnabled(counterName) {
|
|
3421
3321
|
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Tools.StartPerformanceCounter(counterName);
|
|
3422
|
-
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3322
|
+
}
|
|
3323
|
+
_startPerformanceCounterDisabled(counterName) { }
|
|
3324
|
+
_endPerformanceCounterEnabled(counterName) {
|
|
3425
3325
|
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Tools.EndPerformanceCounter(counterName);
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
}());
|
|
3326
|
+
}
|
|
3327
|
+
_endPerformanceCounterDisabled(counterName) { }
|
|
3328
|
+
}
|
|
3329
|
+
// ----------
|
|
3330
|
+
// V1 options
|
|
3331
|
+
// ----------
|
|
3332
|
+
/**
|
|
3333
|
+
* Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.
|
|
3334
|
+
* Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
|
|
3335
|
+
* Defaults to true.
|
|
3336
|
+
* @internal
|
|
3337
|
+
*/
|
|
3338
|
+
GLTFFileLoader.IncrementalLoading = true;
|
|
3339
|
+
/**
|
|
3340
|
+
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
|
|
3341
|
+
* Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
|
|
3342
|
+
* @internal
|
|
3343
|
+
*/
|
|
3344
|
+
GLTFFileLoader.HomogeneousCoordinates = false;
|
|
3345
|
+
GLTFFileLoader._MagicBase64Encoded = "Z2xURg"; // "glTF" base64 encoded (without the quotes!)
|
|
3346
|
+
GLTFFileLoader._logSpaces = " ";
|
|
3448
3347
|
if (core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.SceneLoader) {
|
|
3449
3348
|
core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.SceneLoader.RegisterPlugin(new GLTFFileLoader());
|
|
3450
3349
|
}
|
|
@@ -3452,9 +3351,9 @@ if (core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.SceneLoader) {
|
|
|
3452
3351
|
|
|
3453
3352
|
/***/ }),
|
|
3454
3353
|
|
|
3455
|
-
/***/ "../../../
|
|
3354
|
+
/***/ "../../../dev/loaders/dist/glTF/glTFValidation.js":
|
|
3456
3355
|
/*!********************************************************!*\
|
|
3457
|
-
!*** ../../../
|
|
3356
|
+
!*** ../../../dev/loaders/dist/glTF/glTFValidation.js ***!
|
|
3458
3357
|
\********************************************************/
|
|
3459
3358
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3460
3359
|
|
|
@@ -3462,12 +3361,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3462
3361
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3463
3362
|
/* harmony export */ GLTFValidation: () => (/* binding */ GLTFValidation)
|
|
3464
3363
|
/* harmony export */ });
|
|
3465
|
-
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Misc/
|
|
3364
|
+
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Misc/observable");
|
|
3466
3365
|
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__);
|
|
3467
3366
|
|
|
3468
3367
|
function validateAsync(data, rootUrl, fileName, getExternalResource) {
|
|
3469
|
-
|
|
3470
|
-
externalResourceFunction:
|
|
3368
|
+
const options = {
|
|
3369
|
+
externalResourceFunction: (uri) => getExternalResource(uri).then((value) => new Uint8Array(value)),
|
|
3471
3370
|
};
|
|
3472
3371
|
if (fileName) {
|
|
3473
3372
|
options.uri = rootUrl === "file:" ? fileName : rootUrl + fileName;
|
|
@@ -3478,24 +3377,22 @@ function validateAsync(data, rootUrl, fileName, getExternalResource) {
|
|
|
3478
3377
|
* The worker function that gets converted to a blob url to pass into a worker.
|
|
3479
3378
|
*/
|
|
3480
3379
|
function workerFunc() {
|
|
3481
|
-
|
|
3482
|
-
onmessage =
|
|
3483
|
-
|
|
3380
|
+
const pendingExternalResources = [];
|
|
3381
|
+
onmessage = (message) => {
|
|
3382
|
+
const data = message.data;
|
|
3484
3383
|
switch (data.id) {
|
|
3485
3384
|
case "init": {
|
|
3486
3385
|
importScripts(data.url);
|
|
3487
3386
|
break;
|
|
3488
3387
|
}
|
|
3489
3388
|
case "validate": {
|
|
3490
|
-
validateAsync(data.data, data.rootUrl, data.fileName,
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
});
|
|
3496
|
-
}).then(function (value) {
|
|
3389
|
+
validateAsync(data.data, data.rootUrl, data.fileName, (uri) => new Promise((resolve, reject) => {
|
|
3390
|
+
const index = pendingExternalResources.length;
|
|
3391
|
+
pendingExternalResources.push({ resolve, reject });
|
|
3392
|
+
postMessage({ id: "getExternalResource", index: index, uri: uri });
|
|
3393
|
+
})).then((value) => {
|
|
3497
3394
|
postMessage({ id: "validate.resolve", value: value });
|
|
3498
|
-
},
|
|
3395
|
+
}, (reason) => {
|
|
3499
3396
|
postMessage({ id: "validate.reject", reason: reason });
|
|
3500
3397
|
});
|
|
3501
3398
|
break;
|
|
@@ -3514,9 +3411,7 @@ function workerFunc() {
|
|
|
3514
3411
|
/**
|
|
3515
3412
|
* glTF validation
|
|
3516
3413
|
*/
|
|
3517
|
-
|
|
3518
|
-
function GLTFValidation() {
|
|
3519
|
-
}
|
|
3414
|
+
class GLTFValidation {
|
|
3520
3415
|
/**
|
|
3521
3416
|
* Validate a glTF asset using the glTF-Validator.
|
|
3522
3417
|
* @param data The JSON of a glTF or the array buffer of a binary glTF
|
|
@@ -3525,26 +3420,25 @@ var GLTFValidation = /** @class */ (function () {
|
|
|
3525
3420
|
* @param getExternalResource The callback to get external resources for the glTF validator
|
|
3526
3421
|
* @returns A promise that resolves with the glTF validation results once complete
|
|
3527
3422
|
*/
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
var dataCopy = ArrayBuffer.isView(data) ? data.slice().buffer : data;
|
|
3423
|
+
static ValidateAsync(data, rootUrl, fileName, getExternalResource) {
|
|
3424
|
+
const dataCopy = ArrayBuffer.isView(data) ? data.slice().buffer : data;
|
|
3531
3425
|
if (typeof Worker === "function") {
|
|
3532
|
-
return new Promise(
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3426
|
+
return new Promise((resolve, reject) => {
|
|
3427
|
+
const workerContent = `${validateAsync}(${workerFunc})()`;
|
|
3428
|
+
const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: "application/javascript" }));
|
|
3429
|
+
const worker = new Worker(workerBlobUrl);
|
|
3430
|
+
const onError = (error) => {
|
|
3537
3431
|
worker.removeEventListener("error", onError);
|
|
3538
3432
|
worker.removeEventListener("message", onMessage);
|
|
3539
3433
|
reject(error);
|
|
3540
3434
|
};
|
|
3541
|
-
|
|
3542
|
-
|
|
3435
|
+
const onMessage = (message) => {
|
|
3436
|
+
const data = message.data;
|
|
3543
3437
|
switch (data.id) {
|
|
3544
3438
|
case "getExternalResource": {
|
|
3545
|
-
getExternalResource(data.uri).then(
|
|
3439
|
+
getExternalResource(data.uri).then((value) => {
|
|
3546
3440
|
worker.postMessage({ id: "getExternalResource.resolve", index: data.index, value: value }, [value]);
|
|
3547
|
-
},
|
|
3441
|
+
}, (reason) => {
|
|
3548
3442
|
worker.postMessage({ id: "getExternalResource.reject", index: data.index, reason: reason });
|
|
3549
3443
|
});
|
|
3550
3444
|
break;
|
|
@@ -3566,7 +3460,7 @@ var GLTFValidation = /** @class */ (function () {
|
|
|
3566
3460
|
};
|
|
3567
3461
|
worker.addEventListener("error", onError);
|
|
3568
3462
|
worker.addEventListener("message", onMessage);
|
|
3569
|
-
worker.postMessage({ id: "init", url:
|
|
3463
|
+
worker.postMessage({ id: "init", url: this.Configuration.url });
|
|
3570
3464
|
worker.postMessage({ id: "validate", data: dataCopy, rootUrl: rootUrl, fileName: fileName });
|
|
3571
3465
|
});
|
|
3572
3466
|
}
|
|
@@ -3574,19 +3468,18 @@ var GLTFValidation = /** @class */ (function () {
|
|
|
3574
3468
|
if (!this._LoadScriptPromise) {
|
|
3575
3469
|
this._LoadScriptPromise = core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__.Tools.LoadScriptAsync(this.Configuration.url);
|
|
3576
3470
|
}
|
|
3577
|
-
return this._LoadScriptPromise.then(
|
|
3471
|
+
return this._LoadScriptPromise.then(() => {
|
|
3578
3472
|
return validateAsync(dataCopy, rootUrl, fileName, getExternalResource);
|
|
3579
3473
|
});
|
|
3580
3474
|
}
|
|
3581
|
-
}
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
}());
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
/**
|
|
3478
|
+
* The configuration. Defaults to `{ url: "https://preview.babylonjs.com/gltf_validator.js" }`.
|
|
3479
|
+
*/
|
|
3480
|
+
GLTFValidation.Configuration = {
|
|
3481
|
+
url: "https://preview.babylonjs.com/gltf_validator.js",
|
|
3482
|
+
};
|
|
3590
3483
|
|
|
3591
3484
|
|
|
3592
3485
|
/***/ }),
|
|
@@ -3599,14 +3492,14 @@ var GLTFValidation = /** @class */ (function () {
|
|
|
3599
3492
|
|
|
3600
3493
|
__webpack_require__.r(__webpack_exports__);
|
|
3601
3494
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3602
|
-
/* harmony export */ GLTFFileLoader: () => (/* reexport safe */
|
|
3603
|
-
/* harmony export */ GLTFLoaderAnimationStartMode: () => (/* reexport safe */
|
|
3604
|
-
/* harmony export */ GLTFLoaderCoordinateSystemMode: () => (/* reexport safe */
|
|
3605
|
-
/* harmony export */ GLTFLoaderState: () => (/* reexport safe */
|
|
3606
|
-
/* harmony export */ GLTFValidation: () => (/* reexport safe */
|
|
3495
|
+
/* harmony export */ GLTFFileLoader: () => (/* reexport safe */ loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFFileLoader),
|
|
3496
|
+
/* harmony export */ GLTFLoaderAnimationStartMode: () => (/* reexport safe */ loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderAnimationStartMode),
|
|
3497
|
+
/* harmony export */ GLTFLoaderCoordinateSystemMode: () => (/* reexport safe */ loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderCoordinateSystemMode),
|
|
3498
|
+
/* harmony export */ GLTFLoaderState: () => (/* reexport safe */ loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__.GLTFLoaderState),
|
|
3499
|
+
/* harmony export */ GLTFValidation: () => (/* reexport safe */ loaders_glTF_glTFValidation__WEBPACK_IMPORTED_MODULE_1__.GLTFValidation)
|
|
3607
3500
|
/* harmony export */ });
|
|
3608
|
-
/* harmony import */ var
|
|
3609
|
-
/* harmony import */ var
|
|
3501
|
+
/* harmony import */ var loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! loaders/glTF/glTFFileLoader */ "../../../dev/loaders/dist/glTF/glTFFileLoader.js");
|
|
3502
|
+
/* harmony import */ var loaders_glTF_glTFValidation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! loaders/glTF/glTFValidation */ "../../../dev/loaders/dist/glTF/glTFValidation.js");
|
|
3610
3503
|
|
|
3611
3504
|
|
|
3612
3505
|
/**
|
|
@@ -3616,11 +3509,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3616
3509
|
var globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof window !== "undefined" ? window : undefined;
|
|
3617
3510
|
if (typeof globalObject !== "undefined") {
|
|
3618
3511
|
globalObject.BABYLON = globalObject.BABYLON || {};
|
|
3619
|
-
for (var key in
|
|
3620
|
-
globalObject.BABYLON[key] =
|
|
3512
|
+
for (var key in loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__) {
|
|
3513
|
+
globalObject.BABYLON[key] = loaders_glTF_glTFFileLoader__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
3621
3514
|
}
|
|
3622
|
-
for (var key in
|
|
3623
|
-
globalObject.BABYLON[key] =
|
|
3515
|
+
for (var key in loaders_glTF_glTFValidation__WEBPACK_IMPORTED_MODULE_1__) {
|
|
3516
|
+
globalObject.BABYLON[key] = loaders_glTF_glTFValidation__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
3624
3517
|
}
|
|
3625
3518
|
}
|
|
3626
3519
|
|
|
@@ -3637,9 +3530,9 @@ if (typeof globalObject !== "undefined") {
|
|
|
3637
3530
|
|
|
3638
3531
|
__webpack_require__.r(__webpack_exports__);
|
|
3639
3532
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3640
|
-
/* harmony export */ GLTF1: () => (/* reexport module object */
|
|
3533
|
+
/* harmony export */ GLTF1: () => (/* reexport module object */ loaders_glTF_1_0_index__WEBPACK_IMPORTED_MODULE_0__)
|
|
3641
3534
|
/* harmony export */ });
|
|
3642
|
-
/* harmony import */ var
|
|
3535
|
+
/* harmony import */ var loaders_glTF_1_0_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! loaders/glTF/1.0/index */ "../../../dev/loaders/dist/glTF/1.0/index.js");
|
|
3643
3536
|
/* eslint-disable import/no-internal-modules */
|
|
3644
3537
|
|
|
3645
3538
|
/**
|
|
@@ -3650,8 +3543,8 @@ var globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_requ
|
|
|
3650
3543
|
if (typeof globalObject !== "undefined") {
|
|
3651
3544
|
globalObject.BABYLON = globalObject.BABYLON || {};
|
|
3652
3545
|
globalObject.BABYLON.GLTF1 = globalObject.BABYLON.GLTF1 || {};
|
|
3653
|
-
for (var key in
|
|
3654
|
-
globalObject.BABYLON.GLTF1[key] =
|
|
3546
|
+
for (var key in loaders_glTF_1_0_index__WEBPACK_IMPORTED_MODULE_0__) {
|
|
3547
|
+
globalObject.BABYLON.GLTF1[key] = loaders_glTF_1_0_index__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
3655
3548
|
}
|
|
3656
3549
|
}
|
|
3657
3550
|
|
|
@@ -3683,377 +3576,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3683
3576
|
|
|
3684
3577
|
/***/ }),
|
|
3685
3578
|
|
|
3686
|
-
/***/ "core/Misc/
|
|
3579
|
+
/***/ "core/Misc/observable":
|
|
3687
3580
|
/*!****************************************************************************************************!*\
|
|
3688
3581
|
!*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
|
|
3689
3582
|
\****************************************************************************************************/
|
|
3690
3583
|
/***/ ((module) => {
|
|
3691
3584
|
|
|
3692
|
-
module.exports =
|
|
3693
|
-
|
|
3694
|
-
/***/ }),
|
|
3695
|
-
|
|
3696
|
-
/***/ "../../../../node_modules/tslib/tslib.es6.mjs":
|
|
3697
|
-
/*!****************************************************!*\
|
|
3698
|
-
!*** ../../../../node_modules/tslib/tslib.es6.mjs ***!
|
|
3699
|
-
\****************************************************/
|
|
3700
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
3701
|
-
|
|
3702
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3703
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3704
|
-
/* harmony export */ __assign: () => (/* binding */ __assign),
|
|
3705
|
-
/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator),
|
|
3706
|
-
/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator),
|
|
3707
|
-
/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues),
|
|
3708
|
-
/* harmony export */ __await: () => (/* binding */ __await),
|
|
3709
|
-
/* harmony export */ __awaiter: () => (/* binding */ __awaiter),
|
|
3710
|
-
/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet),
|
|
3711
|
-
/* harmony export */ __classPrivateFieldIn: () => (/* binding */ __classPrivateFieldIn),
|
|
3712
|
-
/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet),
|
|
3713
|
-
/* harmony export */ __createBinding: () => (/* binding */ __createBinding),
|
|
3714
|
-
/* harmony export */ __decorate: () => (/* binding */ __decorate),
|
|
3715
|
-
/* harmony export */ __esDecorate: () => (/* binding */ __esDecorate),
|
|
3716
|
-
/* harmony export */ __exportStar: () => (/* binding */ __exportStar),
|
|
3717
|
-
/* harmony export */ __extends: () => (/* binding */ __extends),
|
|
3718
|
-
/* harmony export */ __generator: () => (/* binding */ __generator),
|
|
3719
|
-
/* harmony export */ __importDefault: () => (/* binding */ __importDefault),
|
|
3720
|
-
/* harmony export */ __importStar: () => (/* binding */ __importStar),
|
|
3721
|
-
/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject),
|
|
3722
|
-
/* harmony export */ __metadata: () => (/* binding */ __metadata),
|
|
3723
|
-
/* harmony export */ __param: () => (/* binding */ __param),
|
|
3724
|
-
/* harmony export */ __propKey: () => (/* binding */ __propKey),
|
|
3725
|
-
/* harmony export */ __read: () => (/* binding */ __read),
|
|
3726
|
-
/* harmony export */ __rest: () => (/* binding */ __rest),
|
|
3727
|
-
/* harmony export */ __runInitializers: () => (/* binding */ __runInitializers),
|
|
3728
|
-
/* harmony export */ __setFunctionName: () => (/* binding */ __setFunctionName),
|
|
3729
|
-
/* harmony export */ __spread: () => (/* binding */ __spread),
|
|
3730
|
-
/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray),
|
|
3731
|
-
/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays),
|
|
3732
|
-
/* harmony export */ __values: () => (/* binding */ __values),
|
|
3733
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
3734
|
-
/* harmony export */ });
|
|
3735
|
-
/******************************************************************************
|
|
3736
|
-
Copyright (c) Microsoft Corporation.
|
|
3737
|
-
|
|
3738
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3739
|
-
purpose with or without fee is hereby granted.
|
|
3740
|
-
|
|
3741
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3742
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3743
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3744
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3745
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3746
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3747
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3748
|
-
***************************************************************************** */
|
|
3749
|
-
/* global Reflect, Promise */
|
|
3750
|
-
|
|
3751
|
-
var extendStatics = function(d, b) {
|
|
3752
|
-
extendStatics = Object.setPrototypeOf ||
|
|
3753
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3754
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3755
|
-
return extendStatics(d, b);
|
|
3756
|
-
};
|
|
3757
|
-
|
|
3758
|
-
function __extends(d, b) {
|
|
3759
|
-
if (typeof b !== "function" && b !== null)
|
|
3760
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3761
|
-
extendStatics(d, b);
|
|
3762
|
-
function __() { this.constructor = d; }
|
|
3763
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3764
|
-
}
|
|
3765
|
-
|
|
3766
|
-
var __assign = function() {
|
|
3767
|
-
__assign = Object.assign || function __assign(t) {
|
|
3768
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3769
|
-
s = arguments[i];
|
|
3770
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
3771
|
-
}
|
|
3772
|
-
return t;
|
|
3773
|
-
}
|
|
3774
|
-
return __assign.apply(this, arguments);
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
function __rest(s, e) {
|
|
3778
|
-
var t = {};
|
|
3779
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3780
|
-
t[p] = s[p];
|
|
3781
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3782
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3783
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3784
|
-
t[p[i]] = s[p[i]];
|
|
3785
|
-
}
|
|
3786
|
-
return t;
|
|
3787
|
-
}
|
|
3788
|
-
|
|
3789
|
-
function __decorate(decorators, target, key, desc) {
|
|
3790
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3791
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3792
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3793
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3794
|
-
}
|
|
3795
|
-
|
|
3796
|
-
function __param(paramIndex, decorator) {
|
|
3797
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
3798
|
-
}
|
|
3799
|
-
|
|
3800
|
-
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3801
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3802
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
3803
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
3804
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
3805
|
-
var _, done = false;
|
|
3806
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3807
|
-
var context = {};
|
|
3808
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
3809
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
3810
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
3811
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
3812
|
-
if (kind === "accessor") {
|
|
3813
|
-
if (result === void 0) continue;
|
|
3814
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
3815
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
3816
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
3817
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
3818
|
-
}
|
|
3819
|
-
else if (_ = accept(result)) {
|
|
3820
|
-
if (kind === "field") initializers.unshift(_);
|
|
3821
|
-
else descriptor[key] = _;
|
|
3822
|
-
}
|
|
3823
|
-
}
|
|
3824
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
3825
|
-
done = true;
|
|
3826
|
-
};
|
|
3827
|
-
|
|
3828
|
-
function __runInitializers(thisArg, initializers, value) {
|
|
3829
|
-
var useValue = arguments.length > 2;
|
|
3830
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
3831
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
3832
|
-
}
|
|
3833
|
-
return useValue ? value : void 0;
|
|
3834
|
-
};
|
|
3835
|
-
|
|
3836
|
-
function __propKey(x) {
|
|
3837
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
|
3838
|
-
};
|
|
3839
|
-
|
|
3840
|
-
function __setFunctionName(f, name, prefix) {
|
|
3841
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
3842
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
3843
|
-
};
|
|
3844
|
-
|
|
3845
|
-
function __metadata(metadataKey, metadataValue) {
|
|
3846
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
3847
|
-
}
|
|
3848
|
-
|
|
3849
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
3850
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3851
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3852
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3853
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3854
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3855
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3856
|
-
});
|
|
3857
|
-
}
|
|
3858
|
-
|
|
3859
|
-
function __generator(thisArg, body) {
|
|
3860
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
3861
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
3862
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
3863
|
-
function step(op) {
|
|
3864
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
3865
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
3866
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
3867
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
3868
|
-
switch (op[0]) {
|
|
3869
|
-
case 0: case 1: t = op; break;
|
|
3870
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
3871
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
3872
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
3873
|
-
default:
|
|
3874
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
3875
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
3876
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
3877
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
3878
|
-
if (t[2]) _.ops.pop();
|
|
3879
|
-
_.trys.pop(); continue;
|
|
3880
|
-
}
|
|
3881
|
-
op = body.call(thisArg, _);
|
|
3882
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
3883
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
3884
|
-
}
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
|
-
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
3888
|
-
if (k2 === undefined) k2 = k;
|
|
3889
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3890
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3891
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3892
|
-
}
|
|
3893
|
-
Object.defineProperty(o, k2, desc);
|
|
3894
|
-
}) : (function(o, m, k, k2) {
|
|
3895
|
-
if (k2 === undefined) k2 = k;
|
|
3896
|
-
o[k2] = m[k];
|
|
3897
|
-
});
|
|
3898
|
-
|
|
3899
|
-
function __exportStar(m, o) {
|
|
3900
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
3901
|
-
}
|
|
3902
|
-
|
|
3903
|
-
function __values(o) {
|
|
3904
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3905
|
-
if (m) return m.call(o);
|
|
3906
|
-
if (o && typeof o.length === "number") return {
|
|
3907
|
-
next: function () {
|
|
3908
|
-
if (o && i >= o.length) o = void 0;
|
|
3909
|
-
return { value: o && o[i++], done: !o };
|
|
3910
|
-
}
|
|
3911
|
-
};
|
|
3912
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
3913
|
-
}
|
|
3914
|
-
|
|
3915
|
-
function __read(o, n) {
|
|
3916
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3917
|
-
if (!m) return o;
|
|
3918
|
-
var i = m.call(o), r, ar = [], e;
|
|
3919
|
-
try {
|
|
3920
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
3921
|
-
}
|
|
3922
|
-
catch (error) { e = { error: error }; }
|
|
3923
|
-
finally {
|
|
3924
|
-
try {
|
|
3925
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
3926
|
-
}
|
|
3927
|
-
finally { if (e) throw e.error; }
|
|
3928
|
-
}
|
|
3929
|
-
return ar;
|
|
3930
|
-
}
|
|
3931
|
-
|
|
3932
|
-
/** @deprecated */
|
|
3933
|
-
function __spread() {
|
|
3934
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
3935
|
-
ar = ar.concat(__read(arguments[i]));
|
|
3936
|
-
return ar;
|
|
3937
|
-
}
|
|
3938
|
-
|
|
3939
|
-
/** @deprecated */
|
|
3940
|
-
function __spreadArrays() {
|
|
3941
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
3942
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
3943
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
3944
|
-
r[k] = a[j];
|
|
3945
|
-
return r;
|
|
3946
|
-
}
|
|
3947
|
-
|
|
3948
|
-
function __spreadArray(to, from, pack) {
|
|
3949
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3950
|
-
if (ar || !(i in from)) {
|
|
3951
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3952
|
-
ar[i] = from[i];
|
|
3953
|
-
}
|
|
3954
|
-
}
|
|
3955
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3956
|
-
}
|
|
3957
|
-
|
|
3958
|
-
function __await(v) {
|
|
3959
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
3960
|
-
}
|
|
3961
|
-
|
|
3962
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
3963
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
3964
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
3965
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
3966
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
3967
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
3968
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
3969
|
-
function fulfill(value) { resume("next", value); }
|
|
3970
|
-
function reject(value) { resume("throw", value); }
|
|
3971
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
3972
|
-
}
|
|
3973
|
-
|
|
3974
|
-
function __asyncDelegator(o) {
|
|
3975
|
-
var i, p;
|
|
3976
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
3977
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
3978
|
-
}
|
|
3979
|
-
|
|
3980
|
-
function __asyncValues(o) {
|
|
3981
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
3982
|
-
var m = o[Symbol.asyncIterator], i;
|
|
3983
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
3984
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
3985
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
3986
|
-
}
|
|
3987
|
-
|
|
3988
|
-
function __makeTemplateObject(cooked, raw) {
|
|
3989
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3990
|
-
return cooked;
|
|
3991
|
-
};
|
|
3992
|
-
|
|
3993
|
-
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
3994
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3995
|
-
}) : function(o, v) {
|
|
3996
|
-
o["default"] = v;
|
|
3997
|
-
};
|
|
3998
|
-
|
|
3999
|
-
function __importStar(mod) {
|
|
4000
|
-
if (mod && mod.__esModule) return mod;
|
|
4001
|
-
var result = {};
|
|
4002
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
4003
|
-
__setModuleDefault(result, mod);
|
|
4004
|
-
return result;
|
|
4005
|
-
}
|
|
4006
|
-
|
|
4007
|
-
function __importDefault(mod) {
|
|
4008
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
4009
|
-
}
|
|
4010
|
-
|
|
4011
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
4012
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4013
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4014
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4015
|
-
}
|
|
4016
|
-
|
|
4017
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
4018
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4019
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4020
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
4021
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
4022
|
-
}
|
|
4023
|
-
|
|
4024
|
-
function __classPrivateFieldIn(state, receiver) {
|
|
4025
|
-
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
4026
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
4027
|
-
}
|
|
4028
|
-
|
|
4029
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
4030
|
-
__extends,
|
|
4031
|
-
__assign,
|
|
4032
|
-
__rest,
|
|
4033
|
-
__decorate,
|
|
4034
|
-
__param,
|
|
4035
|
-
__metadata,
|
|
4036
|
-
__awaiter,
|
|
4037
|
-
__generator,
|
|
4038
|
-
__createBinding,
|
|
4039
|
-
__exportStar,
|
|
4040
|
-
__values,
|
|
4041
|
-
__read,
|
|
4042
|
-
__spread,
|
|
4043
|
-
__spreadArrays,
|
|
4044
|
-
__spreadArray,
|
|
4045
|
-
__await,
|
|
4046
|
-
__asyncGenerator,
|
|
4047
|
-
__asyncDelegator,
|
|
4048
|
-
__asyncValues,
|
|
4049
|
-
__makeTemplateObject,
|
|
4050
|
-
__importStar,
|
|
4051
|
-
__importDefault,
|
|
4052
|
-
__classPrivateFieldGet,
|
|
4053
|
-
__classPrivateFieldSet,
|
|
4054
|
-
__classPrivateFieldIn,
|
|
4055
|
-
});
|
|
4056
|
-
|
|
3585
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_core_Misc_observable__;
|
|
4057
3586
|
|
|
4058
3587
|
/***/ })
|
|
4059
3588
|
|
|
@@ -4146,13 +3675,13 @@ var __webpack_exports__ = {};
|
|
|
4146
3675
|
__webpack_require__.r(__webpack_exports__);
|
|
4147
3676
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4148
3677
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
4149
|
-
/* harmony export */ loaders: () => (/* reexport module object */
|
|
3678
|
+
/* harmony export */ loaders: () => (/* reexport module object */ _lts_loaders_legacy_legacy_glTF1FileLoader__WEBPACK_IMPORTED_MODULE_0__)
|
|
4150
3679
|
/* harmony export */ });
|
|
4151
|
-
/* harmony import */ var
|
|
3680
|
+
/* harmony import */ var _lts_loaders_legacy_legacy_glTF1FileLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lts/loaders/legacy/legacy-glTF1FileLoader */ "../../../lts/loaders/dist/legacy/legacy-glTF1FileLoader.js");
|
|
4152
3681
|
// eslint-disable-next-line import/export
|
|
4153
3682
|
|
|
4154
3683
|
|
|
4155
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (
|
|
3684
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_lts_loaders_legacy_legacy_glTF1FileLoader__WEBPACK_IMPORTED_MODULE_0__);
|
|
4156
3685
|
|
|
4157
3686
|
})();
|
|
4158
3687
|
|