@xviewer.js/core 1.0.0-alpha.54 → 1.0.0-alpha.55

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.js CHANGED
@@ -4255,28 +4255,6 @@ class ResourceManager {
4255
4255
  let str = path.split("/").pop();
4256
4256
  return ext ? str.replace("." + ext, "") : str;
4257
4257
  }
4258
- static _parseURL(uri) {
4259
- let url = "";
4260
- let file = null;
4261
- let ext = "";
4262
- if (typeof File !== "undefined" && uri instanceof File) {
4263
- url = uri.name;
4264
- ext = ResourceManager.extension(url);
4265
- file = uri;
4266
- } else if (typeof uri === "object") {
4267
- url = uri.mainFile.name;
4268
- ext = ResourceManager.extension(url);
4269
- file = uri;
4270
- } else {
4271
- url += uri;
4272
- ext = ResourceManager.extension(url);
4273
- }
4274
- return {
4275
- url,
4276
- file,
4277
- ext
4278
- };
4279
- }
4280
4258
  static _getTextureKey(url, settings) {
4281
4259
  let keys = [
4282
4260
  url
@@ -4311,9 +4289,9 @@ class ResourceManager {
4311
4289
  }
4312
4290
  loadAsset({ url, ext, onProgress, ...props }) {
4313
4291
  return new Promise((resolve, reject)=>{
4314
- const info = ResourceManager._parseURL(url);
4292
+ const ext_ = ResourceManager.extension(url);
4315
4293
  const texSettings = ResourceManager._splitTextureSettings(props);
4316
- const key = ResourceManager._getTextureKey(info.url, texSettings);
4294
+ const key = ResourceManager._getTextureKey(url, texSettings);
4317
4295
  let result = this._caches.get(key);
4318
4296
  if (result) {
4319
4297
  resolve(result);
@@ -4322,10 +4300,10 @@ class ResourceManager {
4322
4300
  this._caches.set(key, file);
4323
4301
  resolve(file);
4324
4302
  };
4325
- let sel = ext || info.ext;
4303
+ let sel = ext || ext_;
4326
4304
  if (this._loaders.has(sel)) {
4327
4305
  this._loaders.get(sel).load({
4328
- url: info.url,
4306
+ url,
4329
4307
  texSettings,
4330
4308
  onProgress,
4331
4309
  onLoad,
@@ -4740,21 +4718,6 @@ class Viewer extends EventEmitter {
4740
4718
  addLoader(Loader) {
4741
4719
  this._resourceManager.addLoader(Loader);
4742
4720
  }
4743
- async load({ url, ext, onProgress, castShadow = false, receiveShadow = false, ...props }) {
4744
- const node = await this.loadAsset({
4745
- url,
4746
- ext,
4747
- onProgress
4748
- });
4749
- if (castShadow || receiveShadow) {
4750
- node.userData.meshData.meshes.forEach((v)=>{
4751
- v.castShadow = castShadow;
4752
- v.receiveShadow = receiveShadow;
4753
- });
4754
- }
4755
- this.addNode(node, props);
4756
- return node;
4757
- }
4758
4721
  timeline(target) {
4759
4722
  return this._tweenManager.timeline(target);
4760
4723
  }