@xviewer.js/core 1.0.0-alpha.51 → 1.0.0-alpha.53
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 +12 -4
- package/dist/main.js.map +1 -1
- package/dist/module.js +12 -4
- package/dist/module.js.map +1 -1
- package/package.json +2 -2
- package/types/Viewer.d.ts +3 -0
package/dist/module.js
CHANGED
|
@@ -2718,6 +2718,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2718
2718
|
} else if (e.deltaY < 0) {
|
|
2719
2719
|
this._targetSpringLength *= this._calculateDistanceScale(0.85);
|
|
2720
2720
|
}
|
|
2721
|
+
this._calculateTargetSpringArm();
|
|
2721
2722
|
}
|
|
2722
2723
|
_onTouchStart(e) {
|
|
2723
2724
|
if (!SystemInfo.isMobile) return;
|
|
@@ -2744,6 +2745,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2744
2745
|
__center.copy(__loc0).add(__loc1).multiplyScalar(0.5);
|
|
2745
2746
|
this._calculatePanDelta(__panDelta, __preCenter, __center);
|
|
2746
2747
|
this._calculateTargetLookAt(__panDelta);
|
|
2748
|
+
this._calculateTargetSpringArm();
|
|
2747
2749
|
this._preLoc0.copy(__loc0);
|
|
2748
2750
|
this._preLoc1.copy(__loc1);
|
|
2749
2751
|
} else if (touches.length > 0) {
|
|
@@ -2765,7 +2767,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2765
2767
|
_calculateRotatelDelta(out, loc0, loc1) {
|
|
2766
2768
|
this._tempRotateSmoothing = this.rotateSmoothing;
|
|
2767
2769
|
const domElement = this.viewer.canvas;
|
|
2768
|
-
out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.
|
|
2770
|
+
out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.clientHeight);
|
|
2769
2771
|
out.y = -out.y;
|
|
2770
2772
|
if (this.forbidX) {
|
|
2771
2773
|
out.x = 0;
|
|
@@ -2778,7 +2780,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2778
2780
|
_calculatePanDelta(out, loc0, loc1) {
|
|
2779
2781
|
this._tempRotateSmoothing = this.rotateSmoothing;
|
|
2780
2782
|
const domElement = this.viewer.canvas;
|
|
2781
|
-
out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.
|
|
2783
|
+
out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.clientHeight);
|
|
2782
2784
|
if (this.forbidPanX) {
|
|
2783
2785
|
out.x = 0;
|
|
2784
2786
|
}
|
|
@@ -2871,7 +2873,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2871
2873
|
this._spherical = new Spherical(1, Math.PI / 2);
|
|
2872
2874
|
this._lookAt = new Vector3();
|
|
2873
2875
|
this._tempSmoothing = 6;
|
|
2874
|
-
this._tempRotateSmoothing =
|
|
2876
|
+
this._tempRotateSmoothing = 8;
|
|
2875
2877
|
this._targetTheta = 0;
|
|
2876
2878
|
this._targetPhi = 0;
|
|
2877
2879
|
this._targetSpringLength = 1;
|
|
@@ -2886,7 +2888,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2886
2888
|
this.panSpeed = 1;
|
|
2887
2889
|
this.rotateSpeed = 1;
|
|
2888
2890
|
this.smoothing = 5;
|
|
2889
|
-
this.rotateSmoothing =
|
|
2891
|
+
this.rotateSmoothing = 8;
|
|
2890
2892
|
this.phiMin = ESP;
|
|
2891
2893
|
this.phiMax = Math.PI - ESP;
|
|
2892
2894
|
this.thetaMin = -Infinity;
|
|
@@ -4559,6 +4561,9 @@ class Viewer extends EventEmitter {
|
|
|
4559
4561
|
static getMesh(node, name, group = false) {
|
|
4560
4562
|
return Viewer._getObjectValue(node.userData.meshes, name, group);
|
|
4561
4563
|
}
|
|
4564
|
+
get instanceId() {
|
|
4565
|
+
return this._instanceId;
|
|
4566
|
+
}
|
|
4562
4567
|
get root() {
|
|
4563
4568
|
return this._root;
|
|
4564
4569
|
}
|
|
@@ -4611,6 +4616,7 @@ class Viewer extends EventEmitter {
|
|
|
4611
4616
|
this._targetFrameRate = Math.max(0.001, v);
|
|
4612
4617
|
}
|
|
4613
4618
|
destroy() {
|
|
4619
|
+
this.stop();
|
|
4614
4620
|
this._renderer.dispose();
|
|
4615
4621
|
this._taskManager.destroy();
|
|
4616
4622
|
this._resourceManager.destroy();
|
|
@@ -4928,6 +4934,7 @@ class Viewer extends EventEmitter {
|
|
|
4928
4934
|
position: new Vector3(0, 0, 4)
|
|
4929
4935
|
}, targetFrameRate = -1, fixedFrameTime = false, colorSpace = SRGBColorSpace, toneMapping = LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", orientation = Orientation.AUTO, loader = {}, tasker = {}, ...webglOpts } = {}){
|
|
4930
4936
|
super();
|
|
4937
|
+
this._instanceId = Viewer._instanceCount++;
|
|
4931
4938
|
this._dpr = 1;
|
|
4932
4939
|
this._width = 1;
|
|
4933
4940
|
this._height = 1;
|
|
@@ -5002,6 +5009,7 @@ Viewer._shadowCameraKeys = [
|
|
|
5002
5009
|
Viewer.__emtpyObject = {};
|
|
5003
5010
|
Viewer.fullscreenMesh = new Mesh(Viewer.createFullscreenTriangle());
|
|
5004
5011
|
Viewer.fullscreenCamera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
5012
|
+
Viewer._instanceCount = 0;
|
|
5005
5013
|
|
|
5006
5014
|
class MergeRefectPass {
|
|
5007
5015
|
get envMapTarget() {
|