rayzee 7.10.0 → 7.10.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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rayzee Engine
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/rayzee?label=npm)](https://www.npmjs.com/package/rayzee)
4
- [![minzipped size](https://img.shields.io/badge/minzipped-164.9%20KB-blue)](https://www.npmjs.com/package/rayzee)
4
+ [![minzipped size](https://img.shields.io/badge/minzipped-165.1%20KB-blue)](https://www.npmjs.com/package/rayzee)
5
5
  [![downloads](https://img.shields.io/npm/dw/rayzee?label=downloads)](https://www.npmjs.com/package/rayzee)
6
6
  [![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/rayzee?label=jsDelivr)](https://www.jsdelivr.com/package/npm/rayzee)
7
7
 
package/dist/rayzee.es.js CHANGED
@@ -15994,7 +15994,7 @@ var If = {
15994
15994
  for (let r of [...e.children]) r === t || r === n || r.userData?.__rayzeeSceneObject && this.assetLoader.removeModelRoot(r, { external: !!r.userData.__rayzeeExternal });
15995
15995
  }
15996
15996
  async _finishRebuildNoReframe(e) {
15997
- await this.loadSceneData(), this.pipeline?.eventBus.emit("autoexposure:resetHistory"), this.reset(), e && this.dispatchEvent(e);
15997
+ await this.loadSceneData(), this._recalibrateControlLimits(), this.pipeline?.eventBus.emit("autoexposure:resetHistory"), this.reset(), e && this.dispatchEvent(e);
15998
15998
  }
15999
15999
  async addModel(e, { name: t } = {}) {
16000
16000
  if (this._loadingInProgress) throw Error("PathTracerApp.addModel: another load is already in progress");
@@ -16360,6 +16360,18 @@ var If = {
16360
16360
  _syncControlsAfterLoad() {
16361
16361
  this.cameraManager.controls.saveState(), this.cameraManager.controls.update();
16362
16362
  }
16363
+ _recalibrateControlLimits() {
16364
+ if (!this.meshScene || !this.cameraManager) return;
16365
+ let e = new qe(), t = new qe();
16366
+ for (let n of this.meshScene.children) n.userData?.__rayzeeSceneObject && (t.setFromObject(n), t.isEmpty() || e.union(t));
16367
+ if (e.isEmpty()) return;
16368
+ let n = Math.max(e.max.x - e.min.x, e.max.y - e.min.y, e.max.z - e.min.z);
16369
+ if (!Number.isFinite(n) || n <= 0) return;
16370
+ let { camera: r, controls: i } = this.cameraManager, a = r.fov * (Math.PI / 180), o = Math.abs(n / Math.sin(a / 2) / 2);
16371
+ this.cameraManager.currentCameraIndex === 0 && (r.near = n / 100, r.far = n * 100, r.updateProjectionMatrix());
16372
+ let s = r.position.distanceTo(i.target);
16373
+ i.minDistance = Math.min(n / 1e3, s), i.maxDistance = Math.max(o * 10, s * 1.1), i.update();
16374
+ }
16363
16375
  _forwardEvents(e, t) {
16364
16376
  if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
16365
16377
  }