@xviewer.js/core 1.0.0-alpha.53 → 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 +8 -51
- package/dist/main.js.map +1 -1
- package/dist/module.js +8 -51
- 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
|
@@ -1481,19 +1481,13 @@ class Lens {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
1483
|
__decorate([
|
|
1484
|
-
property
|
|
1485
|
-
dir: "lens"
|
|
1486
|
-
})
|
|
1484
|
+
property
|
|
1487
1485
|
], Lens.prototype, "fov", void 0);
|
|
1488
1486
|
__decorate([
|
|
1489
|
-
property
|
|
1490
|
-
dir: "lens"
|
|
1491
|
-
})
|
|
1487
|
+
property
|
|
1492
1488
|
], Lens.prototype, "near", void 0);
|
|
1493
1489
|
__decorate([
|
|
1494
|
-
property
|
|
1495
|
-
dir: "lens"
|
|
1496
|
-
})
|
|
1490
|
+
property
|
|
1497
1491
|
], Lens.prototype, "far", void 0);
|
|
1498
1492
|
class VirtualCamera extends Component {
|
|
1499
1493
|
get finalPosition() {
|
|
@@ -2870,7 +2864,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2870
2864
|
this._touchID = -1;
|
|
2871
2865
|
this._preLoc0 = new Vector2();
|
|
2872
2866
|
this._preLoc1 = new Vector2();
|
|
2873
|
-
this._spherical = new Spherical(
|
|
2867
|
+
this._spherical = new Spherical(2, Math.PI / 2);
|
|
2874
2868
|
this._lookAt = new Vector3();
|
|
2875
2869
|
this._tempSmoothing = 6;
|
|
2876
2870
|
this._tempRotateSmoothing = 8;
|
|
@@ -4259,28 +4253,6 @@ class ResourceManager {
|
|
|
4259
4253
|
let str = path.split("/").pop();
|
|
4260
4254
|
return ext ? str.replace("." + ext, "") : str;
|
|
4261
4255
|
}
|
|
4262
|
-
static _parseURL(uri) {
|
|
4263
|
-
let url = "";
|
|
4264
|
-
let file = null;
|
|
4265
|
-
let ext = "";
|
|
4266
|
-
if (typeof File !== "undefined" && uri instanceof File) {
|
|
4267
|
-
url = uri.name;
|
|
4268
|
-
ext = ResourceManager.extension(url);
|
|
4269
|
-
file = uri;
|
|
4270
|
-
} else if (typeof uri === "object") {
|
|
4271
|
-
url = uri.mainFile.name;
|
|
4272
|
-
ext = ResourceManager.extension(url);
|
|
4273
|
-
file = uri;
|
|
4274
|
-
} else {
|
|
4275
|
-
url += uri;
|
|
4276
|
-
ext = ResourceManager.extension(url);
|
|
4277
|
-
}
|
|
4278
|
-
return {
|
|
4279
|
-
url,
|
|
4280
|
-
file,
|
|
4281
|
-
ext
|
|
4282
|
-
};
|
|
4283
|
-
}
|
|
4284
4256
|
static _getTextureKey(url, settings) {
|
|
4285
4257
|
let keys = [
|
|
4286
4258
|
url
|
|
@@ -4315,9 +4287,9 @@ class ResourceManager {
|
|
|
4315
4287
|
}
|
|
4316
4288
|
loadAsset({ url, ext, onProgress, ...props }) {
|
|
4317
4289
|
return new Promise((resolve, reject)=>{
|
|
4318
|
-
const
|
|
4290
|
+
const ext_ = ResourceManager.extension(url);
|
|
4319
4291
|
const texSettings = ResourceManager._splitTextureSettings(props);
|
|
4320
|
-
const key = ResourceManager._getTextureKey(
|
|
4292
|
+
const key = ResourceManager._getTextureKey(url, texSettings);
|
|
4321
4293
|
let result = this._caches.get(key);
|
|
4322
4294
|
if (result) {
|
|
4323
4295
|
resolve(result);
|
|
@@ -4326,10 +4298,10 @@ class ResourceManager {
|
|
|
4326
4298
|
this._caches.set(key, file);
|
|
4327
4299
|
resolve(file);
|
|
4328
4300
|
};
|
|
4329
|
-
let sel = ext ||
|
|
4301
|
+
let sel = ext || ext_;
|
|
4330
4302
|
if (this._loaders.has(sel)) {
|
|
4331
4303
|
this._loaders.get(sel).load({
|
|
4332
|
-
url
|
|
4304
|
+
url,
|
|
4333
4305
|
texSettings,
|
|
4334
4306
|
onProgress,
|
|
4335
4307
|
onLoad,
|
|
@@ -4744,21 +4716,6 @@ class Viewer extends EventEmitter {
|
|
|
4744
4716
|
addLoader(Loader) {
|
|
4745
4717
|
this._resourceManager.addLoader(Loader);
|
|
4746
4718
|
}
|
|
4747
|
-
async load({ url, ext, onProgress, castShadow = false, receiveShadow = false, ...props }) {
|
|
4748
|
-
const node = await this.loadAsset({
|
|
4749
|
-
url,
|
|
4750
|
-
ext,
|
|
4751
|
-
onProgress
|
|
4752
|
-
});
|
|
4753
|
-
if (castShadow || receiveShadow) {
|
|
4754
|
-
node.userData.meshData.meshes.forEach((v)=>{
|
|
4755
|
-
v.castShadow = castShadow;
|
|
4756
|
-
v.receiveShadow = receiveShadow;
|
|
4757
|
-
});
|
|
4758
|
-
}
|
|
4759
|
-
this.addNode(node, props);
|
|
4760
|
-
return node;
|
|
4761
|
-
}
|
|
4762
4719
|
timeline(target) {
|
|
4763
4720
|
return this._tweenManager.timeline(target);
|
|
4764
4721
|
}
|