@xviewer.js/core 1.0.0-alpha.35 → 1.0.0-alpha.37
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 +24 -24
- package/dist/main.js.map +1 -1
- package/dist/module.js +24 -24
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/cinestation/FreelookVirtualCamera.d.ts +0 -2
- package/types/types.d.ts +4 -0
package/dist/main.js
CHANGED
|
@@ -1459,7 +1459,7 @@ class CinestationBrain extends Component {
|
|
|
1459
1459
|
this._vcam = null;
|
|
1460
1460
|
this._vcamSolo = null;
|
|
1461
1461
|
this._vcams = [];
|
|
1462
|
-
this._lerpTime =
|
|
1462
|
+
this._lerpTime = 4;
|
|
1463
1463
|
this.brainBlend = new CinestationBlendDefinition();
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
@@ -1497,12 +1497,11 @@ class VirtualCamera extends Component {
|
|
|
1497
1497
|
return this._finalRotation.copy(this.node.quaternion).multiply(this.correctRotation);
|
|
1498
1498
|
}
|
|
1499
1499
|
onLoad() {
|
|
1500
|
-
this.node.isCamera = true;
|
|
1501
1500
|
const camera = this.viewer.camera;
|
|
1501
|
+
this.node.isCamera = true;
|
|
1502
1502
|
this.lens.fov = camera.fov;
|
|
1503
1503
|
this.lens.near = camera.near;
|
|
1504
1504
|
this.lens.far = camera.far;
|
|
1505
|
-
this.node.position.set(0, 0, 4);
|
|
1506
1505
|
this.brain = this.viewer.getComponent(camera, CinestationBrain, true);
|
|
1507
1506
|
this.brain.addCamera(this);
|
|
1508
1507
|
}
|
|
@@ -2626,7 +2625,8 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2626
2625
|
return this._lookAt;
|
|
2627
2626
|
}
|
|
2628
2627
|
set lookAt(v) {
|
|
2629
|
-
this._lookAt
|
|
2628
|
+
this._lookAt.copy(v);
|
|
2629
|
+
this._targetLookAt.copy(v);
|
|
2630
2630
|
}
|
|
2631
2631
|
get springLength() {
|
|
2632
2632
|
return this._spherical.radius;
|
|
@@ -2672,13 +2672,11 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2672
2672
|
reset() {
|
|
2673
2673
|
this._button = -1;
|
|
2674
2674
|
this._touchID = -1;
|
|
2675
|
-
this.
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
this._spherical.setFromVector3(__posDelta);
|
|
2681
|
-
this._targetSpherical.copy(this._spherical);
|
|
2675
|
+
this._targetTheta = this.theta;
|
|
2676
|
+
this._targetPhi = this.phi;
|
|
2677
|
+
this._targetSpringLength = this.springLength;
|
|
2678
|
+
this._targetLookAt.copy(this._lookAt);
|
|
2679
|
+
this._targetFov = this.lens.fov;
|
|
2682
2680
|
}
|
|
2683
2681
|
_onPointerDown(e) {
|
|
2684
2682
|
if (SystemInfo.isMobile) return;
|
|
@@ -2707,12 +2705,10 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2707
2705
|
this._preLoc0.copy(__loc0);
|
|
2708
2706
|
}
|
|
2709
2707
|
_onMouseWheel(e) {
|
|
2710
|
-
if (
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
this._targetSpringLength *= this._calculateDistanceScale(0.85);
|
|
2715
|
-
}
|
|
2708
|
+
if (e.deltaY > 0) {
|
|
2709
|
+
this._targetSpringLength *= this._calculateDistanceScale(1 / 0.85);
|
|
2710
|
+
} else if (e.deltaY < 0) {
|
|
2711
|
+
this._targetSpringLength *= this._calculateDistanceScale(0.85);
|
|
2716
2712
|
}
|
|
2717
2713
|
}
|
|
2718
2714
|
_onTouchStart(e) {
|
|
@@ -2807,7 +2803,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2807
2803
|
this._targetPhi = clamp(this._targetPhi, this.phiMin, this.phiMax);
|
|
2808
2804
|
this._targetSpringLength = clamp(this._targetSpringLength, this.distanceMin, this.distanceMax);
|
|
2809
2805
|
}
|
|
2810
|
-
gotoPOI({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this.
|
|
2806
|
+
gotoPOI({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
|
|
2811
2807
|
this._targetFov = fov;
|
|
2812
2808
|
this._tempSmoothing = smoothing;
|
|
2813
2809
|
this._targetSpringLength = springLength;
|
|
@@ -2826,7 +2822,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2826
2822
|
this._spherical.radius = FInterpTo(this._spherical.radius, this._targetSpringLength, dt, smoothing);
|
|
2827
2823
|
this.lens.fov = FInterpTo(this.lens.fov, this._targetFov, dt, smoothing);
|
|
2828
2824
|
VInterpTo(this._lookAt, this._targetLookAt, dt, smoothing);
|
|
2829
|
-
this.node.position.setFromSpherical(this._spherical).add(this.
|
|
2825
|
+
this.node.position.setFromSpherical(this._spherical).add(this._lookAt);
|
|
2830
2826
|
this.node.lookAt(this._lookAt);
|
|
2831
2827
|
}
|
|
2832
2828
|
constructor(...args){
|
|
@@ -2835,7 +2831,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2835
2831
|
this._touchID = -1;
|
|
2836
2832
|
this._preLoc0 = new three.Vector2();
|
|
2837
2833
|
this._preLoc1 = new three.Vector2();
|
|
2838
|
-
this._spherical = new three.Spherical();
|
|
2834
|
+
this._spherical = new three.Spherical(1, Math.PI / 2);
|
|
2839
2835
|
this._lookAt = new three.Vector3();
|
|
2840
2836
|
this._tempSmoothing = 0;
|
|
2841
2837
|
this._targetTheta = 0;
|
|
@@ -2843,7 +2839,6 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2843
2839
|
this._targetSpringLength = 1;
|
|
2844
2840
|
this._targetFov = this.fov;
|
|
2845
2841
|
this._targetLookAt = new three.Vector3();
|
|
2846
|
-
this._targetSpherical = new three.Spherical();
|
|
2847
2842
|
this.forbidX = false;
|
|
2848
2843
|
this.forbidY = false;
|
|
2849
2844
|
this.forbidZ = false;
|
|
@@ -3013,7 +3008,7 @@ class Reflector extends Component {
|
|
|
3013
3008
|
const q = new three.Vector4();
|
|
3014
3009
|
const textureMatrix = new three.Matrix4();
|
|
3015
3010
|
const virtualCamera = new three.PerspectiveCamera();
|
|
3016
|
-
virtualCamera.layers.
|
|
3011
|
+
virtualCamera.layers.mask = layer;
|
|
3017
3012
|
const renderTarget = new three.WebGLRenderTarget(textureWidth, textureHeight, {
|
|
3018
3013
|
samples: multisample,
|
|
3019
3014
|
type: three.HalfFloatType,
|
|
@@ -4290,7 +4285,9 @@ class ResourceManager {
|
|
|
4290
4285
|
texSettings,
|
|
4291
4286
|
onProgress,
|
|
4292
4287
|
onLoad,
|
|
4293
|
-
onError:
|
|
4288
|
+
onError: (e)=>{
|
|
4289
|
+
console.error(`${url} not exist`, e);
|
|
4290
|
+
}
|
|
4294
4291
|
});
|
|
4295
4292
|
} else {
|
|
4296
4293
|
reject("ResourceManager.loadAsset: missing loader for " + ext);
|
|
@@ -4732,7 +4729,7 @@ class Viewer extends EventEmitter {
|
|
|
4732
4729
|
removeComponent(node, component) {
|
|
4733
4730
|
return this._componentManager.removeComponent(node, component);
|
|
4734
4731
|
}
|
|
4735
|
-
addNode(object, { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene, ...props } = {}) {
|
|
4732
|
+
addNode(object, { args, debug, scale, position, rotation, layer, shadowArgs, makeDefault, component, parent = this._scene, ...props } = {}) {
|
|
4736
4733
|
let node = null;
|
|
4737
4734
|
let ins = getClassInstance(object, args);
|
|
4738
4735
|
if (ins.isObject3D) {
|
|
@@ -4753,6 +4750,9 @@ class Viewer extends EventEmitter {
|
|
|
4753
4750
|
this._componentManager.addComponent(node, ins);
|
|
4754
4751
|
}
|
|
4755
4752
|
}
|
|
4753
|
+
if (layer) {
|
|
4754
|
+
node.layers.mask = layer;
|
|
4755
|
+
}
|
|
4756
4756
|
if (scale || position || rotation) {
|
|
4757
4757
|
applyProps(node, {
|
|
4758
4758
|
scale,
|