@inweb/viewer-three 26.8.0 → 26.8.1

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.
@@ -1911,11 +1911,12 @@ class LightComponent {
1911
1911
  if (this.viewer.extents.isEmpty()) return;
1912
1912
  const extentsCenter = this.viewer.extents.getCenter(new Vector3);
1913
1913
  const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere).radius;
1914
- this.directionalLight.position.set(.5, .866, 0).multiplyScalar(extentsSize * 2).add(extentsCenter);
1914
+ const front = (new Vector3).copy(this.viewer.camera.up).cross(new Vector3(1, 0, 0)).negate();
1915
+ this.directionalLight.position.copy(this.viewer.camera.up).applyAxisAngle(front, -Math.PI * 30 / 180).multiplyScalar(extentsSize * 2).add(extentsCenter);
1915
1916
  this.directionalLight.target.position.copy(extentsCenter);
1916
- this.frontLight.position.set(0, 0, 1).multiplyScalar(extentsSize * 2).add(extentsCenter);
1917
+ this.frontLight.position.copy(front).multiplyScalar(extentsSize * 2).add(extentsCenter);
1917
1918
  this.frontLight.target.position.copy(extentsCenter);
1918
- this.hemisphereLight.position.set(0, 0, 1).multiplyScalar(extentsSize * 3).add(extentsCenter);
1919
+ this.hemisphereLight.position.copy(front).multiplyScalar(extentsSize * 3).add(extentsCenter);
1919
1920
  this.viewer.scene.add(this.ambientLight);
1920
1921
  this.viewer.scene.add(this.directionalLight);
1921
1922
  this.viewer.scene.add(this.frontLight);