@xviewer.js/core 1.0.5-alhpa.0 → 1.0.5-alhpa.1
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/dist/main.cjs +14 -10
- package/dist/main.cjs.map +1 -1
- package/dist/module.js +14 -10
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/TaskManager.d.ts +1 -0
- package/types/asset/ResourceManager.d.ts +3 -0
package/dist/main.cjs
CHANGED
|
@@ -4368,6 +4368,9 @@ function _getMipBlurMaterial(lodMax, width, height) {
|
|
|
4368
4368
|
}
|
|
4369
4369
|
|
|
4370
4370
|
class TaskManager {
|
|
4371
|
+
get isComplete() {
|
|
4372
|
+
return this._taskIndex >= this._tasks.length;
|
|
4373
|
+
}
|
|
4371
4374
|
destroy() {
|
|
4372
4375
|
this._tasks = [];
|
|
4373
4376
|
this._taskIndex = 0;
|
|
@@ -4500,6 +4503,9 @@ class ResourceManager {
|
|
|
4500
4503
|
}
|
|
4501
4504
|
return settings;
|
|
4502
4505
|
}
|
|
4506
|
+
get isComplete() {
|
|
4507
|
+
return this._loaded >= this._totalCount;
|
|
4508
|
+
}
|
|
4503
4509
|
destroy() {
|
|
4504
4510
|
this._loaders.clear();
|
|
4505
4511
|
}
|
|
@@ -4524,6 +4530,7 @@ class ResourceManager {
|
|
|
4524
4530
|
...props,
|
|
4525
4531
|
onProgress,
|
|
4526
4532
|
onLoad: (asset)=>{
|
|
4533
|
+
this._loaded++;
|
|
4527
4534
|
this._resources.set(url, asset);
|
|
4528
4535
|
resolve(asset);
|
|
4529
4536
|
},
|
|
@@ -4532,6 +4539,7 @@ class ResourceManager {
|
|
|
4532
4539
|
reject(err);
|
|
4533
4540
|
}
|
|
4534
4541
|
});
|
|
4542
|
+
this._totalCount++;
|
|
4535
4543
|
} else {
|
|
4536
4544
|
reject("ResourceManager.loadAsset: missing loader for " + sel);
|
|
4537
4545
|
}
|
|
@@ -4543,6 +4551,8 @@ class ResourceManager {
|
|
|
4543
4551
|
constructor(viewer){
|
|
4544
4552
|
this._loaders = new Map();
|
|
4545
4553
|
this._resources = new Map();
|
|
4554
|
+
this._loaded = 0;
|
|
4555
|
+
this._totalCount = 0;
|
|
4546
4556
|
this._viewer = viewer;
|
|
4547
4557
|
}
|
|
4548
4558
|
}
|
|
@@ -4757,9 +4767,9 @@ class Viewer extends EventEmitter {
|
|
|
4757
4767
|
}
|
|
4758
4768
|
}
|
|
4759
4769
|
loop(dt) {
|
|
4760
|
-
if (
|
|
4770
|
+
if (this._resourceManager.isComplete) {
|
|
4761
4771
|
this._taskManager.update();
|
|
4762
|
-
if (
|
|
4772
|
+
if (this._taskManager.isComplete) {
|
|
4763
4773
|
this._running = true;
|
|
4764
4774
|
}
|
|
4765
4775
|
}
|
|
@@ -5170,14 +5180,8 @@ class Viewer extends EventEmitter {
|
|
|
5170
5180
|
this._renderer.sortObjects = sortObjects;
|
|
5171
5181
|
this._targetFrameRate = targetFrameRate;
|
|
5172
5182
|
this._windowSize = typeof resize === "function" ? resize : resize === ResizeMode.AUTO ? this._windowSize : null;
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
cb && cb();
|
|
5176
|
-
};
|
|
5177
|
-
this._taskManager = new TaskManager(()=>complete(()=>this._tasking = false, tasker.onComplete), tasker.onProgress, tasker.onError);
|
|
5178
|
-
this._taskManager.onStart = ()=>this._tasking = true;
|
|
5179
|
-
this._loadingManager = new THREE.LoadingManager(()=>complete(()=>this._loading = false, loader.onComplete), loader.onProgress, loader.onError);
|
|
5180
|
-
this._loadingManager.onStart = ()=>this._loading = true;
|
|
5183
|
+
this._taskManager = new TaskManager(tasker.onComplete, tasker.onProgress, tasker.onError);
|
|
5184
|
+
this._loadingManager = new THREE.LoadingManager(loader.onComplete, loader.onProgress, loader.onError);
|
|
5181
5185
|
this._resourceManager = new ResourceManager(this);
|
|
5182
5186
|
this._componentManager = new ComponentManager(this);
|
|
5183
5187
|
this._resourceOptions = {
|