@soonspacejs/plugin-atmosphere 2.15.19 → 2.16.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.
Files changed (2) hide show
  1. package/dist/index.esm.js +11 -10
  2. package/package.json +2 -2
package/dist/index.esm.js CHANGED
@@ -11487,6 +11487,7 @@ class Md {
11487
11487
  const { viewport: { scene: t, camera: r, renderer: n } } = e;
11488
11488
  this.date.setHours(10, 0, 0, 0), this.texturesGenerator = new Uu(n), this.arrayBufferLoader = new ua(), this.skyMaterial = new Fr(), this.skyMesh = new na(new aa(2, 2), this.skyMaterial), this.skyMesh.frustumCulled = !1, this.skyLight = new ku(), this.sunLight = new tl(), this.sunLight.shadow.autoUpdate = !1, this.sunLight.shadow.bias = -5e-4, this.sunLight.shadow.normalBias = 0.5, this.sunLight.shadow.camera.near = 0.01, this.sunLight.shadow.mapSize.width = n.capabilities.maxTextureSize, this.sunLight.shadow.mapSize.height = n.capabilities.maxTextureSize, this.aerialPerspectiveEffect = new Z(r), this.aerialPerspective = { effect: this.aerialPerspectiveEffect, enabled: !1 }, this.lensFlareEffect = new gd(), this.lensFlare = { effect: this.lensFlareEffect, enabled: !1 }, this.ditheringEffect = new ad(), this.dithering = { effect: this.ditheringEffect, enabled: !1 }, this.lightingMaskPass = new Au(t, r), this.lightingMaskPass.selectionLayer = Mi, this.cubeRenderTarget = new Po(512, { type: K }), this.cubeCamera = new Lo(0.1, 1e3, this.cubeRenderTarget), this.cloudsEffect = new co(r), this.cloudsEffect.coverage = this.cloudCoverage, this.cloudsEffect.qualityPreset = this.cloudQuality, this.cloudsEffect.localWeatherVelocity.set(1e-3, 0), this.cloudsEffect.events.addEventListener("change", this.onCloudsChange), this.clouds = { effect: this.cloudsEffect, enabled: !1 };
11489
11489
  }
11490
+ ssp;
11490
11491
  cacheKey = "";
11491
11492
  date = /* @__PURE__ */ new Date();
11492
11493
  longitude = 120;
