@onerjs/addons 8.42.6 → 8.42.8

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.
@@ -301,6 +301,12 @@ export declare class Atmosphere implements IDisposable {
301
301
  * @param enabled - True to enable the atmosphere, false to disable it.
302
302
  */
303
303
  setEnabled(enabled: boolean): void;
304
+ /**
305
+ * Returns true if the atmosphere is ready for rendering.
306
+ * Note, this will cause a render of the global LUTs if they are not up to date.
307
+ * @returns true if the atmosphere is ready
308
+ */
309
+ isReady(): boolean;
304
310
  /**
305
311
  * The class name of the {@link Atmosphere}.
306
312
  * @returns - The class name of the atmosphere.
@@ -692,11 +692,13 @@ export class Atmosphere {
692
692
  }
693
693
  return null;
694
694
  });
695
+ scene.addIsReadyCheck(this);
695
696
  }
696
697
  /**
697
698
  * @override
698
699
  */
699
700
  dispose() {
701
+ this.scene.removeIsReadyCheck(this);
700
702
  this._onBeforeCameraRenderObserver?.remove();
701
703
  this._onBeforeCameraRenderObserver = null;
702
704
  this._onBeforeDrawPhaseObserver?.remove();
@@ -752,6 +754,46 @@ export class Atmosphere {
752
754
  setEnabled(enabled) {
753
755
  this._isEnabled = enabled;
754
756
  }
757
+ /**
758
+ * Returns true if the atmosphere is ready for rendering.
759
+ * Note, this will cause a render of the global LUTs if they are not up to date.
760
+ * @returns true if the atmosphere is ready
761
+ */
762
+ isReady() {
763
+ if (!this._isEnabled) {
764
+ return true;
765
+ }
766
+ const engine = this._engine;
767
+ const uniformBuffer = this.uniformBuffer;
768
+ const isSkyViewLutEnabled = this._isSkyViewLutEnabled;
769
+ const isLinearSpaceComposition = this._isLinearSpaceComposition;
770
+ const applyApproximateTransmittance = this._applyApproximateTransmittance;
771
+ const depthTexture = this.depthTexture;
772
+ this._skyCompositorEffectWrapper ?? (this._skyCompositorEffectWrapper = CreateSkyCompositorEffectWrapper(engine, uniformBuffer, isSkyViewLutEnabled, isLinearSpaceComposition, applyApproximateTransmittance));
773
+ this._globeAtmosphereCompositorEffectWrapper ?? (this._globeAtmosphereCompositorEffectWrapper = CreateGlobeAtmosphereCompositorEffectWrapper(engine, uniformBuffer, isSkyViewLutEnabled, isLinearSpaceComposition, applyApproximateTransmittance, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias, depthTexture !== null));
774
+ if (depthTexture !== null) {
775
+ this._aerialPerspectiveCompositorEffectWrapper ?? (this._aerialPerspectiveCompositorEffectWrapper = CreateAerialPerspectiveCompositorEffectWrapper(engine, uniformBuffer, this._isAerialPerspectiveLutEnabled, isSkyViewLutEnabled, isLinearSpaceComposition, applyApproximateTransmittance, this._aerialPerspectiveIntensity, this._aerialPerspectiveRadianceBias));
776
+ }
777
+ this.renderGlobalLuts(); // Start rendering of global LUTs during readiness polling.
778
+ if (!this._transmittanceLut?.hasLutData || (this._isDiffuseSkyIrradianceLutEnabled && !this._diffuseSkyIrradianceLut?.hasLutData)) {
779
+ return false;
780
+ }
781
+ if (!this._hasRenderedMultiScatteringLut || this._multiScatteringLutRenderTarget?.isReady() === false || this._multiScatteringEffectWrapper?.isReady() === false) {
782
+ return false;
783
+ }
784
+ if (this._isSkyViewLutEnabled && (this._skyViewLutRenderTarget?.isReady() === false || this._skyViewLutEffectWrapper?.isReady() === false)) {
785
+ return false;
786
+ }
787
+ if (this._isAerialPerspectiveLutEnabled && (this._aerialPerspectiveLutRenderTarget?.isReady() === false || this._aerialPerspectiveLutEffectWrapper?.isReady() === false)) {
788
+ return false;
789
+ }
790
+ if (this._skyCompositorEffectWrapper?.isReady() === false ||
791
+ this._aerialPerspectiveCompositorEffectWrapper?.isReady() === false ||
792
+ this._globeAtmosphereCompositorEffectWrapper?.isReady() === false) {
793
+ return false;
794
+ }
795
+ return true;
796
+ }
755
797
  /**
756
798
  * The class name of the {@link Atmosphere}.
757
799
  * @returns - The class name of the atmosphere.