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