rayzee 7.12.1 → 7.14.0

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-169%20KB-blue)](https://www.npmjs.com/package/rayzee)
4
+ [![minzipped size](https://img.shields.io/badge/minzipped-169.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
@@ -7013,7 +7013,7 @@ var ic = class {
7013
7013
  return r;
7014
7014
  }
7015
7015
  addDirectionalLight(e) {
7016
- if (e.intensity <= 0) return;
7016
+ if (!e.visible || e.intensity <= 0) return;
7017
7017
  e.updateMatrixWorld();
7018
7018
  let t = e.getWorldPosition(new rn()), n;
7019
7019
  if (e.target) {
@@ -7042,7 +7042,7 @@ var ic = class {
7042
7042
  });
7043
7043
  }
7044
7044
  addRectAreaLight(e) {
7045
- if (e.intensity <= 0) return;
7045
+ if (!e.visible || e.intensity <= 0) return;
7046
7046
  e.updateMatrixWorld();
7047
7047
  let t = e.getWorldPosition(new rn()), n = e.getWorldQuaternion(new Ft()), r = e.getWorldScale(new rn()), i = e.width * r.x * .5, a = e.height * r.y * .5, o = new rn(i, 0, 0).applyQuaternion(n), s = new rn(0, -a, 0).applyQuaternion(n), c = this.calculateLightImportance(e, "area"), l = e.userData?.normalize ?? !0 ? 1 : 0, u = Number.isFinite(e.userData?.spread) ? e.userData.spread : Math.PI, d = +(e.userData?.shape === "ellipse" || e.userData?.shape === "disk" || e.userData?.shape === 1), f = rc(e);
7048
7048
  this.areaLightCache.push({
@@ -7069,7 +7069,7 @@ var ic = class {
7069
7069
  });
7070
7070
  }
7071
7071
  addPointLight(e) {
7072
- if (e.intensity <= 0) return;
7072
+ if (!e.visible || e.intensity <= 0) return;
7073
7073
  e.updateMatrixWorld();
7074
7074
  let t = e.getWorldPosition(new rn()), n = this.calculateLightImportance(e, "point"), r = rc(e);
7075
7075
  this.pointLightCache.push({
@@ -7089,7 +7089,7 @@ var ic = class {
7089
7089
  });
7090
7090
  }
7091
7091
  addSpotLight(e) {
7092
- if (e.intensity <= 0) return;
7092
+ if (!e.visible || e.intensity <= 0) return;
7093
7093
  e.updateMatrixWorld();
7094
7094
  let t = e.getWorldPosition(new rn()), n = (e.target ? e.target.getWorldPosition(new rn()) : new rn(0, 0, -1)).sub(t).normalize(), r = this.calculateLightImportance(e, "spot"), i = e.userData?.gobo, a = i && Number.isInteger(i.index) ? i.index : -1, o = i && typeof i.intensity == "number" ? i.intensity : 1, s = i && i.inverted ? -Math.abs(o) : Math.abs(o), c = e.userData?.ies, l = c && Number.isInteger(c.index) ? c.index : -1, u = c && typeof c.intensity == "number" ? c.intensity : 1, d = rc(e);
7095
7095
  this.spotLightCache.push({
@@ -14526,6 +14526,7 @@ var rf = {
14526
14526
  uuid: e.uuid,
14527
14527
  name: e.name,
14528
14528
  type: e.type,
14529
+ visible: e.visible,
14529
14530
  intensity: e.intensity,
14530
14531
  color: `#${e.color.getHexString()}`,
14531
14532
  position: [
@@ -16142,7 +16143,7 @@ var Yf = {
16142
16143
  } catch (e) {
16143
16144
  console.warn("PathTracerApp: prior canvas owner dispose failed", e);
16144
16145
  }
16145
- rp.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._container = t.container || null, this.settings = new cf(X), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this._maxTextureSize = X.maxTextureSize, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.goboManager = null, this.iesManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new tp(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.completion = new Sd(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1;
16146
+ rp.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._container = t.container || null, this.settings = new cf(X), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this._maxTextureSize = X.maxTextureSize, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.goboManager = null, this.iesManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new tp(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Sd(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1;
16146
16147
  }
16147
16148
  _addTrackedListener(e, t, n) {
16148
16149
  e && (e.addEventListener(t, n), this._trackedListeners.push({
@@ -16306,7 +16307,7 @@ var Yf = {
16306
16307
  if (this._loadingInProgress) throw Error("PathTracerApp: another load is already in progress");
16307
16308
  this._loadingInProgress = !0;
16308
16309
  try {
16309
- await e(), this._clearAppendedModels(), this._syncControlsAfterLoad(), await this.loadSceneData(), this.pipeline?.eventBus.emit("autoexposure:resetHistory"), this.reset(), this.cameraManager.currentCameraIndex = 0, this.dispatchEvent(t), this.dispatchEvent({
16310
+ await e(), this._emissiveSamplingUserSet = !1, this._clearAppendedModels(), this._syncControlsAfterLoad(), await this.loadSceneData(), this.pipeline?.eventBus.emit("autoexposure:resetHistory"), this.reset(), this.cameraManager.currentCameraIndex = 0, this.dispatchEvent(t), this.dispatchEvent({
16310
16311
  type: "CamerasUpdated",
16311
16312
  cameras: this.cameraManager.cameras,
16312
16313
  cameraNames: this.cameraManager.getCameraNames()
@@ -16336,7 +16337,11 @@ var Yf = {
16336
16337
  progress: 95
16337
16338
  }), await n, this.stages.pathTracer.environment.applyCDFResults());
16338
16339
  let r = this.getSceneMinY();
16339
- return this.settings.set("groundProjectionLevel", r, { reset: !1 }), this.settings.set("groundCatcherHeight", r, { reset: !1 }), e.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), e.end("Apply settings"), e.print(), rr(), this._initAnimationAndTransforms(), this.dispatchEvent({ type: "SceneRebuild" }), !0;
16340
+ if (this.settings.set("groundProjectionLevel", r, { reset: !1 }), this.settings.set("groundCatcherHeight", r, { reset: !1 }), !this._emissiveSamplingUserSet) {
16341
+ let e = (this._sdf?.emissiveTriangleCount ?? 0) > 0;
16342
+ this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
16343
+ }
16344
+ return e.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), e.end("Apply settings"), e.print(), rr(), this._initAnimationAndTransforms(), this.dispatchEvent({ type: "SceneRebuild" }), !0;
16340
16345
  }
16341
16346
  _tagPrimarySceneObject() {
16342
16347
  let e = this.assetLoader?.targetModel;
@@ -16517,6 +16522,12 @@ var Yf = {
16517
16522
  }
16518
16523
  this.reset();
16519
16524
  }
16525
+ setEmissiveTriangleSampling(e) {
16526
+ this._emissiveSamplingUserSet = !0, this.settings.set("enableEmissiveTriangleSampling", e);
16527
+ }
16528
+ hasEmissiveGeometry() {
16529
+ return (this._sdf?.emissiveTriangleCount ?? 0) > 0;
16530
+ }
16520
16531
  setMeshVisibility(e, t) {
16521
16532
  this.stages.pathTracer?.updateMeshVisibility(e, t), this.reset();
16522
16533
  }