@xviewer.js/core 1.0.0-alpha.36 → 1.0.0-alpha.38

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
@@ -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 = 0;
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
  }
@@ -2673,12 +2672,11 @@ class FreelookVirtualCamera extends VirtualCamera {
2673
2672
  reset() {
2674
2673
  this._button = -1;
2675
2674
  this._touchID = -1;
2676
- this._setSpherical(this.node.position, this._lookAt);
2677
- }
2678
- _setSpherical(position, lookAt) {
2679
- const { __posDelta } = FreelookVirtualCamera;
2680
- __posDelta.copy(position).sub(lookAt);
2681
- this._spherical.setFromVector3(__posDelta);
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;
@@ -2833,7 +2831,7 @@ class FreelookVirtualCamera extends VirtualCamera {
2833
2831
  this._touchID = -1;
2834
2832
  this._preLoc0 = new three.Vector2();
2835
2833
  this._preLoc1 = new three.Vector2();
2836
- this._spherical = new three.Spherical();
2834
+ this._spherical = new three.Spherical(1, Math.PI / 2);
2837
2835
  this._lookAt = new three.Vector3();
2838
2836
  this._tempSmoothing = 0;
2839
2837
  this._targetTheta = 0;
@@ -3010,7 +3008,7 @@ class Reflector extends Component {
3010
3008
  const q = new three.Vector4();
3011
3009
  const textureMatrix = new three.Matrix4();
3012
3010
  const virtualCamera = new three.PerspectiveCamera();
3013
- virtualCamera.layers.set(layer);
3011
+ virtualCamera.layers.mask = layer;
3014
3012
  const renderTarget = new three.WebGLRenderTarget(textureWidth, textureHeight, {
3015
3013
  samples: multisample,
3016
3014
  type: three.HalfFloatType,
@@ -4287,7 +4285,9 @@ class ResourceManager {
4287
4285
  texSettings,
4288
4286
  onProgress,
4289
4287
  onLoad,
4290
- onError: reject
4288
+ onError: (e)=>{
4289
+ console.error(`${url} not exist`, e);
4290
+ }
4291
4291
  });
4292
4292
  } else {
4293
4293
  reject("ResourceManager.loadAsset: missing loader for " + ext);
@@ -4729,7 +4729,7 @@ class Viewer extends EventEmitter {
4729
4729
  removeComponent(node, component) {
4730
4730
  return this._componentManager.removeComponent(node, component);
4731
4731
  }
4732
- 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 } = {}) {
4733
4733
  let node = null;
4734
4734
  let ins = getClassInstance(object, args);
4735
4735
  if (ins.isObject3D) {
@@ -4750,6 +4750,9 @@ class Viewer extends EventEmitter {
4750
4750
  this._componentManager.addComponent(node, ins);
4751
4751
  }
4752
4752
  }
4753
+ if (layer) {
4754
+ node.layers.mask = layer;
4755
+ }
4753
4756
  if (scale || position || rotation) {
4754
4757
  applyProps(node, {
4755
4758
  scale,
@@ -5230,7 +5233,7 @@ class EnvironmentPlugin extends Plugin {
5230
5233
  const cubeRenderTarget = viewer.createCubeRenderTarget(resolution, false, floatType, 0, true);
5231
5234
  this._cubeCamera = new three.CubeCamera(near || viewer.camera.near, far || viewer.camera.far, cubeRenderTarget);
5232
5235
  this._cubeCamera.position.copy(position);
5233
- this._cubeCamera.layers.set(layer);
5236
+ this._cubeCamera.layers.mask = layer;
5234
5237
  const reflectMap = cubeRenderTarget.texture;
5235
5238
  this._reflectPass = new MergeRefectPass({
5236
5239
  viewer,