@xviewer.js/core 1.0.0-alpha.36 → 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/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 = 0;
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
  }
@@ -2671,12 +2670,11 @@ class FreelookVirtualCamera extends VirtualCamera {
2671
2670
  reset() {
2672
2671
  this._button = -1;
2673
2672
  this._touchID = -1;
2674
- this._setSpherical(this.node.position, this._lookAt);
2675
- }
2676
- _setSpherical(position, lookAt) {
2677
- const { __posDelta } = FreelookVirtualCamera;
2678
- __posDelta.copy(position).sub(lookAt);
2679
- this._spherical.setFromVector3(__posDelta);
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;
@@ -2831,7 +2829,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2831
2829
  this._touchID = -1;
2832
2830
  this._preLoc0 = new Vector2();
2833
2831
  this._preLoc1 = new Vector2();
2834
- this._spherical = new Spherical();
2832
+ this._spherical = new Spherical(1, Math.PI / 2);
2835
2833
  this._lookAt = new Vector3();
2836
2834
  this._tempSmoothing = 0;
2837
2835
  this._targetTheta = 0;
@@ -3008,7 +3006,7 @@ class Reflector extends Component {
3008
3006
  const q = new Vector4();
3009
3007
  const textureMatrix = new Matrix4();
3010
3008
  const virtualCamera = new PerspectiveCamera();
3011
- virtualCamera.layers.set(layer);
3009
+ virtualCamera.layers.mask = layer;
3012
3010
  const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, {
3013
3011
  samples: multisample,
3014
3012
  type: HalfFloatType,
@@ -4285,7 +4283,9 @@ class ResourceManager {
4285
4283
  texSettings,
4286
4284
  onProgress,
4287
4285
  onLoad,
4288
- onError: reject
4286
+ onError: (e)=>{
4287
+ console.error(`${url} not exist`, e);
4288
+ }
4289
4289
  });
4290
4290
  } else {
4291
4291
  reject("ResourceManager.loadAsset: missing loader for " + ext);
@@ -4727,7 +4727,7 @@ class Viewer extends EventEmitter {
4727
4727
  removeComponent(node, component) {
4728
4728
  return this._componentManager.removeComponent(node, component);
4729
4729
  }
4730
- 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 } = {}) {
4731
4731
  let node = null;
4732
4732
  let ins = getClassInstance(object, args);
4733
4733
  if (ins.isObject3D) {
@@ -4748,6 +4748,9 @@ class Viewer extends EventEmitter {
4748
4748
  this._componentManager.addComponent(node, ins);
4749
4749
  }
4750
4750
  }
4751
+ if (layer) {
4752
+ node.layers.mask = layer;
4753
+ }
4751
4754
  if (scale || position || rotation) {
4752
4755
  applyProps(node, {
4753
4756
  scale,