@babylonjs/loaders 5.21.0 → 5.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/OBJ/mtlFileLoader.js +25 -27
  2. package/OBJ/mtlFileLoader.js.map +1 -1
  3. package/OBJ/objFileLoader.js +112 -124
  4. package/OBJ/objFileLoader.js.map +1 -1
  5. package/OBJ/solidParser.js +118 -125
  6. package/OBJ/solidParser.js.map +1 -1
  7. package/STL/stlFileLoader.js +81 -69
  8. package/STL/stlFileLoader.js.map +1 -1
  9. package/glTF/1.0/glTFBinaryExtension.js +26 -30
  10. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  11. package/glTF/1.0/glTFLoader.js +409 -432
  12. package/glTF/1.0/glTFLoader.js.map +1 -1
  13. package/glTF/1.0/glTFLoaderUtils.js +33 -37
  14. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  15. package/glTF/1.0/glTFMaterialsCommonExtension.js +27 -31
  16. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  17. package/glTF/2.0/Extensions/EXT_lights_image_based.js +48 -59
  18. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  19. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +24 -29
  20. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  21. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +13 -16
  22. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  23. package/glTF/2.0/Extensions/EXT_texture_webp.js +13 -16
  24. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  25. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +22 -26
  26. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
  27. package/glTF/2.0/Extensions/KHR_animation_pointer.js +63 -76
  28. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
  29. package/glTF/2.0/Extensions/KHR_animation_pointer.map.js +90 -120
  30. package/glTF/2.0/Extensions/KHR_animation_pointer.map.js.map +1 -1
  31. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +25 -28
  32. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  33. package/glTF/2.0/Extensions/KHR_lights_punctual.js +27 -30
  34. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  35. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +25 -28
  36. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  37. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +15 -18
  38. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  39. package/glTF/2.0/Extensions/KHR_materials_ior.js +21 -24
  40. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  41. package/glTF/2.0/Extensions/KHR_materials_iridescence.js +27 -31
  42. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  43. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +24 -27
  44. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  45. package/glTF/2.0/Extensions/KHR_materials_sheen.js +23 -26
  46. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  47. package/glTF/2.0/Extensions/KHR_materials_specular.js +23 -26
  48. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  49. package/glTF/2.0/Extensions/KHR_materials_translucency.js +20 -23
  50. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
  51. package/glTF/2.0/Extensions/KHR_materials_transmission.js +82 -86
  52. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  53. package/glTF/2.0/Extensions/KHR_materials_unlit.js +19 -22
  54. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_materials_variants.js +79 -97
  56. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  57. package/glTF/2.0/Extensions/KHR_materials_volume.js +20 -23
  58. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  59. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +6 -8
  60. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
  61. package/glTF/2.0/Extensions/KHR_texture_basisu.js +13 -16
  62. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  63. package/glTF/2.0/Extensions/KHR_texture_transform.js +12 -15
  64. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  65. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +12 -15
  66. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  67. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +77 -95
  68. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  69. package/glTF/2.0/Extensions/MSFT_lod.js +114 -139
  70. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  71. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +12 -15
  72. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
  73. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +12 -15
  74. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
  75. package/glTF/2.0/glTFLoader.js +739 -823
  76. package/glTF/2.0/glTFLoader.js.map +1 -1
  77. package/glTF/glTFFileLoader.js +337 -404
  78. package/glTF/glTFFileLoader.js.map +1 -1
  79. package/glTF/glTFValidation.js +32 -39
  80. package/glTF/glTFValidation.js.map +1 -1
  81. package/legacy/legacy-glTF.js +3 -3
  82. package/legacy/legacy-glTF.js.map +1 -1
  83. package/legacy/legacy-glTF1.js +2 -2
  84. package/legacy/legacy-glTF1.js.map +1 -1
  85. package/legacy/legacy-glTF2.js +12 -12
  86. package/legacy/legacy-glTF2.js.map +1 -1
  87. package/legacy/legacy-objFileLoader.js +2 -2
  88. package/legacy/legacy-objFileLoader.js.map +1 -1
  89. package/legacy/legacy-stlFileLoader.js +2 -2
  90. package/legacy/legacy-stlFileLoader.js.map +1 -1
  91. package/package.json +5 -8
@@ -1,16 +1,16 @@
1
1
  import { Observable } from "@babylonjs/core/Misc/observable.js";
2
2
  import { Deferred } from "@babylonjs/core/Misc/deferred.js";
3
3
  import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
4
- var NAME = "MSFT_lod";
4
+ const NAME = "MSFT_lod";
5
5
  /**
6
6
  * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
7
7
  */