@@ -11552,16 +11553,16 @@ class Md {
11552
11553
  start() {
11553
11554
  if (this._started) return;
11554
11555
  this._started = !0;
11555
- const { scene: e, camera: t, effectManager: r, signals: n } = this.ssp.viewport;
11556
+ const { scene: e, camera: t, effectManager: r, signals: n, autoInstancingManager: a } = this.ssp.viewport;
11556
11557
  (async () => {
11557
- const s = await this.texturesGenerator.update();
11558
- Object.assign(this.skyMaterial, s), this.sunLight.transmittanceTexture = s.transmittanceTexture, this.skyLight.irradianceTexture = s.irradianceTexture, Object.assign(this.aerialPerspectiveEffect, s), Object.assign(this.cloudsEffect, s), this.neesUpdate = !0, this.ssp.render();
11558
+ const c = await this.texturesGenerator.update();
11559
+ Object.assign(this.skyMaterial, c), this.sunLight.transmittanceTexture = c.transmittanceTexture, this.skyLight.irradianceTexture = c.irradianceTexture, Object.assign(this.aerialPerspectiveEffect, c), Object.assign(this.cloudsEffect, c), this.neesUpdate = !0, this.ssp.render();
11559
11560
  })(), e.add(this.skyMesh), e.add(this.skyLight), e.add(this.sunLight), e.add(this.sunLight.target), this.aerialPerspective.enabled = !0, this.aerialPerspectiveEffect.mainCamera = t, this.lensFlare.enabled = !0, this.dithering.enabled = !0, this.cloudsEffect.qualityPreset = this.cloudQuality, this.cloudsEffect.coverage = this.cloudCoverage, this.clouds.enabled = !0;
11560
- const a = r.effectsMap.get("smaaEffect"), o = r.passesMap.get("normalPass");
11561
- a && (a.enabled = !1), o ? (o.enabled = !0, this.aerialPerspectiveEffect.normalBuffer = o.texture, this.aerialPerspectiveEffect.sunLight = !0, this.aerialPerspectiveEffect.skyLight = !0, this.aerialPerspectiveEffect.lightingMask = {
11561
+ const o = r.effectsMap.get("smaaEffect"), s = r.passesMap.get("normalPass");
11562
+ o && (o.enabled = !1), s ? (s.enabled = !0, this.aerialPerspectiveEffect.normalBuffer = s.texture, this.aerialPerspectiveEffect.sunLight = !0, this.aerialPerspectiveEffect.skyLight = !0, this.aerialPerspectiveEffect.lightingMask = {
11562
11563
  map: this.lightingMaskPass.texture,
11563
11564
  channel: "r"
11564
- }) : (this.aerialPerspectiveEffect.normalBuffer = null, this.aerialPerspectiveEffect.sunLight = !1, this.aerialPerspectiveEffect.skyLight = !1, this.aerialPerspectiveEffect.lightingMask = null), this.ssp.setToneMapping({ type: "AGX", exposure: 10 }), e.environment = this.cubeRenderTarget.texture, r.effectsMap.set("cloudsEffect", this.clouds), r.effectsMap.set("aerialPerspectiveEffect", this.aerialPerspective), r.effectsMap.set("lensFlareEffect", this.lensFlare), r.effectsMap.set("ditheringEffect", this.dithering), r.effectsNeedsUpdate = !0, r.effectComposer.addPass(this.lightingMaskPass, -1), n.beforeRender.add(this.update);
11565
+ }) : (this.aerialPerspectiveEffect.normalBuffer = null, this.aerialPerspectiveEffect.sunLight = !1, this.aerialPerspectiveEffect.skyLight = !1, this.aerialPerspectiveEffect.lightingMask = null), this.ssp.setToneMapping({ type: "AGX", exposure: 10 }), e.environment = this.cubeRenderTarget.texture, r.effectsMap.set("cloudsEffect", this.clouds), r.effectsMap.set("aerialPerspectiveEffect", this.aerialPerspective), r.effectsMap.set("lensFlareEffect", this.lensFlare), r.effectsMap.set("ditheringEffect", this.dithering), r.effectsNeedsUpdate = !0, r.effectComposer.addPass(this.lightingMaskPass, -1), n.beforeRender.add(this.update), a.markBeforeRenderListenerSafe(this.update);
11565
11566
  }
11566
11567
  updateModelLightingMask() {
11567
11568
  this._started && this.ssp.viewport.scener.intersectsList.meshOfModelList.forEach((e) => {
@@ -11603,13 +11604,13 @@ class Md {
11603
11604
  stop() {
11604
11605
  if (!this._started) return;
11605
11606
  this._started = !1;
11606
- const { scene: e, effectManager: t, signals: r } = this.ssp.viewport;
11607
+ const { scene: e, effectManager: t, signals: r, autoInstancingManager: n } = this.ssp.viewport;
11607
11608
  e.remove(this.skyMesh), e.remove(this.skyLight), e.remove(this.sunLight), e.remove(this.sunLight.target), this.aerialPerspective.enabled = !1, this.lensFlare.enabled = !1, this.dithering.enabled = !1, this.clouds.enabled = !1;
11608
- const n = t.effectsMap.get("smaaEffect"), a = t.passesMap.get("normalPass");
11609
- n && (n.enabled = !0), a && (a.enabled = !1), this.ssp.setToneMapping({ type: "ACESFilmic", exposure: 0.8 }), this.ssp.setEnvironment(), t.effectsMap.delete("cloudsEffect"), t.effectsMap.delete("aerialPerspectiveEffect"), t.effectsMap.delete("lensFlareEffect"), t.effectsMap.delete("ditheringEffect"), t.effectsNeedsUpdate = !0, t.effectComposer.removePass(this.lightingMaskPass), r.beforeRender.remove(this.update), this.ssp.render();
11609
+ const a = t.effectsMap.get("smaaEffect"), o = t.passesMap.get("normalPass");
11610
+ a && (a.enabled = !0), o && (o.enabled = !1), this.ssp.setToneMapping({ type: "ACESFilmic", exposure: 0.8 }), this.ssp.setEnvironment(), t.effectsMap.delete("cloudsEffect"), t.effectsMap.delete("aerialPerspectiveEffect"), t.effectsMap.delete("lensFlareEffect"), t.effectsMap.delete("ditheringEffect"), t.effectsNeedsUpdate = !0, t.effectComposer.removePass(this.lightingMaskPass), r.beforeRender.remove(this.update), n.unmarkBeforeRenderListenerSafe(this.update), this.ssp.render();
11610
11611
  }
11611
11612
  dispose() {
11612
- this.stop(), this.aerialPerspectiveEffect.dispose(), this.lensFlareEffect.dispose(), this.ditheringEffect.dispose(), this.cloudsEffect.dispose(), this.lightingMaskPass.dispose(), this.texturesGenerator.dispose(), this.skyMesh.geometry.dispose(), this.skyMesh.material.dispose(), this.skyLight.dispose(), this.sunLight.dispose(), this.cubeRenderTarget.dispose();
11613
+ this.stop(), this.ssp.viewport.autoInstancingManager.unmarkBeforeRenderListenerSafe(this.update), this.aerialPerspectiveEffect.dispose(), this.lensFlareEffect.dispose(), this.ditheringEffect.dispose(), this.cloudsEffect.dispose(), this.lightingMaskPass.dispose(), this.texturesGenerator.dispose(), this.skyMesh.geometry.dispose(), this.skyMesh.material.dispose(), this.skyLight.dispose(), this.sunLight.dispose(), this.cubeRenderTarget.dispose();
11613
11614
  }
11614
11615
  }
11615
11616
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-atmosphere",
3
3
  "pluginName": "AtmospherePlugin",
4
- "version": "2.15.19",
4
+ "version": "2.16.0",
5
5
  "description": "Atmosphere plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -15,7 +15,7 @@
15
15
  "license": "UNLICENSED",
16
16
  "gitHead": "4a87dd85050651088e11c3da777c49fab3db7e5d",
17
17
  "peerDependencies": {
18
- "soonspacejs": "2.15.19"
18
+ "soonspacejs": "2.16.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@takram/three-atmosphere": "0.18.0",