Skip to content

Commit 12262c7

Browse files
committed
feat(soba/misc): injectFBO no longer recreates the RenderTarget in a computed
There is no need to re-create the render target in the computed because the parameters we use to create the render target are all untracked. BREAKING CHANGE: `injectFBO` now returns a `WebGLRenderTarget` instead of `Signal<WebGLRenderTarget>`. All consumers should change `injectFBO` usage ```angular-ts // before fbo = injectFBO(); this.fbo(); // after fbo = injectFBO(); this.fbo; ```
1 parent f7ee6a2 commit 12262c7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libs/soba/misc/src/lib/fbo.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function injectFBO(params: () => NgtsFBOParams = () => ({}), { injector }
6565
return _settings;
6666
});
6767

68-
const target = computed(() => {
68+
const target = (() => {
6969
const [{ samples = 0, depth, ...targetSettings }, _width, _height] = [
7070
untracked(settings),
7171
untracked(width),
@@ -85,15 +85,15 @@ export function injectFBO(params: () => NgtsFBOParams = () => ({}), { injector }
8585

8686
target.samples = samples;
8787
return target;
88-
});
88+
})();
8989

9090
effect(() => {
91-
const [{ samples = 0 }, _width, _height, _target] = [settings(), width(), height(), target()];
92-
_target.setSize(_width, _height);
93-
if (samples) _target.samples = samples;
91+
const [{ samples = 0 }, _width, _height] = [settings(), width(), height()];
92+
target.setSize(_width, _height);
93+
if (samples) target.samples = samples;
9494
});
9595

96-
inject(DestroyRef).onDestroy(() => target().dispose());
96+
inject(DestroyRef).onDestroy(() => target.dispose());
9797

9898
return target;
9999
});

0 commit comments

Comments
 (0)