8
- var MSFT_lod = /** @class */ (function () {
8
+ export class MSFT_lod {
9
9
  /**
10
10
  * @param loader
11
11
  * @hidden
12
12
  */
13
- function MSFT_lod(loader) {
13
+ constructor(loader) {
14
14
  /**
15
15
  * The name of this extension.
16
16
  */
@@ -48,7 +48,7 @@ var MSFT_lod = /** @class */ (function () {
48
48
  this.enabled = this._loader.isExtensionUsed(NAME);
49
49
  }
50
50
  /** @hidden */
51
- MSFT_lod.prototype.dispose = function () {
51
+ dispose() {
52
52
  this._loader = null;
53
53
  this._nodeIndexLOD = null;
54
54
  this._nodeSignalLODs.length = 0;
@@ -60,113 +60,100 @@ var MSFT_lod = /** @class */ (function () {
60
60
  this._materialBufferLODs.length = 0;
61
61
  this.onMaterialLODsLoadedObservable.clear();
62
62
  this.onNodeLODsLoadedObservable.clear();
63
- };
63
+ }
64
64
  /** @hidden */
65
- MSFT_lod.prototype.onReady = function () {
66
- var _this = this;
67
- var _loop_1 = function (indexLOD) {
68
- var promise = Promise.all(this_1._nodePromiseLODs[indexLOD]).then(function () {
65
+ onReady() {
66
+ for (let indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {
67
+ const promise = Promise.all(this._nodePromiseLODs[indexLOD]).then(() => {
69
68
  if (indexLOD !== 0) {
70
- _this._loader.endPerformanceCounter("Node LOD ".concat(indexLOD));
71
- _this._loader.log("Loaded node LOD ".concat(indexLOD));
69
+ this._loader.endPerformanceCounter(`Node LOD ${indexLOD}`);
70
+ this._loader.log(`Loaded node LOD ${indexLOD}`);
72
71
  }
73
- _this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);
74
- if (indexLOD !== _this._nodePromiseLODs.length - 1) {
75
- _this._loader.startPerformanceCounter("Node LOD ".concat(indexLOD + 1));
76
- _this._loadBufferLOD(_this._nodeBufferLODs, indexLOD + 1);
77
- if (_this._nodeSignalLODs[indexLOD]) {
78
- _this._nodeSignalLODs[indexLOD].resolve();
72
+ this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);
73
+ if (indexLOD !== this._nodePromiseLODs.length - 1) {
74
+ this._loader.startPerformanceCounter(`Node LOD ${indexLOD + 1}`);
75
+ this._loadBufferLOD(this._nodeBufferLODs, indexLOD + 1);
76
+ if (this._nodeSignalLODs[indexLOD]) {
77
+ this._nodeSignalLODs[indexLOD].resolve();
79
78
  }
80
79
  }
81
80
  });
82
- this_1._loader._completePromises.push(promise);
83
- };
84
- var this_1 = this;
85
- for (var indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {
86
- _loop_1(indexLOD);
81
+ this._loader._completePromises.push(promise);
87
82
  }
88
- var _loop_2 = function (indexLOD) {
89
- var promise = Promise.all(this_2._materialPromiseLODs[indexLOD]).then(function () {
83
+ for (let indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {
84
+ const promise = Promise.all(this._materialPromiseLODs[indexLOD]).then(() => {
90
85
  if (indexLOD !== 0) {
91
- _this._loader.endPerformanceCounter("Material LOD ".concat(indexLOD));
92
- _this._loader.log("Loaded material LOD ".concat(indexLOD));
86
+ this._loader.endPerformanceCounter(`Material LOD ${indexLOD}`);
87
+ this._loader.log(`Loaded material LOD ${indexLOD}`);
93
88
  }
94
- _this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);
95
- if (indexLOD !== _this._materialPromiseLODs.length - 1) {
96
- _this._loader.startPerformanceCounter("Material LOD ".concat(indexLOD + 1));
97
- _this._loadBufferLOD(_this._materialBufferLODs, indexLOD + 1);
98
- if (_this._materialSignalLODs[indexLOD]) {
99
- _this._materialSignalLODs[indexLOD].resolve();
89
+ this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);
90
+ if (indexLOD !== this._materialPromiseLODs.length - 1) {
91
+ this._loader.startPerformanceCounter(`Material LOD ${indexLOD + 1}`);
92
+ this._loadBufferLOD(this._materialBufferLODs, indexLOD + 1);
93
+ if (this._materialSignalLODs[indexLOD]) {
94
+ this._materialSignalLODs[indexLOD].resolve();
100
95
  }
101
96
  }
102
97
  });
103
- this_2._loader._completePromises.push(promise);
104
- };
105
- var this_2 = this;
106
- for (var indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {
107
- _loop_2(indexLOD);
98
+ this._loader._completePromises.push(promise);
108
99
  }
109
- };
100
+ }
110
101
  /**
111
102
  * @param context
112
103
  * @param scene
113
104
  * @hidden
114
105
  */
115
- MSFT_lod.prototype.loadSceneAsync = function (context, scene) {
116
- var promise = this._loader.loadSceneAsync(context, scene);
106
+ loadSceneAsync(context, scene) {
107
+ const promise = this._loader.loadSceneAsync(context, scene);
117
108
  this._loadBufferLOD(this._bufferLODs, 0);
118
109
  return promise;
119
- };
110
+ }
120
111
  /**
121
112
  * @param context
122
113
  * @param node
123
114
  * @param assign
124
115
  * @hidden
125
116
  */
126
- MSFT_lod.prototype.loadNodeAsync = function (context, node, assign) {
127
- var _this = this;
128
- return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
129
- var firstPromise;
130
- var nodeLODs = _this._getLODs(extensionContext, node, _this._loader.gltf.nodes, extension.ids);
131
- _this._loader.logOpen("".concat(extensionContext));
132
- var _loop_3 = function (indexLOD) {
133
- var nodeLOD = nodeLODs[indexLOD];
117
+ loadNodeAsync(context, node, assign) {
118
+ return GLTFLoader.LoadExtensionAsync(context, node, this.name, (extensionContext, extension) => {
119
+ let firstPromise;
120
+ const nodeLODs = this._getLODs(extensionContext, node, this._loader.gltf.nodes, extension.ids);
121
+ this._loader.logOpen(`${extensionContext}`);
122
+ for (let indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {
123
+ const nodeLOD = nodeLODs[indexLOD];
134
124
  if (indexLOD !== 0) {
135
- _this._nodeIndexLOD = indexLOD;
136
- _this._nodeSignalLODs[indexLOD] = _this._nodeSignalLODs[indexLOD] || new Deferred();
125
+ this._nodeIndexLOD = indexLOD;
126
+ this._nodeSignalLODs[indexLOD] = this._nodeSignalLODs[indexLOD] || new Deferred();
137
127
  }
138
- var assignWrap = function (babylonTransformNode) {
128
+ const assignWrap = (babylonTransformNode) => {
139
129
  assign(babylonTransformNode);
140
130
  babylonTransformNode.setEnabled(false);
141
131
  };
142
- var promise = _this._loader.loadNodeAsync("/nodes/".concat(nodeLOD.index), nodeLOD, assignWrap).then(function (babylonMesh) {
132
+ const promise = this._loader.loadNodeAsync(`/nodes/${nodeLOD.index}`, nodeLOD, assignWrap).then((babylonMesh) => {
143
133
  if (indexLOD !== 0) {
144
134
  // TODO: should not rely on _babylonTransformNode
145
- var previousNodeLOD = nodeLODs[indexLOD - 1];
135
+ const previousNodeLOD = nodeLODs[indexLOD - 1];
146
136
  if (previousNodeLOD._babylonTransformNode) {
147
- _this._disposeTransformNode(previousNodeLOD._babylonTransformNode);
137
+ this._disposeTransformNode(previousNodeLOD._babylonTransformNode);
148
138
  delete previousNodeLOD._babylonTransformNode;
149
139
  }
150
140
  }
151
141
  babylonMesh.setEnabled(true);
152
142
  return babylonMesh;
153
143
  });
154
- _this._nodePromiseLODs[indexLOD] = _this._nodePromiseLODs[indexLOD] || [];
144
+ this._nodePromiseLODs[indexLOD] = this._nodePromiseLODs[indexLOD] || [];
155
145
  if (indexLOD === 0) {
156
146
  firstPromise = promise;
157
147
  }
158
148
  else {
159
- _this._nodeIndexLOD = null;
160
- _this._nodePromiseLODs[indexLOD].push(promise);
149
+ this._nodeIndexLOD = null;
150
+ this._nodePromiseLODs[indexLOD].push(promise);
161
151
  }
162
- };
163
- for (var indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {
164
- _loop_3(indexLOD);
165
152
  }
166
- _this._loader.logClose();
153
+ this._loader.logClose();
167
154
  return firstPromise;
168
155
  });
169
- };
156
+ }
170
157
  /**
171
158
  * @param context
172
159
  * @param material
@@ -175,82 +162,77 @@ var MSFT_lod = /** @class */ (function () {
175
162
  * @param assign
176
163
  * @hidden
177
164
  */
178
- MSFT_lod.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {
179
- var _this = this;
165
+ _loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign) {
180
166
  // Don't load material LODs if already loading a node LOD.
181
167
  if (this._nodeIndexLOD) {
182
168
  return null;
183
169
  }
184
- return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
185
- var firstPromise;
186
- var materialLODs = _this._getLODs(extensionContext, material, _this._loader.gltf.materials, extension.ids);
187
- _this._loader.logOpen("".concat(extensionContext));
188
- var _loop_4 = function (indexLOD) {
189
- var materialLOD = materialLODs[indexLOD];
170
+ return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {
171
+ let firstPromise;
172
+ const materialLODs = this._getLODs(extensionContext, material, this._loader.gltf.materials, extension.ids);
173
+ this._loader.logOpen(`${extensionContext}`);
174
+ for (let indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {
175
+ const materialLOD = materialLODs[indexLOD];
190
176
  if (indexLOD !== 0) {
191
- _this._materialIndexLOD = indexLOD;
177
+ this._materialIndexLOD = indexLOD;
192
178
  }
193
- var promise = _this._loader
194
- ._loadMaterialAsync("/materials/".concat(materialLOD.index), materialLOD, babylonMesh, babylonDrawMode, function (babylonMaterial) {
179
+ const promise = this._loader
180
+ ._loadMaterialAsync(`/materials/${materialLOD.index}`, materialLOD, babylonMesh, babylonDrawMode, (babylonMaterial) => {
195
181
  if (indexLOD === 0) {
196
182
  assign(babylonMaterial);
197
183
  }
198
184
  })
199
- .then(function (babylonMaterial) {
185
+ .then((babylonMaterial) => {
200
186
  if (indexLOD !== 0) {
201
187
  assign(babylonMaterial);
202
188
  // TODO: should not rely on _data
203
- var previousDataLOD = materialLODs[indexLOD - 1]._data;
189
+ const previousDataLOD = materialLODs[indexLOD - 1]._data;
204
190
  if (previousDataLOD[babylonDrawMode]) {
205
- _this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);
191
+ this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);
206
192
  delete previousDataLOD[babylonDrawMode];
207
193
  }
208
194
  }
209
195
  return babylonMaterial;
210
196
  });
211
- _this._materialPromiseLODs[indexLOD] = _this._materialPromiseLODs[indexLOD] || [];
197
+ this._materialPromiseLODs[indexLOD] = this._materialPromiseLODs[indexLOD] || [];
212
198
  if (indexLOD === 0) {
213
199
  firstPromise = promise;
214
200
  }
215
201
  else {
216
- _this._materialIndexLOD = null;
217
- _this._materialPromiseLODs[indexLOD].push(promise);
202
+ this._materialIndexLOD = null;
203
+ this._materialPromiseLODs[indexLOD].push(promise);
218
204
  }
219
- };
220
- for (var indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {
221
- _loop_4(indexLOD);
222
205
  }
223
- _this._loader.logClose();
206
+ this._loader.logClose();
224
207
  return firstPromise;
225
208
  });
226
- };
209
+ }
227
210
  /**
228
211
  * @param context
229
212
  * @param property
230
213
  * @param uri
231
214
  * @hidden
232
215
  */
233
- MSFT_lod.prototype._loadUriAsync = function (context, property, uri) {
234
- var _this = this;
216
+ _loadUriAsync(context, property, uri) {
235
217
  // Defer the loading of uris if loading a node or material LOD.
236
218
  if (this._nodeIndexLOD !== null) {
237
- this._loader.log("deferred");
238
- var previousIndexLOD = this._nodeIndexLOD - 1;
219
+ this._loader.log(`deferred`);
220
+ const previousIndexLOD = this._nodeIndexLOD - 1;
239
221
  this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred();
240
- return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(function () {
241
- return _this._loader.loadUriAsync(context, property, uri);
222
+ return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(() => {
223
+ return this._loader.loadUriAsync(context, property, uri);
242
224
  });
243
225
  }
244
226
  else if (this._materialIndexLOD !== null) {
245
- this._loader.log("deferred");
246
- var previousIndexLOD = this._materialIndexLOD - 1;
227
+ this._loader.log(`deferred`);
228
+ const previousIndexLOD = this._materialIndexLOD - 1;
247
229
  this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred();
248
- return this._materialSignalLODs[previousIndexLOD].promise.then(function () {
249
- return _this._loader.loadUriAsync(context, property, uri);
230
+ return this._materialSignalLODs[previousIndexLOD].promise.then(() => {
231
+ return this._loader.loadUriAsync(context, property, uri);
250
232
  });
251
233
  }
252
234
  return null;
253
- };
235
+ }
254
236
  /**
255
237
  * @param context
256
238
  * @param buffer
@@ -258,15 +240,15 @@ var MSFT_lod = /** @class */ (function () {
258
240
  * @param byteLength
259
241
  * @hidden
260
242
  */
261
- MSFT_lod.prototype.loadBufferAsync = function (context, buffer, byteOffset, byteLength) {
243
+ loadBufferAsync(context, buffer, byteOffset, byteLength) {
262
244
  if (this._loader.parent.useRangeRequests && !buffer.uri) {
263
245
  if (!this._loader.bin) {
264
- throw new Error("".concat(context, ": Uri is missing or the binary glTF is missing its binary chunk"));
246
+ throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);
265
247
  }
266
- var loadAsync = function (bufferLODs, indexLOD) {
267
- var start = byteOffset;
268
- var end = start + byteLength - 1;
269
- var bufferLOD = bufferLODs[indexLOD];
248
+ const loadAsync = (bufferLODs, indexLOD) => {
249
+ const start = byteOffset;
250
+ const end = start + byteLength - 1;
251
+ let bufferLOD = bufferLODs[indexLOD];
270
252
  if (bufferLOD) {
271
253
  bufferLOD.start = Math.min(bufferLOD.start, start);
272
254
  bufferLOD.end = Math.max(bufferLOD.end, end);
@@ -275,11 +257,11 @@ var MSFT_lod = /** @class */ (function () {
275
257
  bufferLOD = { start: start, end: end, loaded: new Deferred() };
276
258
  bufferLODs[indexLOD] = bufferLOD;
277
259
  }
278
- return bufferLOD.loaded.promise.then(function (data) {
260
+ return bufferLOD.loaded.promise.then((data) => {
279
261
  return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);
280
262
  });
281
263
  };
282
- this._loader.log("deferred");
264
+ this._loader.log(`deferred`);
283
265
  if (this._nodeIndexLOD !== null) {
284
266
  return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);
285
267
  }
@@ -291,18 +273,18 @@ var MSFT_lod = /** @class */ (function () {
291
273
  }
292
274
  }
293
275
  return null;
294
- };
295
- MSFT_lod.prototype._loadBufferLOD = function (bufferLODs, indexLOD) {
296
- var bufferLOD = bufferLODs[indexLOD];
276
+ }
277
+ _loadBufferLOD(bufferLODs, indexLOD) {
278
+ const bufferLOD = bufferLODs[indexLOD];
297
279
  if (bufferLOD) {
298
- this._loader.log("Loading buffer range [".concat(bufferLOD.start, "-").concat(bufferLOD.end, "]"));
299
- this._loader.bin.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(function (data) {
280
+ this._loader.log(`Loading buffer range [${bufferLOD.start}-${bufferLOD.end}]`);
281
+ this._loader.bin.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then((data) => {
300
282
  bufferLOD.loaded.resolve(data);
301
- }, function (error) {
283
+ }, (error) => {
302
284
  bufferLOD.loaded.reject(error);
303
285
  });
304
286
  }
305
- };
287
+ }
306
288
  /**
307
289
  * Gets an array of LOD properties from lowest to highest.
308
290
  * @param context
@@ -310,61 +292,54 @@ var MSFT_lod = /** @class */ (function () {
310
292
  * @param array
311
293
  * @param ids
312
294
  */
313
- MSFT_lod.prototype._getLODs = function (context, property, array, ids) {
295
+ _getLODs(context, property, array, ids) {
314
296
  if (this.maxLODsToLoad <= 0) {
315
297
  throw new Error("maxLODsToLoad must be greater than zero");
316
298
  }
317
- var properties = new Array();
318
- for (var i = ids.length - 1; i >= 0; i--) {
319
- properties.push(ArrayItem.Get("".concat(context, "/ids/").concat(ids[i]), array, ids[i]));
299
+ const properties = new Array();
300
+ for (let i = ids.length - 1; i >= 0; i--) {
301
+ properties.push(ArrayItem.Get(`${context}/ids/${ids[i]}`, array, ids[i]));
320
302
  if (properties.length === this.maxLODsToLoad) {
321
303
  return properties;
322
304
  }
323
305
  }
324
306
  properties.push(property);
325
307
  return properties;
326
- };
327
- MSFT_lod.prototype._disposeTransformNode = function (babylonTransformNode) {
328
- var _this = this;
329
- var babylonMaterials = new Array();
330
- var babylonMaterial = babylonTransformNode.material;
308
+ }
309
+ _disposeTransformNode(babylonTransformNode) {
310
+ const babylonMaterials = new Array();
311
+ const babylonMaterial = babylonTransformNode.material;
331
312
  if (babylonMaterial) {
332
313
  babylonMaterials.push(babylonMaterial);
333
314
  }
334
- for (var _i = 0, _a = babylonTransformNode.getChildMeshes(); _i < _a.length; _i++) {
335
- var babylonMesh = _a[_i];
315
+ for (const babylonMesh of babylonTransformNode.getChildMeshes()) {
336
316
  if (babylonMesh.material) {
337
317
  babylonMaterials.push(babylonMesh.material);
338
318
  }
339
319
  }
340
320
  babylonTransformNode.dispose();
341
- var babylonMaterialsToDispose = babylonMaterials.filter(function (babylonMaterial) { return _this._loader.babylonScene.meshes.every(function (mesh) { return mesh.material != babylonMaterial; }); });
321
+ const babylonMaterialsToDispose = babylonMaterials.filter((babylonMaterial) => this._loader.babylonScene.meshes.every((mesh) => mesh.material != babylonMaterial));
342
322
  this._disposeMaterials(babylonMaterialsToDispose);
343
- };
344
- MSFT_lod.prototype._disposeMaterials = function (babylonMaterials) {
345
- var babylonTextures = {};
346
- for (var _i = 0, babylonMaterials_1 = babylonMaterials; _i < babylonMaterials_1.length; _i++) {
347
- var babylonMaterial = babylonMaterials_1[_i];
348
- for (var _a = 0, _b = babylonMaterial.getActiveTextures(); _a < _b.length; _a++) {
349
- var babylonTexture = _b[_a];
323
+ }
324
+ _disposeMaterials(babylonMaterials) {
325
+ const babylonTextures = {};
326
+ for (const babylonMaterial of babylonMaterials) {
327
+ for (const babylonTexture of babylonMaterial.getActiveTextures()) {
350
328
  babylonTextures[babylonTexture.uniqueId] = babylonTexture;
351
329
  }
352
330
  babylonMaterial.dispose();
353
331
  }
354
- for (var uniqueId in babylonTextures) {
355
- for (var _c = 0, _d = this._loader.babylonScene.materials; _c < _d.length; _c++) {
356
- var babylonMaterial = _d[_c];
332
+ for (const uniqueId in babylonTextures) {
333
+ for (const babylonMaterial of this._loader.babylonScene.materials) {
357
334
  if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {
358
335
  delete babylonTextures[uniqueId];
359
336
  }
360
337
  }
361
338
  }
362
- for (var uniqueId in babylonTextures) {
339
+ for (const uniqueId in babylonTextures) {
363
340
  babylonTextures[uniqueId].dispose();
364
341
  }
365
- };
366
- return MSFT_lod;
367
- }());
368
- export { MSFT_lod };
369
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_lod(loader); });
342
+ }
343
+ }
344
+ GLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_lod(loader));
370
345
  //# sourceMappingURL=MSFT_lod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MSFT_lod.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_lod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAO9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,IAAM,IAAI,GAAG,UAAU,CAAC;AAQxB;;GAEG;AACH;IAiDI;;;OAGG;IACH,kBAAY,MAAkB;QApD9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAEnB;;WAEG;QACI,kBAAa,GAAG,EA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type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { INode, IMaterial, IBuffer, IScene } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { IProperty, IMSFTLOD } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"MSFT_lod\";\r\n\r\ninterface IBufferInfo {\r\n start: number;\r\n end: number;\r\n loaded: Deferred<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)\r\n */\r\nexport class MSFT_lod implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 100;\r\n\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n public maxLODsToLoad = 10;\r\n\r\n /**\r\n * Observable raised when all node LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onNodeLODsLoadedObservable = new Observable<number>();\r\n\r\n /**\r\n * Observable raised when all material LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onMaterialLODsLoadedObservable = new Observable<number>();\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _bufferLODs = new Array<IBufferInfo>();\r\n\r\n private _nodeIndexLOD: Nullable<number> = null;\r\n private _nodeSignalLODs = new Array<Deferred<void>>();\r\n private _nodePromiseLODs = new Array<Array<Promise<any>>>();\r\n private _nodeBufferLODs = new Array<IBufferInfo>();\r\n\r\n private _materialIndexLOD: Nullable<number> = null;\r\n private _materialSignalLODs = new Array<Deferred<void>>();\r\n private _materialPromiseLODs = new Array<Array<Promise<any>>>();\r\n private _materialBufferLODs = new Array<IBufferInfo>();\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs.length = 0;\r\n this._nodePromiseLODs.length = 0;\r\n this._nodeBufferLODs.length = 0;\r\n\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs.length = 0;\r\n this._materialPromiseLODs.length = 0;\r\n this._materialBufferLODs.length = 0;\r\n\r\n this.onMaterialLODsLoadedObservable.clear();\r\n this.onNodeLODsLoadedObservable.clear();\r\n }\r\n\r\n /** @hidden */\r\n public onReady(): void {\r\n for (let indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._nodePromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Node LOD ${indexLOD}`);\r\n this._loader.log(`Loaded node LOD ${indexLOD}`);\r\n }\r\n\r\n this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._nodePromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Node LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._nodeBufferLODs, indexLOD + 1);\r\n if (this._nodeSignalLODs[indexLOD]) {\r\n this._nodeSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n\r\n for (let indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._materialPromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Material LOD ${indexLOD}`);\r\n this._loader.log(`Loaded material LOD ${indexLOD}`);\r\n }\r\n\r\n this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._materialPromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Material LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._materialBufferLODs, indexLOD + 1);\r\n if (this._materialSignalLODs[indexLOD]) {\r\n this._materialSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param scene\r\n * @hidden\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n const promise = this._loader.loadSceneAsync(context, scene);\r\n this._loadBufferLOD(this._bufferLODs, 0);\r\n return promise;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<TransformNode>;\r\n\r\n const nodeLODs = this._getLODs(extensionContext, node, this._loader.gltf.nodes, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\r\n const nodeLOD = nodeLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._nodeIndexLOD = indexLOD;\r\n this._nodeSignalLODs[indexLOD] = this._nodeSignalLODs[indexLOD] || new Deferred();\r\n }\r\n\r\n const assignWrap = (babylonTransformNode: TransformNode) => {\r\n assign(babylonTransformNode);\r\n babylonTransformNode.setEnabled(false);\r\n };\r\n\r\n const promise = this._loader.loadNodeAsync(`/nodes/${nodeLOD.index}`, nodeLOD, assignWrap).then((babylonMesh) => {\r\n if (indexLOD !== 0) {\r\n // TODO: should not rely on _babylonTransformNode\r\n const previousNodeLOD = nodeLODs[indexLOD - 1];\r\n if (previousNodeLOD._babylonTransformNode) {\r\n this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\r\n delete previousNodeLOD._babylonTransformNode;\r\n }\r\n }\r\n\r\n babylonMesh.setEnabled(true);\r\n return babylonMesh;\r\n });\r\n\r\n this._nodePromiseLODs[indexLOD] = this._nodePromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._nodeIndexLOD = null;\r\n this._nodePromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMesh\r\n * @param babylonDrawMode\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadMaterialAsync(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void\r\n ): Nullable<Promise<Material>> {\r\n // Don't load material LODs if already loading a node LOD.\r\n if (this._nodeIndexLOD) {\r\n return null;\r\n }\r\n\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, Material>(context, material, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<Material>;\r\n\r\n const materialLODs = this._getLODs(extensionContext, material, this._loader.gltf.materials, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\r\n const materialLOD = materialLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._materialIndexLOD = indexLOD;\r\n }\r\n\r\n const promise = this._loader\r\n ._loadMaterialAsync(`/materials/${materialLOD.index}`, materialLOD, babylonMesh, babylonDrawMode, (babylonMaterial) => {\r\n if (indexLOD === 0) {\r\n assign(babylonMaterial);\r\n }\r\n })\r\n .then((babylonMaterial) => {\r\n if (indexLOD !== 0) {\r\n assign(babylonMaterial);\r\n\r\n // TODO: should not rely on _data\r\n const previousDataLOD = materialLODs[indexLOD - 1]._data!;\r\n if (previousDataLOD[babylonDrawMode]) {\r\n this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\r\n delete previousDataLOD[babylonDrawMode];\r\n }\r\n }\r\n\r\n return babylonMaterial;\r\n });\r\n\r\n this._materialPromiseLODs[indexLOD] = this._materialPromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._materialIndexLOD = null;\r\n this._materialPromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param property\r\n * @param uri\r\n * @hidden\r\n */\r\n public _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>> {\r\n // Defer the loading of uris if loading a node or material LOD.\r\n if (this._nodeIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._nodeIndexLOD - 1;\r\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n } else if (this._materialIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._materialIndexLOD - 1;\r\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._materialSignalLODs[previousIndexLOD].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param buffer\r\n * @param byteOffset\r\n * @param byteLength\r\n * @hidden\r\n */\r\n public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>> {\r\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\r\n if (!this._loader.bin) {\r\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\r\n }\r\n\r\n const loadAsync = (bufferLODs: Array<IBufferInfo>, indexLOD: number) => {\r\n const start = byteOffset;\r\n const end = start + byteLength - 1;\r\n let bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n bufferLOD.start = Math.min(bufferLOD.start, start);\r\n bufferLOD.end = Math.max(bufferLOD.end, end);\r\n } else {\r\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\r\n bufferLODs[indexLOD] = bufferLOD;\r\n }\r\n\r\n return bufferLOD.loaded.promise.then((data) => {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\r\n });\r\n };\r\n\r\n this._loader.log(`deferred`);\r\n\r\n if (this._nodeIndexLOD !== null) {\r\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\r\n } else if (this._materialIndexLOD !== null) {\r\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\r\n } else {\r\n return loadAsync(this._bufferLODs, 0);\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _loadBufferLOD(bufferLODs: Array<IBufferInfo>, indexLOD: number): void {\r\n const bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n this._loader.log(`Loading buffer range [${bufferLOD.start}-${bufferLOD.end}]`);\r\n this._loader.bin!.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(\r\n (data) => {\r\n bufferLOD.loaded.resolve(data);\r\n },\r\n (error) => {\r\n bufferLOD.loaded.reject(error);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Gets an array of LOD properties from lowest to highest.\r\n * @param context\r\n * @param property\r\n * @param array\r\n * @param ids\r\n */\r\n private _getLODs<T>(context: string, property: T, array: ArrayLike<T> | undefined, ids: number[]): T[] {\r\n if (this.maxLODsToLoad <= 0) {\r\n throw new Error(\"maxLODsToLoad must be greater than zero\");\r\n }\r\n\r\n const properties = new Array<T>();\r\n\r\n for (let i = ids.length - 1; i >= 0; i--) {\r\n properties.push(ArrayItem.Get(`${context}/ids/${ids[i]}`, array, ids[i]));\r\n if (properties.length === this.maxLODsToLoad) {\r\n return properties;\r\n }\r\n }\r\n\r\n properties.push(property);\r\n return properties;\r\n }\r\n\r\n private _disposeTransformNode(babylonTransformNode: TransformNode): void {\r\n const babylonMaterials = new Array<Material>();\r\n const babylonMaterial = (babylonTransformNode as Mesh).material;\r\n if (babylonMaterial) {\r\n babylonMaterials.push(babylonMaterial);\r\n }\r\n for (const babylonMesh of babylonTransformNode.getChildMeshes()) {\r\n if (babylonMesh.material) {\r\n babylonMaterials.push(babylonMesh.material);\r\n }\r\n }\r\n\r\n babylonTransformNode.dispose();\r\n\r\n const babylonMaterialsToDispose = babylonMaterials.filter((babylonMaterial) => this._loader.babylonScene.meshes.every((mesh) => mesh.material != babylonMaterial));\r\n this._disposeMaterials(babylonMaterialsToDispose);\r\n }\r\n\r\n private _disposeMaterials(babylonMaterials: Material[]): void {\r\n const babylonTextures: { [uniqueId: number]: BaseTexture } = {};\r\n\r\n for (const babylonMaterial of babylonMaterials) {\r\n for (const babylonTexture of babylonMaterial.getActiveTextures()) {\r\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\r\n }\r\n\r\n babylonMaterial.dispose();\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n for (const babylonMaterial of this._loader.babylonScene.materials) {\r\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\r\n delete babylonTextures[uniqueId];\r\n }\r\n }\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n babylonTextures[uniqueId].dispose();\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_lod(loader));\r\n"]}
1
+ {"version":3,"file":"MSFT_lod.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_lod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAO9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,MAAM,IAAI,GAAG,UAAU,CAAC;AAQxB;;GAEG;AACH,MAAM,OAAO,QAAQ;IAiDjB;;;OAGG;IACH,YAAY,MAAkB;QApD9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAEnB;;WAEG;QACI,kBAAa,GAAG,EAAE,CAAC;QAE1B;;;;WAIG;QACI,+BAA0B,GAAG,IAAI,UAAU,EAAU,CAAC;QAE7D;;;;WAIG;QACI,mCAA8B,GAAG,IAAI,UAAU,EAAU,CAAC;QAIzD,gBAAW,GAAG,IAAI,KAAK,EAAe,CAAC;QAEvC,kBAAa,GAAqB,IAAI,CAAC;QACvC,oBAAe,GAAG,IAAI,KAAK,EAAkB,CAAC;QAC9C,qBAAgB,GAAG,IAAI,KAAK,EAAuB,CAAC;QACpD,oBAAe,GAAG,IAAI,KAAK,EAAe,CAAC;QAE3C,sBAAiB,GAAqB,IAAI,CAAC;QAC3C,wBAAmB,GAAG,IAAI,KAAK,EAAkB,CAAC;QAClD,yBAAoB,GAAG,IAAI,KAAK,EAAuB,CAAC;QACxD,wBAAmB,GAAG,IAAI,KAAK,EAAe,CAAC;QAOnD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;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CAAC;SACvC;IACL,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { INode, IMaterial, IBuffer, IScene } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { IProperty, IMSFTLOD } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"MSFT_lod\";\r\n\r\ninterface IBufferInfo {\r\n start: number;\r\n end: number;\r\n loaded: Deferred<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)\r\n */\r\nexport class MSFT_lod implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 100;\r\n\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n public maxLODsToLoad = 10;\r\n\r\n /**\r\n * Observable raised when all node LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onNodeLODsLoadedObservable = new Observable<number>();\r\n\r\n /**\r\n * Observable raised when all material LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onMaterialLODsLoadedObservable = new Observable<number>();\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _bufferLODs = new Array<IBufferInfo>();\r\n\r\n private _nodeIndexLOD: Nullable<number> = null;\r\n private _nodeSignalLODs = new Array<Deferred<void>>();\r\n private _nodePromiseLODs = new Array<Array<Promise<any>>>();\r\n private _nodeBufferLODs = new Array<IBufferInfo>();\r\n\r\n private _materialIndexLOD: Nullable<number> = null;\r\n private _materialSignalLODs = new Array<Deferred<void>>();\r\n private _materialPromiseLODs = new Array<Array<Promise<any>>>();\r\n private _materialBufferLODs = new Array<IBufferInfo>();\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs.length = 0;\r\n this._nodePromiseLODs.length = 0;\r\n this._nodeBufferLODs.length = 0;\r\n\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs.length = 0;\r\n this._materialPromiseLODs.length = 0;\r\n this._materialBufferLODs.length = 0;\r\n\r\n this.onMaterialLODsLoadedObservable.clear();\r\n this.onNodeLODsLoadedObservable.clear();\r\n }\r\n\r\n /** @hidden */\r\n public onReady(): void {\r\n for (let indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._nodePromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Node LOD ${indexLOD}`);\r\n this._loader.log(`Loaded node LOD ${indexLOD}`);\r\n }\r\n\r\n this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._nodePromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Node LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._nodeBufferLODs, indexLOD + 1);\r\n if (this._nodeSignalLODs[indexLOD]) {\r\n this._nodeSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n\r\n for (let indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._materialPromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Material LOD ${indexLOD}`);\r\n this._loader.log(`Loaded material LOD ${indexLOD}`);\r\n }\r\n\r\n this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._materialPromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Material LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._materialBufferLODs, indexLOD + 1);\r\n if (this._materialSignalLODs[indexLOD]) {\r\n this._materialSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param scene\r\n * @hidden\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n const promise = this._loader.loadSceneAsync(context, scene);\r\n this._loadBufferLOD(this._bufferLODs, 0);\r\n return promise;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<TransformNode>;\r\n\r\n const nodeLODs = this._getLODs(extensionContext, node, this._loader.gltf.nodes, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\r\n const nodeLOD = nodeLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._nodeIndexLOD = indexLOD;\r\n this._nodeSignalLODs[indexLOD] = this._nodeSignalLODs[indexLOD] || new Deferred();\r\n }\r\n\r\n const assignWrap = (babylonTransformNode: TransformNode) => {\r\n assign(babylonTransformNode);\r\n babylonTransformNode.setEnabled(false);\r\n };\r\n\r\n const promise = this._loader.loadNodeAsync(`/nodes/${nodeLOD.index}`, nodeLOD, assignWrap).then((babylonMesh) => {\r\n if (indexLOD !== 0) {\r\n // TODO: should not rely on _babylonTransformNode\r\n const previousNodeLOD = nodeLODs[indexLOD - 1];\r\n if (previousNodeLOD._babylonTransformNode) {\r\n this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\r\n delete previousNodeLOD._babylonTransformNode;\r\n }\r\n }\r\n\r\n babylonMesh.setEnabled(true);\r\n return babylonMesh;\r\n });\r\n\r\n this._nodePromiseLODs[indexLOD] = this._nodePromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._nodeIndexLOD = null;\r\n this._nodePromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMesh\r\n * @param babylonDrawMode\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadMaterialAsync(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void\r\n ): Nullable<Promise<Material>> {\r\n // Don't load material LODs if already loading a node LOD.\r\n if (this._nodeIndexLOD) {\r\n return null;\r\n }\r\n\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, Material>(context, material, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<Material>;\r\n\r\n const materialLODs = this._getLODs(extensionContext, material, this._loader.gltf.materials, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\r\n const materialLOD = materialLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._materialIndexLOD = indexLOD;\r\n }\r\n\r\n const promise = this._loader\r\n ._loadMaterialAsync(`/materials/${materialLOD.index}`, materialLOD, babylonMesh, babylonDrawMode, (babylonMaterial) => {\r\n if (indexLOD === 0) {\r\n assign(babylonMaterial);\r\n }\r\n })\r\n .then((babylonMaterial) => {\r\n if (indexLOD !== 0) {\r\n assign(babylonMaterial);\r\n\r\n // TODO: should not rely on _data\r\n const previousDataLOD = materialLODs[indexLOD - 1]._data!;\r\n if (previousDataLOD[babylonDrawMode]) {\r\n this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\r\n delete previousDataLOD[babylonDrawMode];\r\n }\r\n }\r\n\r\n return babylonMaterial;\r\n });\r\n\r\n this._materialPromiseLODs[indexLOD] = this._materialPromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._materialIndexLOD = null;\r\n this._materialPromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param property\r\n * @param uri\r\n * @hidden\r\n */\r\n public _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>> {\r\n // Defer the loading of uris if loading a node or material LOD.\r\n if (this._nodeIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._nodeIndexLOD - 1;\r\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n } else if (this._materialIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._materialIndexLOD - 1;\r\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._materialSignalLODs[previousIndexLOD].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param buffer\r\n * @param byteOffset\r\n * @param byteLength\r\n * @hidden\r\n */\r\n public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>> {\r\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\r\n if (!this._loader.bin) {\r\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\r\n }\r\n\r\n const loadAsync = (bufferLODs: Array<IBufferInfo>, indexLOD: number) => {\r\n const start = byteOffset;\r\n const end = start + byteLength - 1;\r\n let bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n bufferLOD.start = Math.min(bufferLOD.start, start);\r\n bufferLOD.end = Math.max(bufferLOD.end, end);\r\n } else {\r\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\r\n bufferLODs[indexLOD] = bufferLOD;\r\n }\r\n\r\n return bufferLOD.loaded.promise.then((data) => {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\r\n });\r\n };\r\n\r\n this._loader.log(`deferred`);\r\n\r\n if (this._nodeIndexLOD !== null) {\r\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\r\n } else if (this._materialIndexLOD !== null) {\r\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\r\n } else {\r\n return loadAsync(this._bufferLODs, 0);\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _loadBufferLOD(bufferLODs: Array<IBufferInfo>, indexLOD: number): void {\r\n const bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n this._loader.log(`Loading buffer range [${bufferLOD.start}-${bufferLOD.end}]`);\r\n this._loader.bin!.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(\r\n (data) => {\r\n bufferLOD.loaded.resolve(data);\r\n },\r\n (error) => {\r\n bufferLOD.loaded.reject(error);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Gets an array of LOD properties from lowest to highest.\r\n * @param context\r\n * @param property\r\n * @param array\r\n * @param ids\r\n */\r\n private _getLODs<T>(context: string, property: T, array: ArrayLike<T> | undefined, ids: number[]): T[] {\r\n if (this.maxLODsToLoad <= 0) {\r\n throw new Error(\"maxLODsToLoad must be greater than zero\");\r\n }\r\n\r\n const properties = new Array<T>();\r\n\r\n for (let i = ids.length - 1; i >= 0; i--) {\r\n properties.push(ArrayItem.Get(`${context}/ids/${ids[i]}`, array, ids[i]));\r\n if (properties.length === this.maxLODsToLoad) {\r\n return properties;\r\n }\r\n }\r\n\r\n properties.push(property);\r\n return properties;\r\n }\r\n\r\n private _disposeTransformNode(babylonTransformNode: TransformNode): void {\r\n const babylonMaterials = new Array<Material>();\r\n const babylonMaterial = (babylonTransformNode as Mesh).material;\r\n if (babylonMaterial) {\r\n babylonMaterials.push(babylonMaterial);\r\n }\r\n for (const babylonMesh of babylonTransformNode.getChildMeshes()) {\r\n if (babylonMesh.material) {\r\n babylonMaterials.push(babylonMesh.material);\r\n }\r\n }\r\n\r\n babylonTransformNode.dispose();\r\n\r\n const babylonMaterialsToDispose = babylonMaterials.filter((babylonMaterial) => this._loader.babylonScene.meshes.every((mesh) => mesh.material != babylonMaterial));\r\n this._disposeMaterials(babylonMaterialsToDispose);\r\n }\r\n\r\n private _disposeMaterials(babylonMaterials: Material[]): void {\r\n const babylonTextures: { [uniqueId: number]: BaseTexture } = {};\r\n\r\n for (const babylonMaterial of babylonMaterials) {\r\n for (const babylonTexture of babylonMaterial.getActiveTextures()) {\r\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\r\n }\r\n\r\n babylonMaterial.dispose();\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n for (const babylonMaterial of this._loader.babylonScene.materials) {\r\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\r\n delete babylonTextures[uniqueId];\r\n }\r\n }\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n babylonTextures[uniqueId].dispose();\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_lod(loader));\r\n"]}
@@ -1,24 +1,23 @@
1
1
  import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
2
  import { GLTFLoader } from "../glTFLoader.js";
3
- var NAME = "MSFT_minecraftMesh";
3
+ const NAME = "MSFT_minecraftMesh";
4
4
  /** @hidden */
5
- var MSFT_minecraftMesh = /** @class */ (function () {
6
- function MSFT_minecraftMesh(loader) {
5
+ export class MSFT_minecraftMesh {
6
+ constructor(loader) {
7
7
  this.name = NAME;
8
8
  this._loader = loader;
9
9
  this.enabled = this._loader.isExtensionUsed(NAME);
10
10
  }
11
- MSFT_minecraftMesh.prototype.dispose = function () {
11
+ dispose() {
12
12
  this._loader = null;
13
- };
14
- MSFT_minecraftMesh.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
15
- var _this = this;
16
- return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {
13
+ }
14
+ loadMaterialPropertiesAsync(context, material, babylonMaterial) {
15
+ return GLTFLoader.LoadExtraAsync(context, material, this.name, (extraContext, extra) => {
17
16
  if (extra) {
18
17
  if (!(babylonMaterial instanceof PBRMaterial)) {
19
- throw new Error("".concat(extraContext, ": Material type not supported"));
18
+ throw new Error(`${extraContext}: Material type not supported`);
20
19
  }
21
- var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
20
+ const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
22
21
  if (babylonMaterial.needAlphaBlending()) {
23
22
  babylonMaterial.forceDepthWrite = true;
24
23
  babylonMaterial.separateCullingPass = true;
@@ -29,9 +28,7 @@ var MSFT_minecraftMesh = /** @class */ (function () {
29
28
  }
30
29
  return null;
31
30
  });
32
- };
33
- return MSFT_minecraftMesh;
34
- }());
35
- export { MSFT_minecraftMesh };
36
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_minecraftMesh(loader); });
31
+ }
32
+ }
33
+ GLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_minecraftMesh(loader));
37
34
  //# sourceMappingURL=MSFT_minecraftMesh.js.map