@xviewer.js/core 1.0.0-alpha.37 → 1.0.0-alpha.39

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 CHANGED
@@ -1410,7 +1410,11 @@ class CinestationBrain extends Component {
1410
1410
  lastUpdate(dt) {
1411
1411
  let vcam = this.getActiveCamera();
1412
1412
  if (vcam == null) return;
1413
- this._vcams.forEach((v)=>v.enabled = v === vcam);
1413
+ this._vcams.forEach((v)=>{
1414
+ if (!v.locked) {
1415
+ v.enabled = v === vcam;
1416
+ }
1417
+ });
1414
1418
  if (this._lerpTime < this.brainBlend.time) {
1415
1419
  this._lerpTime += dt;
1416
1420
  let t = clamp$4(this._lerpTime / this.brainBlend.time, 0, 1);
@@ -1439,7 +1443,7 @@ class CinestationBrain extends Component {
1439
1443
  }
1440
1444
  }
1441
1445
  getActiveCamera() {
1442
- return this._vcamSolo || this._vcams.filter((v)=>v.enabled).sort((a, b)=>b.priority - a.priority)[0];
1446
+ return this._vcamSolo || this._vcams.filter((v)=>v.enabled || v.locked).sort((a, b)=>b.priority - a.priority)[0];
1443
1447
  }
1444
1448
  _lerpToMainCamera(vcam, t) {
1445
1449
  const from = this.node, to = vcam;
@@ -1512,6 +1516,7 @@ class VirtualCamera extends Component {
1512
1516
  super(...args);
1513
1517
  this._finalPosition = new three.Vector3();
1514
1518
  this._finalRotation = new three.Quaternion();
1519
+ this.locked = false;
1515
1520
  this.priority = 10;
1516
1521
  this.lens = new Lens();
1517
1522
  this.correctPosition = new three.Vector3();
@@ -2803,9 +2808,10 @@ class FreelookVirtualCamera extends VirtualCamera {
2803
2808
  this._targetPhi = clamp(this._targetPhi, this.phiMin, this.phiMax);
2804
2809
  this._targetSpringLength = clamp(this._targetSpringLength, this.distanceMin, this.distanceMax);
2805
2810
  }
2806
- gotoPOI({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
2811
+ gotoPOI({ duration = -1, easing = Easing.Cubic.InOut, springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing }) {
2807
2812
  this._targetFov = fov;
2808
2813
  this._tempSmoothing = smoothing;
2814
+ this._targetLookAt.copy(lookAt);
2809
2815
  this._targetSpringLength = springLength;
2810
2816
  this._targetPhi = phi;
2811
2817
  this._targetTheta = theta;
@@ -2813,7 +2819,27 @@ class FreelookVirtualCamera extends VirtualCamera {
2813
2819
  const theta0 = three.MathUtils.euclideanModulo(this._spherical.theta, PI2);
2814
2820
  const theta1 = theta0 - PI2;
2815
2821
  this._spherical.theta = abs(theta0 - this._targetTheta) < abs(theta1 - this._targetTheta) ? theta0 : theta1;
2816
- this._targetLookAt.copy(lookAt);
2822
+ if (duration > 0) {
2823
+ this.locked = true;
2824
+ this.enabled = false;
2825
+ this.viewer.killTweensOf(this);
2826
+ this.viewer.timeline(this).to({
2827
+ springLength,
2828
+ theta,
2829
+ phi,
2830
+ lookAt,
2831
+ fov
2832
+ }, duration, {
2833
+ easing,
2834
+ onUpdate: ()=>{
2835
+ this.node.position.setFromSpherical(this._spherical).add(this._lookAt);
2836
+ this.node.lookAt(this._lookAt);
2837
+ }
2838
+ }).call(()=>{
2839
+ this.locked = false;
2840
+ this.enabled = true;
2841
+ }).start();
2842
+ }
2817
2843
  }
2818
2844
  update(dt) {
2819
2845
  const smoothing = this._tempSmoothing;
@@ -5233,7 +5259,7 @@ class EnvironmentPlugin extends Plugin {
5233
5259
  const cubeRenderTarget = viewer.createCubeRenderTarget(resolution, false, floatType, 0, true);
5234
5260
  this._cubeCamera = new three.CubeCamera(near || viewer.camera.near, far || viewer.camera.far, cubeRenderTarget);
5235
5261
  this._cubeCamera.position.copy(position);
5236
- this._cubeCamera.layers.set(layer);
5262
+ this._cubeCamera.layers.mask = layer;
5237
5263
  const reflectMap = cubeRenderTarget.texture;
5238
5264
  this._reflectPass = new MergeRefectPass({
5239
5265
  viewer,