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