@needle-tools/engine 2.67.0-pre → 2.67.1-pre

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/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.67.1-pre] - 2023-03-28
8
+ - Fix: PostProcessing failing to be re-applied after exit XR
9
+
7
10
  ## [2.67.0-pre] - 2023-03-27
8
11
  - Add: `this.gameObject.destroy` as a shorthand for `GameObject.destroy(this.gameObject)`
9
12
  - Add: support for camera `targetTexture` to render into a RenderTexture (when assigned to e.g. the main camera in Unity)
@@ -26956,7 +26956,7 @@ const QB = class {
26956
26956
  let e = A.targets;
26957
26957
  e || (e = this.targetBuffer, e[0] = this.context.scene);
26958
26958
  let t = A.results;
26959
- t || (this.defaultRaycastOptions.results || (this.defaultRaycastOptions.results = new Array()), t = this.defaultRaycastOptions.results), A.layerMask !== void 0 ? (A.layerMask instanceof wt ? I.layers.mask = A.layerMask.mask : I.layers.mask = A.layerMask, console.log(I.layers.mask, A.layerMask)) : (I.layers.enableAll(), I.layers.disable(2)), t.length = 0, I.intersectObjects(e, A.recursive, t);
26959
+ t || (this.defaultRaycastOptions.results || (this.defaultRaycastOptions.results = new Array()), t = this.defaultRaycastOptions.results), A.layerMask !== void 0 ? A.layerMask instanceof wt ? I.layers.mask = A.layerMask.mask : I.layers.mask = A.layerMask : (I.layers.enableAll(), I.layers.disable(2)), t.length = 0, I.intersectObjects(e, A.recursive, t);
26960
26960
  const C = A.ignore;
26961
26961
  return C !== void 0 && C.length > 0 && (t = t.filter((o) => !C.includes(o.object))), t;
26962
26962
  }
@@ -68659,26 +68659,33 @@ class Na extends TA {
68659
68659
  }
68660
68660
  const hR = cA("debugpost"), tw = Symbol("postprocessing-handler");
68661
68661
  class CG {
68662
- constructor() {
68662
+ constructor(A) {
68663
68663
  Q(this, "_composer", null);
68664
68664
  Q(this, "_lastVolumeComponents");
68665
68665
  Q(this, "_effects", []);
68666
+ Q(this, "_isActive", !1);
68667
+ Q(this, "context");
68668
+ this.context = A;
68666
68669
  }
68667
- apply(A, g) {
68668
- this.onApply(A, g);
68670
+ get isActive() {
68671
+ return this._isActive;
68669
68672
  }
68670
- unapply(A) {
68671
- if (this._lastVolumeComponents) {
68673
+ apply(A) {
68674
+ this._isActive = !0, this.onApply(this.context, A);
68675
+ }
68676
+ unapply() {
68677
+ if (this._isActive = !1, this._lastVolumeComponents) {
68672
68678
  for (const I of this._lastVolumeComponents)
68673
68679
  I.unapply();
68674
68680
  this._lastVolumeComponents.length = 0;
68675
68681
  }
68682
+ const A = this.context;
68676
68683
  A[tw] === this && delete A[tw], A.composer === this._composer && (A.composer = null);
68677
68684
  }
68678
- dispose(A) {
68679
- this.unapply(A);
68680
- for (const g of this._effects)
68681
- g.dispose();
68685
+ dispose() {
68686
+ this.unapply();
68687
+ for (const A of this._effects)
68688
+ A.dispose();
68682
68689
  this._effects.length = 0;
68683
68690
  }
68684
68691
  onApply(A, g) {
@@ -72217,7 +72224,7 @@ class rG extends TA {
72217
72224
  constructor() {
72218
72225
  super(...arguments);
72219
72226
  Q(this, "sharedProfile");
72220
- Q(this, "_postprocessing", new CG());
72227
+ Q(this, "_postprocessing");
72221
72228
  Q(this, "_effects", []);
72222
72229
  Q(this, "_lastApplyTime");
72223
72230
  Q(this, "_rapidApplyCount", 0);
@@ -72229,34 +72236,29 @@ class rG extends TA {
72229
72236
  I.key === "p" && (console.log("Toggle volume: " + this.name, !this.enabled), this.enabled = !this.enabled);
72230
72237
  }));
72231
72238
  }
72232
- start() {
72233
- this.apply(), this.tryApplyCache();
72234
- }
72235
- onEnable() {
72236
- this.__internalDidAwakeAndStart && this.apply();
72237
- }
72238
72239
  onDisable() {
72239
72240
  var g;
72240
- (g = this._postprocessing) == null || g.unapply(this.context);
72241
+ (g = this._postprocessing) == null || g.unapply();
72241
72242
  }
72242
72243
  onBeforeRender() {
72243
- !this.context.isInXR && this.context.composer && this.context.mainCamera && (this.context.composer.setRenderer(this.context.renderer), this.context.composer.setMainScene(this.context.scene), this.context.composer.setMainCamera(this.context.mainCamera));
72244
+ this.context.mainCamera && (!this._postprocessing || !this._postprocessing.isActive) && this.apply(), !this.context.isInXR && this.context.composer && this.context.mainCamera && (this.context.composer.setRenderer(this.context.renderer), this.context.composer.setMainScene(this.context.scene), this.context.composer.setMainCamera(this.context.mainCamera));
72244
72245
  }
72245
72246
  onDestroy() {
72246
72247
  var g;
72247
- (g = this._postprocessing) == null || g.dispose(this.context);
72248
+ (g = this._postprocessing) == null || g.dispose();
72248
72249
  }
72249
72250
  apply() {
72250
- var I;
72251
- aw && console.log("Apply PostProcessing", this), HE() && (this._lastApplyTime !== void 0 && Date.now() - this._lastApplyTime < 100 && (this._rapidApplyCount++, this._rapidApplyCount === 5 && console.warn("Detected rapid post processing modifications - this might be a bug", this)), this._lastApplyTime = Date.now()), this.unapply(), this._effects.length = 0, (I = this.sharedProfile) != null && I.components && this._effects.push(...this.sharedProfile.components);
72251
+ var I, e;
72252
+ aw && console.log("Apply PostProcessing", this, (I = this.context.mainCamera) == null ? void 0 : I.name), HE() && (this._lastApplyTime !== void 0 && Date.now() - this._lastApplyTime < 100 && (this._rapidApplyCount++, this._rapidApplyCount === 5 && console.warn("Detected rapid post processing modifications - this might be a bug", this)), this._lastApplyTime = Date.now()), this.unapply(), this._effects.length = 0, (e = this.sharedProfile) != null && e.components && this._effects.push(...this.sharedProfile.components);
72252
72253
  const g = this.gameObject.getComponentsInChildren(Xi);
72253
72254
  if (aw && (g != null && g.length) && console.log("Additional", g), g)
72254
- for (const e of g)
72255
- e.active && this._effects.push(e);
72256
- this._effects.length > 0 && this._postprocessing.apply(this.context, this._effects);
72255
+ for (const t of g)
72256
+ t.active && this._effects.push(t);
72257
+ this._effects.length > 0 && (this._postprocessing || (this._postprocessing = new CG(this.context)), this._postprocessing.apply(this._effects));
72257
72258
  }
72258
72259
  unapply() {
72259
- this._postprocessing.unapply(this.context);
72260
+ var g;
72261
+ (g = this._postprocessing) == null || g.unapply();
72260
72262
  }
72261
72263
  tryApplyCache() {
72262
72264
  const g = aX();