Skip to content

Commit c853b9a

Browse files
committed
chore(postprocessing): clean up postprocessing
1 parent 4f8fd8c commit c853b9a

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

libs/postprocessing/src/lib/effects/depth-of-field.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ type DOFOptions = NonNullable<ConstructorParameters<typeof DepthOfFieldEffect>[1
2626
changeDetection: ChangeDetectionStrategy.OnPush,
2727
})
2828
export class NgtpDepthOfField {
29-
private effectComposer = inject(NgtpEffectComposer);
30-
3129
options = input({} as DOFOptions);
3230

3331
private autoFocus = computed(() => this.options().target != null);
3432

33+
private effectComposer = inject(NgtpEffectComposer);
34+
3535
effect = computed(() => {
3636
const [camera, options, autoFocus] = [this.effectComposer.camera(), this.options(), this.autoFocus()];
3737

libs/postprocessing/src/lib/effects/glitch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export type GlitchOptions = NonNullable<ConstructorParameters<typeof GlitchEffec
2424
changeDetection: ChangeDetectionStrategy.OnPush,
2525
})
2626
export class NgtpGlitch {
27-
private store = injectStore();
28-
private invalidate = this.store.select('invalidate');
29-
3027
options = input({ active: true } as GlitchOptions, { transform: mergeInputs({ active: true }) });
3128

3229
private active = pick(this.options, 'active');
@@ -37,6 +34,9 @@ export class NgtpGlitch {
3734
private chromaticAberrationOffset = vector2(this.options, 'chromaticAberrationOffset');
3835
private strength = vector2(this.options, 'strength');
3936

37+
private store = injectStore();
38+
private invalidate = this.store.select('invalidate');
39+
4040
effect = computed(() => {
4141
const [
4242
{ ratio, dtSize, columns, blendFunction, perturbationMap },

libs/postprocessing/src/lib/effects/god-rays.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ type GodRaysOptions = ConstructorParameters<typeof GodRaysEffect>[2] & {
2828
schemas: [CUSTOM_ELEMENTS_SCHEMA],
2929
})
3030
export class NgtpGodRays {
31-
private effectComposer = inject(NgtpEffectComposer);
32-
3331
options = input({} as GodRaysOptions);
3432

33+
private effectComposer = inject(NgtpEffectComposer);
34+
3535
effect = computed(() => {
3636
const [camera, { sun, ...options }] = [this.effectComposer.camera(), this.options()];
3737
return new GodRaysEffect(camera, is.ref(sun) ? sun.nativeElement : sun, options);

libs/postprocessing/src/lib/effects/lens-flare.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ const defaultOptions: LensFlareOptions = {
144144
changeDetection: ChangeDetectionStrategy.OnPush,
145145
})
146146
export class NgtpLensFlare {
147+
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
148+
147149
private store = injectStore();
148150
private viewport = this.store.select('viewport');
149151
private raycaster = this.store.select('raycaster');
150152
private pointer = this.store.select('pointer');
151153

152-
effectComposer = inject(NgtpEffectComposer);
153-
154-
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
154+
private effectComposer = inject(NgtpEffectComposer);
155155

156156
private projectedPosition = new Vector3();
157157
private mouse2d = new Vector2();

libs/postprocessing/src/lib/effects/lut.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export interface LUTOptions {
2020
changeDetection: ChangeDetectionStrategy.OnPush,
2121
})
2222
export class NgtpLUT {
23-
private store = injectStore();
24-
private invalidate = this.store.select('invalidate');
25-
2623
options = input({} as LUTOptions);
2724
private lut = pick(this.options, 'lut');
2825

26+
private store = injectStore();
27+
private invalidate = this.store.select('invalidate');
28+
2929
effect = computed(() => {
3030
const [lut, { lut: _, ...options }] = [this.lut(), this.options()];
3131
return new LUT3DEffect(lut, options);

0 commit comments

Comments
 (0)