angular-three-postprocessing 2.0.0-beta.31 → 2.0.0-beta.311

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 (98) hide show
  1. package/README.md +56 -4
  2. package/esm2022/lib/effect-composer.mjs +111 -172
  3. package/esm2022/lib/effect.mjs +43 -71
  4. package/esm2022/lib/effects/ascii.mjs +120 -0
  5. package/esm2022/lib/effects/bloom.mjs +39 -0
  6. package/esm2022/lib/effects/brightness-contrast.mjs +38 -0
  7. package/esm2022/lib/effects/chromatic-abberation.mjs +38 -0
  8. package/esm2022/lib/effects/color-average.mjs +33 -0
  9. package/esm2022/lib/effects/color-depth.mjs +38 -0
  10. package/esm2022/lib/effects/depth-of-field.mjs +56 -0
  11. package/esm2022/lib/effects/depth.mjs +38 -0
  12. package/esm2022/lib/effects/dot-screen.mjs +38 -0
  13. package/esm2022/lib/effects/fxaa.mjs +38 -0
  14. package/esm2022/lib/effects/glitch.mjs +63 -0
  15. package/esm2022/lib/effects/god-rays.mjs +41 -0
  16. package/esm2022/lib/effects/grid.mjs +42 -0
  17. package/esm2022/lib/effects/hue-saturation.mjs +38 -0
  18. package/esm2022/lib/effects/index.mjs +28 -18
  19. package/esm2022/lib/effects/lens-flare.mjs +195 -0
  20. package/esm2022/lib/effects/lut.mjs +50 -0
  21. package/esm2022/lib/effects/noise.mjs +39 -0
  22. package/esm2022/lib/effects/outline.mjs +143 -0
  23. package/esm2022/lib/effects/pixelation.mjs +30 -0
  24. package/esm2022/lib/effects/scanline.mjs +43 -0
  25. package/esm2022/lib/effects/sepia.mjs +38 -0
  26. package/esm2022/lib/effects/shock-wave.mjs +38 -0
  27. package/esm2022/lib/effects/smaa.mjs +38 -0
  28. package/esm2022/lib/effects/tilt-shift-2.mjs +121 -0
  29. package/esm2022/lib/effects/tilt-shift.mjs +39 -0
  30. package/esm2022/lib/effects/vignette.mjs +38 -0
  31. package/esm2022/lib/effects/water.mjs +64 -0
  32. package/fesm2022/angular-three-postprocessing.mjs +1276 -660
  33. package/fesm2022/angular-three-postprocessing.mjs.map +1 -1
  34. package/lib/effect-composer.d.ts +24 -76
  35. package/lib/effect.d.ts +52 -23
  36. package/lib/effects/ascii.d.ts +23 -0
  37. package/lib/effects/bloom.d.ts +10 -0
  38. package/lib/effects/brightness-contrast.d.ts +15 -0
  39. package/lib/effects/chromatic-abberation.d.ts +16 -0
  40. package/lib/effects/color-average.d.ts +11 -0
  41. package/lib/effects/color-depth.d.ts +14 -0
  42. package/lib/effects/depth-of-field.d.ts +22 -0
  43. package/lib/effects/depth.d.ts +14 -0
  44. package/lib/effects/dot-screen.d.ts +15 -0
  45. package/lib/effects/fxaa.d.ts +13 -0
  46. package/lib/effects/glitch.d.ts +29 -0
  47. package/lib/effects/god-rays.d.ts +30 -0
  48. package/lib/effects/grid.d.ts +18 -0
  49. package/lib/effects/hue-saturation.d.ts +15 -0
  50. package/lib/effects/index.d.ts +27 -17
  51. package/lib/effects/lens-flare.d.ts +96 -0
  52. package/lib/effects/lut.d.ts +19 -0
  53. package/lib/effects/noise.d.ts +14 -0
  54. package/lib/effects/outline.d.ts +74 -0
  55. package/lib/effects/pixelation.d.ts +16 -0
  56. package/lib/effects/scanline.d.ts +17 -0
  57. package/lib/effects/sepia.d.ts +14 -0
  58. package/lib/effects/shock-wave.d.ts +11 -0
  59. package/lib/effects/smaa.d.ts +15 -0
  60. package/lib/effects/tilt-shift-2.d.ts +35 -0
  61. package/lib/effects/tilt-shift.d.ts +22 -0
  62. package/lib/effects/vignette.d.ts +17 -0
  63. package/lib/effects/water.d.ts +20 -0
  64. package/package.json +12 -8
  65. package/esm2022/lib/effects/bloom/bloom.mjs +0 -33
  66. package/esm2022/lib/effects/brightness-contrast/brightness-contrast.mjs +0 -29
  67. package/esm2022/lib/effects/color-depth/color-depth.mjs +0 -29
  68. package/esm2022/lib/effects/depth/depth.mjs +0 -29
  69. package/esm2022/lib/effects/dot-screen/dot-screen.mjs +0 -29
  70. package/esm2022/lib/effects/hue-saturation/hue-saturation.mjs +0 -29
  71. package/esm2022/lib/effects/lut/lut.mjs +0 -74
  72. package/esm2022/lib/effects/noise/noise.mjs +0 -33
  73. package/esm2022/lib/effects/pixelation/pixelation.mjs +0 -37
  74. package/esm2022/lib/effects/scanline/scanline.mjs +0 -33
  75. package/esm2022/lib/effects/sepia/sepia.mjs +0 -29
  76. package/esm2022/lib/effects/shock-wave/shock-wave.mjs +0 -29
  77. package/esm2022/lib/effects/smaa/smaa.mjs +0 -29
  78. package/esm2022/lib/effects/ssao/ssao.mjs +0 -217
  79. package/esm2022/lib/effects/tilt-shift/tilt-shift.mjs +0 -33
  80. package/esm2022/lib/effects/tone-mapping/tone-mapping.mjs +0 -29
  81. package/esm2022/lib/effects/vignette/vignette.mjs +0 -29
  82. package/lib/effects/bloom/bloom.d.ts +0 -13
  83. package/lib/effects/brightness-contrast/brightness-contrast.d.ts +0 -15
  84. package/lib/effects/color-depth/color-depth.d.ts +0 -14
  85. package/lib/effects/depth/depth.d.ts +0 -14
  86. package/lib/effects/dot-screen/dot-screen.d.ts +0 -15
  87. package/lib/effects/hue-saturation/hue-saturation.d.ts +0 -15
  88. package/lib/effects/lut/lut.d.ts +0 -29
  89. package/lib/effects/noise/noise.d.ts +0 -15
  90. package/lib/effects/pixelation/pixelation.d.ts +0 -20
  91. package/lib/effects/scanline/scanline.d.ts +0 -15
  92. package/lib/effects/sepia/sepia.d.ts +0 -14
  93. package/lib/effects/shock-wave/shock-wave.d.ts +0 -17
  94. package/lib/effects/smaa/smaa.d.ts +0 -16
  95. package/lib/effects/ssao/ssao.d.ts +0 -42
  96. package/lib/effects/tilt-shift/tilt-shift.d.ts +0 -23
  97. package/lib/effects/tone-mapping/tone-mapping.d.ts +0 -22
  98. package/lib/effects/vignette/vignette.d.ts +0 -17
@@ -1,224 +1,193 @@
1
1
  import * as i0 from '@angular/core';
2
- import { computed, effect, Directive, Input, forwardRef, inject, Injector, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
- import { signalStore, injectNgtRef, injectNgtStore, getLocalState, is, extend, injectBeforeRender, NgtArgs } from 'angular-three';
4
- import { BlendFunction, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, BloomEffect, BrightnessContrastEffect, ColorDepthEffect, DepthEffect, DotScreenEffect, HueSaturationEffect, LUT3DEffect, NoiseEffect, PixelationEffect, ScanlineEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, SSAOEffect, TiltShiftEffect, ToneMappingEffect, VignetteEffect } from 'postprocessing';
5
- import { createInjectionToken } from 'ngxtension/create-injection-token';
6
- import * as THREE from 'three';
7
- import { Group } from 'three';
2
+ import { inject, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, input, Directive, Injector, computed, viewChild, afterNextRender, untracked } from '@angular/core';
3
+ import { injectStore, pick, extend, injectBeforeRender, getLocalState, NgtArgs, vector2, is, NgtSelection, omit, resolveRef } from 'angular-three';
4
+ import { createNoopInjectionToken } from 'ngxtension/create-injection-token';
5
+ import { injectAutoEffect } from 'ngxtension/auto-effect';
6
+ import { mergeInputs } from 'ngxtension/inject-inputs';
7
+ import { EffectAttribute, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, BloomEffect, BlendFunction, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, DepthOfFieldEffect, MaskFunction, DotScreenEffect, FXAAEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, LUT3DEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, TiltShiftEffect, VignetteEffect } from 'postprocessing';
8
+ import { HalfFloatType, Group, NoToneMapping, Uniform, Texture, Color, CanvasTexture, RepeatWrapping, NearestFilter, Vector3, Vector2, Mesh } from 'three';
8
9
  import { isWebGL2Available } from 'three-stdlib';
10
+ import { easing } from 'maath';
9
11
 
10
- class NgtpEffect {
11
- set _blendFunction(blendFunction) {
12
- this.inputs.set({ blendFunction });
13
- }
14
- set _opacity(opacity) {
15
- this.inputs.set({ opacity });
12
+ const [injectDefaultEffectOptions, provideDefaultEffectOptions] = createNoopInjectionToken('Default Effect options');
13
+ class NgtpEffectBlendMode {
14
+ constructor() {
15
+ this.effect = inject(NgtpEffect, { optional: true });
16
16
  }
17
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpEffectBlendMode, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
18
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtpEffectBlendMode, isStandalone: true, selector: "ngtp-effect-blend-mode", ngImport: i0, template: `
19
+ @if (effect) {
20
+ <ngt-value [rawValue]="effect.blendFunction()" attach="blendMode.blendFunction" />
21
+ <ngt-value [rawValue]="effect.opacity()" attach="blendMode.opacity.value" />
22
+ }
23
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpEffectBlendMode, decorators: [{
26
+ type: Component,
27
+ args: [{
28
+ selector: 'ngtp-effect-blend-mode',
29
+ standalone: true,
30
+ template: `
31
+ @if (effect) {
32
+ <ngt-value [rawValue]="effect.blendFunction()" attach="blendMode.blendFunction" />
33
+ <ngt-value [rawValue]="effect.opacity()" attach="blendMode.opacity.value" />
34
+ }
35
+ `,
36
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
37
+ changeDetection: ChangeDetectionStrategy.OnPush,
38
+ }]
39
+ }] });
40
+ class NgtpEffect {
17
41
  constructor() {
18
- this.inputs = signalStore();
19
- this.effectRef = injectNgtRef();
20
- this.defaultBlendFunction = BlendFunction.NORMAL;
21
- this.nativeArgs = () => [];
22
- this.blendFunction = this.inputs.select('blendFunction');
23
- this.opacity = this.inputs.select('opacity');
24
- this.store = injectNgtStore();
42
+ this.defaultEffectOptions = injectDefaultEffectOptions({ optional: true });
43
+ this.blendFunction = input(this.defaultEffectOptions?.blendFunction);
44
+ this.opacity = input(this.defaultEffectOptions?.opacity);
45
+ this.store = injectStore();
25
46
  this.camera = this.store.select('camera');
26
47
  this.invalidate = this.store.select('invalidate');
27
- this.nativeInputs = computed(() => {
28
- const effect = this.effectRef.nativeElement;
29
- if (!effect)
30
- return this.previousInputs || null;
31
- const localState = getLocalState(effect);
32
- if (!localState)
33
- return this.previousInputs || null;
34
- const nativeProps = localState.nativeProps.state();
35
- delete nativeProps['__ngt_dummy_state__'];
36
- if ('camera' in nativeProps) {
37
- delete nativeProps['camera'];
38
- }
39
- if (!Object.keys(nativeProps).length)
40
- return this.previousInputs || null;
41
- return (this.previousInputs = nativeProps);
42
- }, { equal: (a, b) => is.equ(a, b, { objects: 'shallow' }) });
43
- this.args = computed(() => {
44
- const [nativeInputs, nativeArgs] = [this.nativeInputs(), this.nativeArgs()];
45
- if (nativeInputs) {
46
- nativeArgs.push(nativeInputs);
47
- }
48
- return nativeArgs;
49
- });
50
- this.setBlendMode();
51
- }
52
- setBlendMode() {
53
- effect(() => {
54
- const [blendFunction, opacity, effect, invalidate] = [
55
- this.blendFunction(),
56
- this.opacity(),
57
- this.effectRef.nativeElement,
58
- this.invalidate(),
59
- ];
60
- if (!effect)
61
- return;
62
- effect.blendMode.blendFunction =
63
- !blendFunction && blendFunction !== 0 ? this.defaultBlendFunction : blendFunction;
64
- if (opacity !== undefined)
65
- effect.blendMode.opacity.value = opacity;
66
- invalidate();
67
- });
68
48
  }
69
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpEffect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
70
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.3", type: NgtpEffect, inputs: { effectRef: "effectRef", _blendFunction: ["blendFunction", "_blendFunction"], _opacity: ["opacity", "_opacity"] }, ngImport: i0 }); }
71
- }
72
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpEffect, decorators: [{
73
- type: Directive
74
- }], ctorParameters: function () { return []; }, propDecorators: { effectRef: [{
75
- type: Input
76
- }], _blendFunction: [{
77
- type: Input,
78
- args: [{ alias: 'blendFunction' }]
79
- }], _opacity: [{
80
- type: Input,
81
- args: [{ alias: 'opacity' }]
82
- }] } });
83
-
84
- extend({ Group });
85
- const [injectNgtpEffectComposerApi, provideNgtpEffectComposerApi] = createInjectionToken((composer) => composer.api, { isRoot: false, deps: [forwardRef(() => NgtpEffectComposer)] });
49
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpEffect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
50
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtpEffect, isStandalone: true, inputs: { blendFunction: { classPropertyName: "blendFunction", publicName: "blendFunction", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpEffect, decorators: [{
53
+ type: Directive,
54
+ args: [{ standalone: true }]
55
+ }] });
56
+ const NgtpEffectHostDirective = { directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] };
57
+
58
+ const defaultOptions$4 = {
59
+ enabled: true,
60
+ renderPriority: 1,
61
+ autoClear: true,
62
+ multisampling: 8,
63
+ frameBufferType: HalfFloatType,
64
+ };
65
+ function isConvolution(effect) {
66
+ return (effect.getAttributes() & EffectAttribute.CONVOLUTION) === EffectAttribute.CONVOLUTION;
67
+ }
86
68
  class NgtpEffectComposer {
87
- set _enabled(enabled) {
88
- this.inputs.set({ enabled });
89
- }
90
- set _depthBuffer(depthBuffer) {
91
- this.inputs.set({ depthBuffer });
92
- }
93
- set _disableNormalPass(disableNormalPass) {
94
- this.inputs.set({ disableNormalPass });
95
- }
96
- set _stencilBuffer(stencilBuffer) {
97
- this.inputs.set({ stencilBuffer });
98
- }
99
- set _autoClear(autoClear) {
100
- this.inputs.set({ autoClear });
101
- }
102
- set _resolutionScale(resolutionScale) {
103
- this.inputs.set({ resolutionScale });
104
- }
105
- set _multisampling(multisampling) {
106
- this.inputs.set({ multisampling });
107
- }
108
- set _frameBufferType(frameBufferType) {
109
- this.inputs.set({ frameBufferType });
110
- }
111
- set _renderPriority(renderPriority) {
112
- this.inputs.set({ renderPriority });
113
- }
114
- set _camera(camera) {
115
- this.inputs.set({ camera });
116
- }
117
- set _scene(scene) {
118
- this.inputs.set({ scene });
119
- }
120
69
  constructor() {
121
- this.inputs = signalStore({
122
- enabled: true,
123
- renderPriority: 1,
124
- autoClear: true,
125
- multisampling: 8,
126
- frameBufferType: THREE.HalfFloatType,
127
- });
128
- this.composerRef = injectNgtRef();
70
+ this.options = input(defaultOptions$4, { transform: mergeInputs(defaultOptions$4) });
129
71
  this.injector = inject(Injector);
130
- this.store = injectNgtStore();
72
+ this.autoEffect = injectAutoEffect();
73
+ this.store = injectStore();
74
+ this.size = this.store.select('size');
131
75
  this.gl = this.store.select('gl');
132
76
  this.defaultScene = this.store.select('scene');
133
77
  this.defaultCamera = this.store.select('camera');
134
- this.size = this.store.select('size');
135
- this.depthBuffer = this.inputs.select('depthBuffer');
136
- this.stencilBuffer = this.inputs.select('stencilBuffer');
137
- this.multisampling = this.inputs.select('multisampling');
138
- this.frameBufferType = this.inputs.select('frameBufferType');
139
- this.scene = this.inputs.select('scene');
140
- this.camera = this.inputs.select('camera');
141
- this.disableNormalPass = this.inputs.select('disableNormalPass');
142
- this.resolutionScale = this.inputs.select('resolutionScale');
143
- this.autoClear = this.inputs.select('autoClear');
144
- this.activeScene = computed(() => this.scene() || this.defaultScene());
145
- this.activeCamera = computed(() => this.camera() || this.defaultCamera());
146
- this.composerEntities = computed(() => {
78
+ this.depthBuffer = pick(this.options, 'depthBuffer');
79
+ this.stencilBuffer = pick(this.options, 'stencilBuffer');
80
+ this.multisampling = pick(this.options, 'multisampling');
81
+ this.frameBufferType = pick(this.options, 'frameBufferType');
82
+ this.scene = computed(() => this.options().scene ?? this.defaultScene());
83
+ this.camera = computed(() => this.options().camera ?? this.defaultCamera());
84
+ this.enableNormalPass = pick(this.options, 'enableNormalPass');
85
+ this.resolutionScale = pick(this.options, 'resolutionScale');
86
+ this.groupRef = viewChild.required('group');
87
+ this.composerData = computed(() => {
147
88
  const webGL2Available = isWebGL2Available();
148
- const [gl, depthBuffer, stencilBuffer, multisampling, frameBufferType, scene, camera, disableNormalPass, resolutionScale,] = [
89
+ const [gl, scene, camera, depthBuffer, stencilBuffer, multisampling, frameBufferType, enableNormalPass, resolutionScale,] = [
149
90
  this.gl(),
91
+ this.scene(),
92
+ this.camera(),
150
93
  this.depthBuffer(),
151
94
  this.stencilBuffer(),
152
95
  this.multisampling(),
153
96
  this.frameBufferType(),
154
- this.activeScene(),
155
- this.activeCamera(),
156
- this.disableNormalPass(),
97
+ this.enableNormalPass(),
157
98
  this.resolutionScale(),
158
99
  ];
159
- // Initialize composer
160
- const effectComposer = new EffectComposer(gl, {
100
+ // initialize composer
101
+ const composer = new EffectComposer(gl, {
161
102
  depthBuffer,
162
103
  stencilBuffer,
163
104
  multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,
164
105
  frameBufferType,
165
106
  });
166
- // Add render pass
167
- effectComposer.addPass(new RenderPass(scene, camera));
168
- // Create normal pass
107
+ // add render pass
108
+ composer.addPass(new RenderPass(scene, camera));
109
+ // create normal pass
169
110
  let downSamplingPass = null;
170
111
  let normalPass = null;
171
- if (!disableNormalPass) {
112
+ if (enableNormalPass) {
172
113
  normalPass = new NormalPass(scene, camera);
173
114
  normalPass.enabled = false;
174
- effectComposer.addPass(normalPass);
115
+ composer.addPass(normalPass);
175
116
  if (resolutionScale !== undefined && webGL2Available) {
176
117
  downSamplingPass = new DepthDownsamplingPass({ normalBuffer: normalPass.texture, resolutionScale });
177
118
  downSamplingPass.enabled = false;
178
- effectComposer.addPass(downSamplingPass);
119
+ composer.addPass(downSamplingPass);
179
120
  }
180
121
  }
181
- return { effectComposer, normalPass, downSamplingPass };
122
+ return { composer, normalPass, downSamplingPass };
182
123
  });
183
- this.composer = computed(() => this.composerEntities().effectComposer);
184
- this.api = computed(() => {
185
- const [{ effectComposer: composer, normalPass, downSamplingPass }, resolutionScale, camera, scene] = [
186
- this.composerEntities(),
187
- this.resolutionScale(),
188
- this.activeCamera(),
189
- this.activeScene(),
190
- ];
191
- return { composer, normalPass, downSamplingPass, resolutionScale, camera, scene };
124
+ extend({ Group });
125
+ afterNextRender(() => {
126
+ this.disableToneMapping();
127
+ this.setComposerSize();
128
+ this.updatePasses();
129
+ injectBeforeRender(({ delta }) => {
130
+ const [{ composer }, { enabled, autoClear, stencilBuffer }, gl] = [
131
+ this.composerData(),
132
+ this.options(),
133
+ this.gl(),
134
+ ];
135
+ if (enabled) {
136
+ const currentAutoClear = gl.autoClear;
137
+ gl.autoClear = autoClear;
138
+ if (stencilBuffer && !autoClear)
139
+ gl.clearStencil();
140
+ composer.render(delta);
141
+ gl.autoClear = currentAutoClear;
142
+ }
143
+ }, { injector: this.injector, priority: this.options().enabled ? this.options().renderPriority : 0 });
192
144
  });
193
- this.setComposerSize();
194
- this.updatePasses();
195
145
  }
196
- ngOnInit() {
197
- this.beforeRender();
146
+ // NOTE: Disable tone mapping because threejs disallows tonemapping on render targets
147
+ disableToneMapping() {
148
+ this.autoEffect(() => {
149
+ const gl = this.gl();
150
+ const currentTonemapping = gl.toneMapping;
151
+ gl.toneMapping = NoToneMapping;
152
+ return () => {
153
+ gl.toneMapping = currentTonemapping;
154
+ };
155
+ });
198
156
  }
199
157
  setComposerSize() {
200
- effect(() => {
201
- const [composer, size] = [this.composer(), this.size()];
202
- composer.setSize(size.width, size.height);
158
+ this.autoEffect(() => {
159
+ const [{ composer }, { width, height }] = [this.composerData(), this.size()];
160
+ if (composer) {
161
+ composer.setSize(width, height);
162
+ }
203
163
  });
204
164
  }
205
165
  updatePasses() {
206
- effect((onCleanup) => {
207
- const [{ effectComposer: composer, normalPass, downSamplingPass }, instance, children, camera] = [
208
- this.composerEntities(),
209
- this.composerRef.nativeElement,
210
- this.composerRef.children('nonObjects')(),
211
- this.activeCamera(),
166
+ this.autoEffect(() => {
167
+ const [group, { composer, normalPass, downSamplingPass }, camera] = [
168
+ this.groupRef(),
169
+ this.composerData(),
170
+ this.camera(),
212
171
  ];
213
172
  const passes = [];
214
- if (instance && composer && children.length) {
173
+ if (group.nativeElement && composer) {
174
+ const localState = getLocalState(group.nativeElement);
175
+ if (!localState)
176
+ return;
177
+ const children = localState.nonObjects();
215
178
  for (let i = 0; i < children.length; i++) {
216
179
  const child = children[i];
217
180
  if (child instanceof Effect) {
218
- const effects = [];
219
- while (children[i] instanceof Effect)
220
- effects.push(children[i++]);
221
- i--;
181
+ const effects = [child];
182
+ if (!isConvolution(child)) {
183
+ let next = null;
184
+ while ((next = children[i + 1]) instanceof Effect) {
185
+ if (isConvolution(next))
186
+ break;
187
+ effects.push(next);
188
+ i++;
189
+ }
190
+ }
222
191
  const pass = new EffectPass(camera, ...effects);
223
192
  passes.push(pass);
224
193
  }
@@ -226,766 +195,1413 @@ class NgtpEffectComposer {
226
195
  passes.push(child);
227
196
  }
228
197
  }
229
- for (const pass of passes)
198
+ for (const pass of passes) {
230
199
  composer.addPass(pass);
200
+ }
231
201
  if (normalPass)
232
202
  normalPass.enabled = true;
233
203
  if (downSamplingPass)
234
204
  downSamplingPass.enabled = true;
235
205
  }
236
- onCleanup(() => {
206
+ return () => {
237
207
  for (const pass of passes)
238
208
  composer?.removePass(pass);
239
209
  if (normalPass)
240
210
  normalPass.enabled = false;
241
211
  if (downSamplingPass)
242
212
  downSamplingPass.enabled = false;
243
- });
213
+ };
244
214
  });
245
215
  }
246
- beforeRender() {
247
- injectBeforeRender(({ delta }) => {
248
- const [enabled, gl, autoClear, stencilBuffer, composer] = [
249
- this.inputs.get('enabled'),
250
- this.gl(),
251
- this.autoClear(),
252
- this.stencilBuffer(),
253
- this.composer(),
254
- ];
255
- if (enabled) {
256
- const currentAutoClear = gl.autoClear;
257
- gl.autoClear = autoClear;
258
- if (stencilBuffer && !autoClear)
259
- gl.clearStencil();
260
- composer.render(delta);
261
- gl.autoClear = currentAutoClear;
262
- }
263
- }, {
264
- injector: this.injector,
265
- priority: this.inputs.get('enabled') ? this.inputs.get('renderPriority') : 0,
266
- });
267
- }
268
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpEffectComposer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
269
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpEffectComposer, isStandalone: true, selector: "ngtp-effect-composer", inputs: { composerRef: "composerRef", _enabled: ["enabled", "_enabled"], _depthBuffer: ["depthBuffer", "_depthBuffer"], _disableNormalPass: ["disableNormalPass", "_disableNormalPass"], _stencilBuffer: ["stencilBuffer", "_stencilBuffer"], _autoClear: ["autoClear", "_autoClear"], _resolutionScale: ["resolutionScale", "_resolutionScale"], _multisampling: ["multisampling", "_multisampling"], _frameBufferType: ["frameBufferType", "_frameBufferType"], _renderPriority: ["renderPriority", "_renderPriority"], _camera: ["camera", "_camera"], _scene: ["scene", "_scene"] }, providers: [provideNgtpEffectComposerApi()], ngImport: i0, template: `
270
- <ngt-group [ref]="composerRef">
216
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpEffectComposer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
217
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtpEffectComposer, isStandalone: true, selector: "ngtp-effect-composer", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }], ngImport: i0, template: `
218
+ <ngt-group #group>
271
219
  <ng-content />
272
220
  </ngt-group>
273
- `, isInline: true }); }
221
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
274
222
  }
275
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpEffectComposer, decorators: [{
223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpEffectComposer, decorators: [{
276
224
  type: Component,
277
225
  args: [{
278
226
  selector: 'ngtp-effect-composer',
279
227
  standalone: true,
280
228
  template: `
281
- <ngt-group [ref]="composerRef">
229
+ <ngt-group #group>
282
230
  <ng-content />
283
231
  </ngt-group>
284
232
  `,
285
- providers: [provideNgtpEffectComposerApi()],
286
233
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
234
+ changeDetection: ChangeDetectionStrategy.OnPush,
287
235
  }]
288
- }], ctorParameters: function () { return []; }, propDecorators: { composerRef: [{
289
- type: Input
290
- }], _enabled: [{
291
- type: Input,
292
- args: [{ alias: 'enabled' }]
293
- }], _depthBuffer: [{
294
- type: Input,
295
- args: [{ alias: 'depthBuffer' }]
296
- }], _disableNormalPass: [{
297
- type: Input,
298
- args: [{ alias: 'disableNormalPass' }]
299
- }], _stencilBuffer: [{
300
- type: Input,
301
- args: [{ alias: 'stencilBuffer' }]
302
- }], _autoClear: [{
303
- type: Input,
304
- args: [{ alias: 'autoClear' }]
305
- }], _resolutionScale: [{
306
- type: Input,
307
- args: [{ alias: 'resolutionScale' }]
308
- }], _multisampling: [{
309
- type: Input,
310
- args: [{ alias: 'multisampling' }]
311
- }], _frameBufferType: [{
312
- type: Input,
313
- args: [{ alias: 'frameBufferType' }]
314
- }], _renderPriority: [{
315
- type: Input,
316
- args: [{ alias: 'renderPriority' }]
317
- }], _camera: [{
318
- type: Input,
319
- args: [{ alias: 'camera' }]
320
- }], _scene: [{
321
- type: Input,
322
- args: [{ alias: 'scene' }]
323
- }] } });
236
+ }], ctorParameters: () => [] });
237
+
238
+ const fragment = `
239
+ uniform sampler2D uCharacters;
240
+ uniform float uCharactersCount;
241
+ uniform float uCellSize;
242
+ uniform bool uInvert;
243
+ uniform vec3 uColor;
244
+
245
+ const vec2 SIZE = vec2(16.);
246
+
247
+ vec3 greyscale(vec3 color, float strength) {
248
+ float g = dot(color, vec3(0.299, 0.587, 0.114));
249
+ return mix(color, vec3(g), strength);
250
+ }
251
+
252
+ vec3 greyscale(vec3 color) {
253
+ return greyscale(color, 1.0);
254
+ }
255
+
256
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
257
+ vec2 cell = resolution / uCellSize;
258
+ vec2 grid = 1.0 / cell;
259
+ vec2 pixelizedUV = grid * (0.5 + floor(uv / grid));
260
+ vec4 pixelized = texture2D(inputBuffer, pixelizedUV);
261
+ float greyscaled = greyscale(pixelized.rgb).r;
262
+
263
+ if (uInvert) {
264
+ greyscaled = 1.0 - greyscaled;
265
+ }
266
+
267
+ float characterIndex = floor((uCharactersCount - 1.0) * greyscaled);
268
+ vec2 characterPosition = vec2(mod(characterIndex, SIZE.x), floor(characterIndex / SIZE.y));
269
+ vec2 offset = vec2(characterPosition.x, -characterPosition.y) / SIZE;
270
+ vec2 charUV = mod(uv * (cell / SIZE), 1.0 / SIZE) - vec2(0., 1.0 / SIZE) + offset;
271
+ vec4 asciiCharacter = texture2D(uCharacters, charUV);
272
+
273
+ asciiCharacter.rgb = uColor * asciiCharacter.r;
274
+ asciiCharacter.a = pixelized.a;
275
+ outputColor = asciiCharacter;
276
+ }
277
+ `;
278
+ class ASCIIEffect extends Effect {
279
+ constructor({ font = 'arial', characters = ` .:,'-^=*+?!|0#X%WM@`, fontSize = 54, cellSize = 16, color = '#ffffff', invert = false, } = {}) {
280
+ const uniforms = new Map([
281
+ ['uCharacters', new Uniform(new Texture())],
282
+ ['uCellSize', new Uniform(cellSize)],
283
+ ['uCharactersCount', new Uniform(characters.length)],
284
+ ['uColor', new Uniform(new Color(color))],
285
+ ['uInvert', new Uniform(invert)],
286
+ ]);
287
+ super('ASCIIEffect', fragment, { uniforms });
288
+ const charactersTextureUniform = this.uniforms.get('uCharacters');
289
+ if (charactersTextureUniform) {
290
+ charactersTextureUniform.value = this.createCharactersTexture(characters, font, fontSize);
291
+ }
292
+ }
293
+ /** Draws the characters on a Canvas and returns a texture */
294
+ createCharactersTexture(characters, font, fontSize) {
295
+ const canvas = document.createElement('canvas');
296
+ const SIZE = 1024;
297
+ const MAX_PER_ROW = 16;
298
+ const CELL = SIZE / MAX_PER_ROW;
299
+ canvas.width = canvas.height = SIZE;
300
+ const texture = new CanvasTexture(canvas, undefined, RepeatWrapping, RepeatWrapping, NearestFilter, NearestFilter);
301
+ const context = canvas.getContext('2d');
302
+ if (!context) {
303
+ throw new Error('Context not available');
304
+ }
305
+ context.clearRect(0, 0, SIZE, SIZE);
306
+ context.font = `${fontSize}px ${font}`;
307
+ context.textAlign = 'center';
308
+ context.textBaseline = 'middle';
309
+ context.fillStyle = '#fff';
310
+ for (let i = 0; i < characters.length; i++) {
311
+ const char = characters[i];
312
+ const x = i % MAX_PER_ROW;
313
+ const y = Math.floor(i / MAX_PER_ROW);
314
+ context.fillText(char, x * CELL + CELL / 2, y * CELL + CELL / 2);
315
+ }
316
+ texture.needsUpdate = true;
317
+ return texture;
318
+ }
319
+ }
320
+ const defaultOptions$3 = {
321
+ font: 'arial',
322
+ characters: ` .:,'-^=*+?!|0#X%WM@`,
323
+ fontSize: 54,
324
+ cellSize: 16,
325
+ color: '#ffffff',
326
+ invert: false,
327
+ };
328
+ class NgtpASCII {
329
+ constructor() {
330
+ this.options = input(defaultOptions$3, { transform: mergeInputs(defaultOptions$3) });
331
+ this.effect = computed(() => new ASCIIEffect(this.options()));
332
+ }
333
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpASCII, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
334
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpASCII, isStandalone: true, selector: "ngtp-ascii", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
335
+ <ngt-primitive *args="[effect()]" />
336
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
337
+ }
338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpASCII, decorators: [{
339
+ type: Component,
340
+ args: [{
341
+ selector: 'ngtp-ascii',
342
+ standalone: true,
343
+ template: `
344
+ <ngt-primitive *args="[effect()]" />
345
+ `,
346
+ imports: [NgtArgs],
347
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
348
+ changeDetection: ChangeDetectionStrategy.OnPush,
349
+ }]
350
+ }] });
324
351
 
325
352
  extend({ BloomEffect });
326
- class NgtpBloom extends NgtpEffect {
353
+ class NgtpBloom {
327
354
  constructor() {
328
- super(...arguments);
329
- this.defaultBlendFunction = BlendFunction.ADD;
355
+ this.effect = inject(NgtpEffect, { host: true });
356
+ this.options = input({});
330
357
  }
331
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpBloom, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
332
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpBloom, isStandalone: true, selector: "ngtp-bloom", usesInheritance: true, ngImport: i0, template: `
333
- <ngt-bloom-effect ngtCompound *args="args()" [ref]="effectRef" [camera]="camera()">
358
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpBloom, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
359
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpBloom, isStandalone: true, selector: "ngtp-bloom", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
360
+ <ngt-bloom-effect *args="[options()]" [camera]="effect.camera()">
361
+ <ngtp-effect-blend-mode />
334
362
  <ng-content />
335
363
  </ngt-bloom-effect>
336
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
364
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
337
365
  }
338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpBloom, decorators: [{
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpBloom, decorators: [{
339
367
  type: Component,
340
368
  args: [{
341
369
  selector: 'ngtp-bloom',
342
370
  standalone: true,
343
371
  template: `
344
- <ngt-bloom-effect ngtCompound *args="args()" [ref]="effectRef" [camera]="camera()">
372
+ <ngt-bloom-effect *args="[options()]" [camera]="effect.camera()">
373
+ <ngtp-effect-blend-mode />
345
374
  <ng-content />
346
375
  </ngt-bloom-effect>
347
376
  `,
348
- imports: [NgtArgs],
377
+ imports: [NgtArgs, NgtpEffectBlendMode],
349
378
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
379
+ changeDetection: ChangeDetectionStrategy.OnPush,
380
+ hostDirectives: [NgtpEffectHostDirective],
381
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
350
382
  }]
351
383
  }] });
352
384
 
353
385
  extend({ BrightnessContrastEffect });
354
- class NgtpBrightnessContrast extends NgtpEffect {
355
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpBrightnessContrast, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
356
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpBrightnessContrast, isStandalone: true, selector: "ngtp-brightness-contrast", usesInheritance: true, ngImport: i0, template: `
357
- <ngt-brightness-contrast-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
386
+ class NgtpBrightnessContrast {
387
+ constructor() {
388
+ this.effect = inject(NgtpEffect, { host: true });
389
+ this.options = input({});
390
+ }
391
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpBrightnessContrast, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
392
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpBrightnessContrast, isStandalone: true, selector: "ngtp-brightness-contrast", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
393
+ <ngt-brightness-contrast-effect *args="[options()]" [camera]="effect.camera()">
394
+ <ngtp-effect-blend-mode />
358
395
  <ng-content />
359
396
  </ngt-brightness-contrast-effect>
360
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
397
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
361
398
  }
362
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpBrightnessContrast, decorators: [{
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpBrightnessContrast, decorators: [{
363
400
  type: Component,
364
401
  args: [{
365
402
  selector: 'ngtp-brightness-contrast',
366
403
  standalone: true,
367
404
  template: `
368
- <ngt-brightness-contrast-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
405
+ <ngt-brightness-contrast-effect *args="[options()]" [camera]="effect.camera()">
406
+ <ngtp-effect-blend-mode />
369
407
  <ng-content />
370
408
  </ngt-brightness-contrast-effect>
409
+ `,
410
+ imports: [NgtArgs, NgtpEffectBlendMode],
411
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
412
+ changeDetection: ChangeDetectionStrategy.OnPush,
413
+ hostDirectives: [NgtpEffectHostDirective],
414
+ }]
415
+ }] });
416
+
417
+ extend({ ChromaticAberrationEffect });
418
+ class NgtpChromaticAberration {
419
+ constructor() {
420
+ this.effect = inject(NgtpEffect, { host: true });
421
+ this.options = input({});
422
+ }
423
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpChromaticAberration, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
424
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpChromaticAberration, isStandalone: true, selector: "ngtp-chromatic-aberration", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
425
+ <ngt-chromatic-aberration-effect *args="[options()]" [camera]="effect.camera()">
426
+ <ngtp-effect-blend-mode />
427
+ <ng-content />
428
+ </ngt-chromatic-aberration-effect>
429
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
430
+ }
431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpChromaticAberration, decorators: [{
432
+ type: Component,
433
+ args: [{
434
+ selector: 'ngtp-chromatic-aberration',
435
+ template: `
436
+ <ngt-chromatic-aberration-effect *args="[options()]" [camera]="effect.camera()">
437
+ <ngtp-effect-blend-mode />
438
+ <ng-content />
439
+ </ngt-chromatic-aberration-effect>
440
+ `,
441
+ standalone: true,
442
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
443
+ changeDetection: ChangeDetectionStrategy.OnPush,
444
+ imports: [NgtArgs, NgtpEffectBlendMode],
445
+ hostDirectives: [NgtpEffectHostDirective],
446
+ }]
447
+ }] });
448
+
449
+ extend({ ColorAverageEffect });
450
+ class NgtpColorAverage {
451
+ constructor() {
452
+ this.options = input({ blendFunction: BlendFunction.NORMAL }, { transform: mergeInputs({ blendFunction: BlendFunction.NORMAL }) });
453
+ }
454
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpColorAverage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
455
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpColorAverage, isStandalone: true, selector: "ngtp-color-average", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
456
+ <ngt-color-average-effect *args="[options().blendFunction]">
457
+ <ng-content />
458
+ </ngt-color-average-effect>
459
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
460
+ }
461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpColorAverage, decorators: [{
462
+ type: Component,
463
+ args: [{
464
+ selector: 'ngtp-color-average',
465
+ standalone: true,
466
+ template: `
467
+ <ngt-color-average-effect *args="[options().blendFunction]">
468
+ <ng-content />
469
+ </ngt-color-average-effect>
371
470
  `,
372
471
  imports: [NgtArgs],
373
472
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
473
+ changeDetection: ChangeDetectionStrategy.OnPush,
374
474
  }]
375
475
  }] });
376
476
 
377
477
  extend({ ColorDepthEffect });
378
- class NgtpColorDepth extends NgtpEffect {
379
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpColorDepth, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
380
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpColorDepth, isStandalone: true, selector: "ngtp-color-depth", usesInheritance: true, ngImport: i0, template: `
381
- <ngt-color-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
478
+ class NgtpColorDepth {
479
+ constructor() {
480
+ this.effect = inject(NgtpEffect, { host: true });
481
+ this.options = input({});
482
+ }
483
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpColorDepth, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
484
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpColorDepth, isStandalone: true, selector: "ngtp-color-depth", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
485
+ <ngt-color-depth-effect *args="[options()]" [camera]="effect.camera()">
486
+ <ngtp-effect-blend-mode />
382
487
  <ng-content />
383
488
  </ngt-color-depth-effect>
384
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
489
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
385
490
  }
386
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpColorDepth, decorators: [{
491
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpColorDepth, decorators: [{
387
492
  type: Component,
388
493
  args: [{
389
494
  selector: 'ngtp-color-depth',
390
- standalone: true,
391
495
  template: `
392
- <ngt-color-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
496
+ <ngt-color-depth-effect *args="[options()]" [camera]="effect.camera()">
497
+ <ngtp-effect-blend-mode />
393
498
  <ng-content />
394
499
  </ngt-color-depth-effect>
395
500
  `,
396
- imports: [NgtArgs],
501
+ standalone: true,
397
502
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
503
+ changeDetection: ChangeDetectionStrategy.OnPush,
504
+ imports: [NgtArgs, NgtpEffectBlendMode],
505
+ hostDirectives: [NgtpEffectHostDirective],
398
506
  }]
399
507
  }] });
400
508
 
401
509
  extend({ DepthEffect });
402
- class NgtpDepth extends NgtpEffect {
403
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpDepth, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
404
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpDepth, isStandalone: true, selector: "ngtp-depth", usesInheritance: true, ngImport: i0, template: `
405
- <ngt-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
510
+ class NgtpDepth {
511
+ constructor() {
512
+ this.effect = inject(NgtpEffect, { host: true });
513
+ this.options = input({});
514
+ }
515
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpDepth, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
516
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpDepth, isStandalone: true, selector: "ngtp-depth", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
517
+ <ngt-depth-effect *args="[options()]" [camera]="effect.camera()">
518
+ <ngtp-effect-blend-mode />
406
519
  <ng-content />
407
520
  </ngt-depth-effect>
408
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
521
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
409
522
  }
410
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpDepth, decorators: [{
523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpDepth, decorators: [{
411
524
  type: Component,
412
525
  args: [{
413
526
  selector: 'ngtp-depth',
414
- standalone: true,
415
527
  template: `
416
- <ngt-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
528
+ <ngt-depth-effect *args="[options()]" [camera]="effect.camera()">
529
+ <ngtp-effect-blend-mode />
417
530
  <ng-content />
418
531
  </ngt-depth-effect>
419
532
  `,
420
- imports: [NgtArgs],
533
+ standalone: true,
421
534
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
535
+ changeDetection: ChangeDetectionStrategy.OnPush,
536
+ imports: [NgtArgs, NgtpEffectBlendMode],
537
+ hostDirectives: [NgtpEffectHostDirective],
422
538
  }]
423
539
  }] });
424
540
 
541
+ class NgtpDepthOfField {
542
+ constructor() {
543
+ this.autoEffect = injectAutoEffect();
544
+ this.effectComposer = inject(NgtpEffectComposer);
545
+ this.options = input({});
546
+ this.autoFocus = computed(() => this.options().target != null);
547
+ this.effect = computed(() => {
548
+ const [camera, options, autoFocus] = [this.effectComposer.camera(), this.options(), this.autoFocus()];
549
+ const effect = new DepthOfFieldEffect(camera, options);
550
+ // Creating a target enables autofocus, R3F will set via props
551
+ if (autoFocus)
552
+ effect.target = new Vector3();
553
+ // Depth texture for depth picking with optional packing strategy
554
+ if (options.depthTexture) {
555
+ effect.setDepthTexture(options.depthTexture.texture, options.depthTexture.packing);
556
+ }
557
+ // Temporary fix that restores DOF 6.21.3 behavior, everything since then lets shapes leak through the blur
558
+ const maskPass = effect['maskPass'];
559
+ maskPass.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA;
560
+ return effect;
561
+ });
562
+ afterNextRender(() => {
563
+ this.autoEffect(() => {
564
+ const effect = this.effect();
565
+ return () => {
566
+ effect.dispose();
567
+ };
568
+ });
569
+ });
570
+ }
571
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpDepthOfField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
572
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpDepthOfField, isStandalone: true, selector: "ngtp-depth-of-field", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
573
+ <ngt-primitive *args="[effect()]" />
574
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
575
+ }
576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpDepthOfField, decorators: [{
577
+ type: Component,
578
+ args: [{
579
+ selector: 'ngtp-depth-of-field',
580
+ standalone: true,
581
+ template: `
582
+ <ngt-primitive *args="[effect()]" />
583
+ `,
584
+ imports: [NgtArgs],
585
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
586
+ changeDetection: ChangeDetectionStrategy.OnPush,
587
+ }]
588
+ }], ctorParameters: () => [] });
589
+
425
590
  extend({ DotScreenEffect });
426
- class NgtpDotScreen extends NgtpEffect {
427
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpDotScreen, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
428
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpDotScreen, isStandalone: true, selector: "ngtp-dot-screen", usesInheritance: true, ngImport: i0, template: `
429
- <ngt-dot-screen-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
591
+ class NgtpDotScreen {
592
+ constructor() {
593
+ this.effect = inject(NgtpEffect, { host: true });
594
+ this.options = input({});
595
+ }
596
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpDotScreen, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
597
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpDotScreen, isStandalone: true, selector: "ngtp-dot-screen", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
598
+ <ngt-dot-screen-effect *args="[options()]" [camera]="effect.camera()">
599
+ <ngtp-effect-blend-mode />
430
600
  <ng-content />
431
601
  </ngt-dot-screen-effect>
432
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
602
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
433
603
  }
434
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpDotScreen, decorators: [{
604
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpDotScreen, decorators: [{
435
605
  type: Component,
436
606
  args: [{
437
607
  selector: 'ngtp-dot-screen',
438
- standalone: true,
439
608
  template: `
440
- <ngt-dot-screen-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
609
+ <ngt-dot-screen-effect *args="[options()]" [camera]="effect.camera()">
610
+ <ngtp-effect-blend-mode />
441
611
  <ng-content />
442
612
  </ngt-dot-screen-effect>
443
613
  `,
444
- imports: [NgtArgs],
614
+ standalone: true,
615
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
616
+ changeDetection: ChangeDetectionStrategy.OnPush,
617
+ imports: [NgtArgs, NgtpEffectBlendMode],
618
+ hostDirectives: [NgtpEffectHostDirective],
619
+ }]
620
+ }] });
621
+
622
+ extend({ FXAAEffect });
623
+ class NgtpFXAA {
624
+ constructor() {
625
+ this.effect = inject(NgtpEffect, { host: true });
626
+ this.options = input({});
627
+ }
628
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpFXAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
629
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpFXAA, isStandalone: true, selector: "ngtp-fxaa", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
630
+ <ngt-fXAA-effect *args="[options()]" [camera]="effect.camera()">
631
+ <ngtp-effect-blend-mode />
632
+ <ng-content />
633
+ </ngt-fXAA-effect>
634
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
635
+ }
636
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpFXAA, decorators: [{
637
+ type: Component,
638
+ args: [{
639
+ selector: 'ngtp-fxaa',
640
+ template: `
641
+ <ngt-fXAA-effect *args="[options()]" [camera]="effect.camera()">
642
+ <ngtp-effect-blend-mode />
643
+ <ng-content />
644
+ </ngt-fXAA-effect>
645
+ `,
646
+ standalone: true,
445
647
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
648
+ changeDetection: ChangeDetectionStrategy.OnPush,
649
+ imports: [NgtArgs, NgtpEffectBlendMode],
650
+ hostDirectives: [NgtpEffectHostDirective],
446
651
  }]
447
652
  }] });
448
653
 
654
+ class NgtpGlitch {
655
+ constructor() {
656
+ this.autoEffect = injectAutoEffect();
657
+ this.store = injectStore();
658
+ this.invalidate = this.store.select('invalidate');
659
+ this.options = input({ active: true }, { transform: mergeInputs({ active: true }) });
660
+ this.active = pick(this.options, 'active');
661
+ this.mode = pick(this.options, 'mode');
662
+ this.delay = vector2(this.options, 'delay');
663
+ this.duration = vector2(this.options, 'duration');
664
+ this.chromaticAberrationOffset = vector2(this.options, 'chromaticAberrationOffset');
665
+ this.strength = vector2(this.options, 'strength');
666
+ this.effect = computed(() => {
667
+ const [{ ratio, dtSize, columns, blendFunction, perturbationMap }, delay, duration, chromaticAberrationOffset, strength,] = [this.options(), this.delay(), this.duration(), this.chromaticAberrationOffset(), this.strength()];
668
+ return new GlitchEffect({
669
+ ratio,
670
+ dtSize,
671
+ columns,
672
+ blendFunction,
673
+ perturbationMap,
674
+ delay,
675
+ duration,
676
+ chromaticAberrationOffset,
677
+ strength,
678
+ });
679
+ });
680
+ afterNextRender(() => {
681
+ this.autoEffect(() => {
682
+ const effect = this.effect();
683
+ return () => effect.dispose();
684
+ });
685
+ this.autoEffect(() => {
686
+ const [effect, invalidate, mode, active] = [this.effect(), this.invalidate(), this.mode(), this.active()];
687
+ effect.mode = active ? mode || GlitchMode.SPORADIC : GlitchMode.DISABLED;
688
+ invalidate();
689
+ });
690
+ });
691
+ }
692
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpGlitch, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
693
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpGlitch, isStandalone: true, selector: "ngtp-glitch", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
694
+ <ngt-primitive *args="[effect()]" />
695
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
696
+ }
697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpGlitch, decorators: [{
698
+ type: Component,
699
+ args: [{
700
+ selector: 'ngtp-glitch',
701
+ standalone: true,
702
+ template: `
703
+ <ngt-primitive *args="[effect()]" />
704
+ `,
705
+ imports: [NgtArgs],
706
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
707
+ changeDetection: ChangeDetectionStrategy.OnPush,
708
+ }]
709
+ }], ctorParameters: () => [] });
710
+
711
+ class NgtpGodRays {
712
+ constructor() {
713
+ this.autoEffect = injectAutoEffect();
714
+ this.effectComposer = inject(NgtpEffectComposer);
715
+ this.options = input({});
716
+ this.effect = computed(() => {
717
+ const [camera, { sun, ...options }] = [this.effectComposer.camera(), this.options()];
718
+ return new GodRaysEffect(camera, is.ref(sun) ? sun.nativeElement : sun, options);
719
+ });
720
+ afterNextRender(() => {
721
+ this.autoEffect(() => {
722
+ const [sun, effect] = [this.options().sun, this.effect()];
723
+ effect.lightSource = is.ref(sun) ? sun.nativeElement : sun;
724
+ });
725
+ });
726
+ }
727
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpGodRays, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
728
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpGodRays, isStandalone: true, selector: "ngtp-god-rays", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
729
+ <ngt-primitive *args="[effect()]" />
730
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
731
+ }
732
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpGodRays, decorators: [{
733
+ type: Component,
734
+ args: [{
735
+ selector: 'ngtp-god-rays',
736
+ standalone: true,
737
+ template: `
738
+ <ngt-primitive *args="[effect()]" />
739
+ `,
740
+ imports: [NgtArgs],
741
+ changeDetection: ChangeDetectionStrategy.OnPush,
742
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
743
+ }]
744
+ }], ctorParameters: () => [] });
745
+
746
+ class NgtpGrid {
747
+ constructor() {
748
+ this.autoEffect = injectAutoEffect();
749
+ this.options = input({});
750
+ this.size = pick(this.options, 'size');
751
+ this.effect = computed(() => {
752
+ const { size: _, ...options } = this.options();
753
+ return new GridEffect(options);
754
+ });
755
+ afterNextRender(() => {
756
+ this.autoEffect(() => {
757
+ const [size, effect] = [this.size(), this.effect()];
758
+ if (size) {
759
+ effect.setSize(size.width, size.height);
760
+ }
761
+ });
762
+ });
763
+ }
764
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
765
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpGrid, isStandalone: true, selector: "ngtp-grid", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
766
+ <ngt-primitive *args="[effect()]" />
767
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
768
+ }
769
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpGrid, decorators: [{
770
+ type: Component,
771
+ args: [{
772
+ selector: 'ngtp-grid',
773
+ standalone: true,
774
+ template: `
775
+ <ngt-primitive *args="[effect()]" />
776
+ `,
777
+ imports: [NgtArgs],
778
+ changeDetection: ChangeDetectionStrategy.OnPush,
779
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
780
+ }]
781
+ }], ctorParameters: () => [] });
782
+
449
783
  extend({ HueSaturationEffect });
450
- class NgtpHueSaturation extends NgtpEffect {
451
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpHueSaturation, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
452
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpHueSaturation, isStandalone: true, selector: "ngtp-hue-saturation", usesInheritance: true, ngImport: i0, template: `
453
- <ngt-hue-saturation-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
784
+ class NgtpHueSaturation {
785
+ constructor() {
786
+ this.effect = inject(NgtpEffect, { host: true });
787
+ this.options = input({});
788
+ }
789
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpHueSaturation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
790
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpHueSaturation, isStandalone: true, selector: "ngtp-hue-saturation", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
791
+ <ngt-hue-saturation-effect *args="[options()]" [camera]="effect.camera()">
792
+ <ngtp-effect-blend-mode />
454
793
  <ng-content />
455
794
  </ngt-hue-saturation-effect>
456
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
795
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
457
796
  }
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpHueSaturation, decorators: [{
797
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpHueSaturation, decorators: [{
459
798
  type: Component,
460
799
  args: [{
461
800
  selector: 'ngtp-hue-saturation',
462
- standalone: true,
463
801
  template: `
464
- <ngt-hue-saturation-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
802
+ <ngt-hue-saturation-effect *args="[options()]" [camera]="effect.camera()">
803
+ <ngtp-effect-blend-mode />
465
804
  <ng-content />
466
805
  </ngt-hue-saturation-effect>
467
806
  `,
468
- imports: [NgtArgs],
807
+ standalone: true,
469
808
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
809
+ changeDetection: ChangeDetectionStrategy.OnPush,
810
+ imports: [NgtArgs, NgtpEffectBlendMode],
811
+ hostDirectives: [NgtpEffectHostDirective],
470
812
  }]
471
813
  }] });
472
814
 
473
- class NgtpLUT {
474
- set _lut(lut) {
475
- this.inputs.set({ lut });
476
- }
477
- set _blendFunction(blendFunction) {
478
- this.inputs.set({ blendFunction });
815
+ // Created by Anderson Mancini 2023
816
+ // React Three Fiber Ultimate LensFlare
817
+ const LensFlareShader = {
818
+ fragmentShader: /* language=glsl glsl */ `
819
+
820
+ uniform float iTime;
821
+ uniform vec2 lensPosition;
822
+ uniform vec2 iResolution;
823
+ uniform vec3 colorGain;
824
+ uniform float starPoints;
825
+ uniform float glareSize;
826
+ uniform float flareSize;
827
+ uniform float flareSpeed;
828
+ uniform float flareShape;
829
+ uniform float haloScale;
830
+ uniform float opacity;
831
+ uniform bool animated;
832
+ uniform bool anamorphic;
833
+ uniform bool enabled;
834
+ uniform bool secondaryGhosts;
835
+ uniform bool starBurst;
836
+ uniform float ghostScale;
837
+ uniform bool aditionalStreaks;
838
+ uniform sampler2D lensDirtTexture;
839
+ vec2 vxtC;
840
+
841
+ float rndf(float n){return fract(sin(n) * 43758.5453123);}float niz(float p){float fl = floor(p);float fc = fract(p);return mix(rndf(fl),rndf(fl + 1.0), fc);}
842
+ vec3 hsv2rgb(vec3 c){vec4 k = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);vec3 p = abs(fract(c.xxx + k.xyz) * 6.0 - k.www);return c.z * mix(k.xxx, clamp(p - k.xxx, 0.0, 1.0), c.y);}
843
+ float satU(float x){return clamp(x, 0.,1.);}vec2 rtU(vec2 naz, float rtn){return vec2(cos(rtn) * naz.x + sin(rtn) * naz.y,cos(rtn) * naz.y - sin(rtn) * naz.x);}
844
+ vec3 drwF(vec2 p, float intensity, float rnd, float speed, int id){float flhos = (1. / 32.) * float(id) * 0.1;float lingrad = distance(vec2(0.), p);float expg = 1. / exp(lingrad * (fract(rnd) * 0.66 + 0.33));vec3 qzTg = hsv2rgb(vec3( fract( (expg * 8.) + speed * flareSpeed + flhos), pow(1.-abs(expg*2.-1.), 0.45), 20.0 * expg * intensity));float internalStarPoints;if(anamorphic){internalStarPoints = 1.0;} else{internalStarPoints = starPoints;}float ams = length(p * flareShape * sin(internalStarPoints * atan(p.x, p.y)));float kJhg = pow(1.-satU(ams), ( anamorphic ? 100. : 12.));kJhg += satU(expg-0.9) * 3.;kJhg = pow(kJhg * expg, 8. + (1.-intensity) * 5.);if(flareSpeed > 0.0){return vec3(kJhg) * qzTg;} else{return vec3(kJhg) * flareSize * 15.;}}
845
+ float ams2(vec3 a, vec3 b) { return abs(a.x - b.x) + abs(a.y - b.y) + abs(a.z - b.z);}vec3 satU(vec3 x){return clamp(x, vec3(0.0), vec3(1.0));}
846
+ float glR(vec2 naz, vec2 pos, float zsi){vec2 mni;if(animated){mni = rtU(naz-pos, iTime * 0.1);} else{mni = naz-pos;}float ang = atan(mni.y, mni.x) * (anamorphic ? 1.0 : starPoints);float ams2 = length(mni);ams2 = pow(ams2, .9);float f0 = 1.0/(length(naz-pos)*(1.0/zsi*16.0)+.2);return f0+f0*(sin((ang))*.2 +.3);}
847
+ float sdHex(vec2 p){p = abs(p);vec2 q = vec2(p.x*2.0*0.5773503, p.y + p.x*0.5773503);return dot(step(q.xy,q.yx), 1.0-q.yx);}float fpow(float x, float k){return x > k ? pow((x-k)/(1.0-k),2.0) : 0.0;}
848
+ vec3 rHx(vec2 naz, vec2 p, float s, vec3 col){naz -= p;if (abs(naz.x) < 0.2*s && abs(naz.y) < 0.2*s){return mix(vec3(0),mix(vec3(0),col,0.1 + fpow(length(naz/s),0.1)*10.0),smoothstep(0.0,0.1,sdHex(naz*20.0/s)));}return vec3(0);}
849
+ vec3 mLs(vec2 naz, vec2 pos){vec2 mni = naz-pos;vec2 zxMp = naz*(length(naz));float ang = atan(mni.x,mni.y);float f0 = .3/(length(naz-pos)*16.0+1.0);f0 = f0*(sin(niz(sin(ang*3.9-(animated ? iTime : 0.0) * 0.3) * starPoints))*.2 );float f1 = max(0.01-pow(length(naz+1.2*pos),1.9),.0)*7.0;float f2 = max(.9/(10.0+32.0*pow(length(zxMp+0.99*pos),2.0)),.0)*0.35;float f22 = max(.9/(11.0+32.0*pow(length(zxMp+0.85*pos),2.0)),.0)*0.23;float f23 = max(.9/(12.0+32.0*pow(length(zxMp+0.95*pos),2.0)),.0)*0.6;vec2 ztX = mix(naz,zxMp, 0.1);float f4 = max(0.01-pow(length(ztX+0.4*pos),2.9),.0)*4.02;float f42 = max(0.0-pow(length(ztX+0.45*pos),2.9),.0)*4.1;float f43 = max(0.01-pow(length(ztX+0.5*pos),2.9),.0)*4.6;ztX = mix(naz,zxMp,-.4);float f5 = max(0.01-pow(length(ztX+0.1*pos),5.5),.0)*2.0;float f52 = max(0.01-pow(length(ztX+0.2*pos),5.5),.0)*2.0;float f53 = max(0.01-pow(length(ztX+0.1*pos),5.5),.0)*2.0;ztX = mix(naz,zxMp, 2.1);float f6 = max(0.01-pow(length(ztX-0.3*pos),1.61),.0)*3.159;float f62 = max(0.01-pow(length(ztX-0.325*pos),1.614),.0)*3.14;float f63 = max(0.01-pow(length(ztX-0.389*pos),1.623),.0)*3.12;vec3 c = vec3(glR(naz,pos, glareSize));vec2 prot;if(animated){prot = rtU(naz - pos, (iTime * 0.1));} else if(anamorphic){prot = rtU(naz - pos, 1.570796);} else {prot = naz - pos;}c += drwF(prot, (anamorphic ? flareSize * 10. : flareSize), 0.1, iTime, 1);c.r+=f1+f2+f4+f5+f6; c.g+=f1+f22+f42+f52+f62; c.b+=f1+f23+f43+f53+f63;c = c*1.3 * vec3(length(zxMp)+.09);c+=vec3(f0);return c;}
850
+ vec3 cc(vec3 clr, float fct,float fct2){float w = clr.x+clr.y+clr.z;return mix(clr,vec3(w)*fct,w*fct2);}float rnd(vec2 p){float f = fract(sin(dot(p, vec2(12.1234, 72.8392) )*45123.2));return f;}float rnd(float w){float f = fract(sin(w)*1000.);return f;}
851
+ float rShp(vec2 p, int N){float f;float a=atan(p.x,p.y)+.2;float b=6.28319/float(N);f=smoothstep(.5,.51, cos(floor(.5+a/b)*b-a)*length(p.xy)* 2.0 -ghostScale);return f;}
852
+ vec3 drC(vec2 p, float zsi, float dCy, vec3 clr, vec3 clr2, float ams2, vec2 esom){float l = length(p + esom*(ams2*2.))+zsi/2.;float l2 = length(p + esom*(ams2*4.))+zsi/3.;float c = max(0.01-pow(length(p + esom*ams2), zsi*ghostScale), 0.0)*10.;float c1 = max(0.001-pow(l-0.3, 1./40.)+sin(l*20.), 0.0)*3.;float c2 = max(0.09/pow(length(p-esom*ams2/.5)*1., .95), 0.0)/20.;float s = max(0.02-pow(rShp(p*5. + esom*ams2*5. + dCy, 6) , 1.), 0.0)*1.5;clr = cos(vec3(0.44, .24, .2)*8. + ams2*4.)*0.5+.5;vec3 f = c*clr;f += c1*clr;f += c2*clr;f += s*clr;return f-0.01;}
853
+ vec4 geLC(float x){return vec4(vec3(mix(mix(mix(mix(mix(mix(mix(mix(mix(mix(mix(mix(mix(mix(mix(vec3(0., 0., 0.),vec3(0., 0., 0.), smoothstep(0.0, 0.063, x)),vec3(0., 0., 0.), smoothstep(0.063, 0.125, x)),vec3(0.0, 0., 0.), smoothstep(0.125, 0.188, x)),vec3(0.188, 0.131, 0.116), smoothstep(0.188, 0.227, x)),vec3(0.31, 0.204, 0.537), smoothstep(0.227, 0.251, x)),vec3(0.192, 0.106, 0.286), smoothstep(0.251, 0.314, x)),vec3(0.102, 0.008, 0.341), smoothstep(0.314, 0.392, x)),vec3(0.086, 0.0, 0.141), smoothstep(0.392, 0.502, x)),vec3(1.0, 0.31, 0.0), smoothstep(0.502, 0.604, x)),vec3(.1, 0.1, 0.1), smoothstep(0.604, 0.643, x)),vec3(1.0, 0.929, 0.0), smoothstep(0.643, 0.761, x)),vec3(1.0, 0.086, 0.424), smoothstep(0.761, 0.847, x)),vec3(1.0, 0.49, 0.0), smoothstep(0.847, 0.89, x)),vec3(0.945, 0.275, 0.475), smoothstep(0.89, 0.941, x)),vec3(0.251, 0.275, 0.796), smoothstep(0.941, 1.0, x))),1.0);}
854
+ float diTN(vec2 p){vec2 f = fract(p);f = (f * f) * (3.0 - (2.0 * f));float n = dot(floor(p), vec2(1.0, 157.0));vec4 a = fract(sin(vec4(n + 0.0, n + 1.0, n + 157.0, n + 158.0)) * 43758.5453123);return mix(mix(a.x, a.y, f.x), mix(a.z, a.w, f.x), f.y);}
855
+ float fbm(vec2 p){const mat2 m = mat2(0.80, -0.60, 0.60, 0.80);float f = 0.0;f += 0.5000*diTN(p); p = m*p*2.02;f += 0.2500*diTN(p); p = m*p*2.03;f += 0.1250*diTN(p); p = m*p*2.01;f += 0.0625*diTN(p);return f/0.9375;}
856
+ vec4 geLS(vec2 p){vec2 pp = (p - vec2(0.5)) * 2.0;float a = atan(pp.y, pp.x);vec4 cp = vec4(sin(a * 1.0), length(pp), sin(a * 13.0), sin(a * 53.0));float d = sin(clamp(pow(length(vec2(0.5) - p) * 0.5 + haloScale /2., 5.0), 0.0, 1.0) * 3.14159);vec3 c = vec3(d) * vec3(fbm(cp.xy * 16.0) * fbm(cp.zw * 9.0) * max(max(max(max(0.5, sin(a * 1.0)), sin(a * 3.0) * 0.8), sin(a * 7.0) * 0.8), sin(a * 9.0) * 10.6));c *= vec3(mix(2.0, (sin(length(pp.xy) * 256.0) * 0.5) + 0.5, sin((clamp((length(pp.xy) - 0.875) / 0.1, 0.0, 1.0) + 0.0) * 2.0 * 3.14159) * 1.5) + 0.5) * 0.3275;return vec4(vec3(c * 1.0), d);}
857
+ vec4 geLD(vec2 p){p.xy += vec2(fbm(p.yx * 3.0), fbm(p.yx * 2.0)) * 0.0825;vec3 o = vec3(mix(0.125, 0.25, max(max(smoothstep(0.1, 0.0, length(p - vec2(0.25))),smoothstep(0.4, 0.0, length(p - vec2(0.75)))),smoothstep(0.8, 0.0, length(p - vec2(0.875, 0.125))))));o += vec3(max(fbm(p * 1.0) - 0.5, 0.0)) * 0.5;o += vec3(max(fbm(p * 2.0) - 0.5, 0.0)) * 0.5;o += vec3(max(fbm(p * 4.0) - 0.5, 0.0)) * 0.25;o += vec3(max(fbm(p * 8.0) - 0.75, 0.0)) * 1.0;o += vec3(max(fbm(p * 16.0) - 0.75, 0.0)) * 0.75;o += vec3(max(fbm(p * 64.0) - 0.75, 0.0)) * 0.5;return vec4(clamp(o, vec3(0.15), vec3(1.0)), 1.0);}
858
+ vec4 txL(sampler2D tex, vec2 xtC){if(((xtC.x < 0.) || (xtC.y < 0.)) || ((xtC.x > 1.) || (xtC.y > 1.))){return vec4(0.0);}else{return texture(tex, xtC); }}
859
+ vec4 txD(sampler2D tex, vec2 xtC, vec2 dir, vec3 ditn) {return vec4(txL(tex, (xtC + (dir * ditn.r))).r,txL(tex, (xtC + (dir * ditn.g))).g,txL(tex, (xtC + (dir * ditn.b))).b,1.0);}
860
+ vec4 strB(){vec2 aspXtc = vec2(1.0) - (((vxtC - vec2(0.5)) * vec2(1.0)) + vec2(0.5)); vec2 xtC = vec2(1.0) - vxtC; vec2 ghvc = (vec2(0.5) - xtC) * 0.3 - lensPosition; vec2 ghNm = normalize(ghvc * vec2(1.0)) * vec2(1.0);vec2 haloVec = normalize(ghvc) * 0.6;vec2 hlNm = ghNm * 0.6;vec2 texelSize = vec2(1.0) / vec2(iResolution.xy);vec3 ditn = vec3(-(texelSize.x * 1.5), 0.2, texelSize.x * 1.5);vec4 c = vec4(0.0);for (int i = 0; i < 8; i++) {vec2 offset = xtC + (ghvc * float(i));c += txD(lensDirtTexture, offset, ghNm, ditn) * pow(max(0.0, 1.0 - (length(vec2(0.5) - offset) / length(vec2(0.5)))), 10.0);}vec2 uyTrz = xtC + hlNm; return (c * geLC((length(vec2(0.5) - aspXtc) / length(vec2(haloScale))))) +(txD(lensDirtTexture, uyTrz, ghNm, ditn) * pow(max(0.0, 1.0 - (length(vec2(0.5) - uyTrz) / length(vec2(0.5)))), 10.0));}
861
+ void mainImage(vec4 v,vec2 r,out vec4 i){vec2 g=r-.5;g.y*=iResolution.y/iResolution.x;vec2 l=lensPosition*.5;l.y*=iResolution.y/iResolution.x;vec3 f=mLs(g,l)*20.*colorGain/256.;if(aditionalStreaks){vec3 o=vec3(.9,.2,.1),p=vec3(.3,.1,.9);for(float n=0.;n<10.;n++)f+=drC(g,pow(rnd(n*2e3)*2.8,.1)+1.41,0.,o+n,p+n,rnd(n*20.)*3.+.2-.5,lensPosition);}if(secondaryGhosts){vec3 n=vec3(0);n+=rHx(g,-lensPosition*.25,ghostScale*1.4,vec3(.25,.35,0));n+=rHx(g,lensPosition*.25,ghostScale*.5,vec3(1,.5,.5));n+=rHx(g,lensPosition*.1,ghostScale*1.6,vec3(1));n+=rHx(g,lensPosition*1.8,ghostScale*2.,vec3(0,.5,.75));n+=rHx(g,lensPosition*1.25,ghostScale*.8,vec3(1,1,.5));n+=rHx(g,-lensPosition*1.25,ghostScale*5.,vec3(.5,.5,.25));n+=fpow(1.-abs(distance(lensPosition*.8,g)-.7),.985)*colorGain/2100.;f+=n;}if(starBurst){vxtC=g+.5;vec4 n=geLD(g);float o=1.-clamp(0.5,0.,.5)*2.;n+=mix(n,pow(n*2.,vec4(2))*.5,o);float s=(g.x+g.y)*(1./6.);vec2 d=mat2(cos(s),-sin(s),sin(s),cos(s))*vxtC;n+=geLS(d)*2.;f+=clamp(n.xyz*strB().xyz,.01,1.);}i=enabled?vec4(mix(f,vec3(0),opacity)+v.xyz,v.w):vec4(v);}
862
+ `,
863
+ };
864
+ class LensFlareEffect extends Effect {
865
+ constructor({ blendFunction = BlendFunction.NORMAL, enabled = true, glareSize = 0.2, lensPosition = [0.01, 0.01], iResolution = [0, 0], starPoints = 6, flareSize = 0.01, flareSpeed = 0.01, flareShape = 0.01, animated = true, anamorphic = false, colorGain = new Color(20, 20, 20), lensDirtTexture = null, haloScale = 0.5, secondaryGhosts = true, aditionalStreaks = true, ghostScale = 0.0, opacity = 1.0, starBurst = false, } = {}) {
866
+ super('LensFlareEffect', LensFlareShader.fragmentShader, {
867
+ blendFunction,
868
+ uniforms: new Map([
869
+ ['enabled', new Uniform(enabled)],
870
+ ['glareSize', new Uniform(glareSize)],
871
+ ['lensPosition', new Uniform(lensPosition)],
872
+ ['iTime', new Uniform(0)],
873
+ ['iResolution', new Uniform(iResolution)],
874
+ ['starPoints', new Uniform(starPoints)],
875
+ ['flareSize', new Uniform(flareSize)],
876
+ ['flareSpeed', new Uniform(flareSpeed)],
877
+ ['flareShape', new Uniform(flareShape)],
878
+ ['animated', new Uniform(animated)],
879
+ ['anamorphic', new Uniform(anamorphic)],
880
+ ['colorGain', new Uniform(colorGain)],
881
+ ['lensDirtTexture', new Uniform(lensDirtTexture)],
882
+ ['haloScale', new Uniform(haloScale)],
883
+ ['secondaryGhosts', new Uniform(secondaryGhosts)],
884
+ ['aditionalStreaks', new Uniform(aditionalStreaks)],
885
+ ['ghostScale', new Uniform(ghostScale)],
886
+ ['starBurst', new Uniform(starBurst)],
887
+ ['opacity', new Uniform(opacity)],
888
+ ]),
889
+ });
479
890
  }
480
- set _tetrahedralInterpolation(tetrahedralInterpolation) {
481
- this.inputs.set({ tetrahedralInterpolation });
891
+ update(_renderer, _inputBuffer, deltaTime) {
892
+ const iTime = this.uniforms.get('iTime');
893
+ if (iTime) {
894
+ iTime.value += deltaTime;
895
+ }
482
896
  }
897
+ }
898
+ const defaultOptions$2 = {
899
+ position: new Vector3(-25, 6, -60),
900
+ followMouse: false,
901
+ smoothTime: 0.7,
902
+ };
903
+ class NgtpLensFlare {
483
904
  constructor() {
484
- this.inputs = signalStore({});
485
- this.effectRef = injectNgtRef();
486
- this.lut = this.inputs.select('lut');
487
- this.tetrahedralInterpolation = this.inputs.select('tetrahedralInterpolation');
488
- this.blendFunction = this.inputs.select('blendFunction');
489
- this.store = injectNgtStore();
490
- this.invalidate = this.store.select('invalidate');
491
- this.effect = computed(() => new LUT3DEffect(this.lut(), {
492
- blendFunction: this.blendFunction(),
493
- tetrahedralInterpolation: this.tetrahedralInterpolation(),
494
- }));
495
- this.setState();
496
- }
497
- setState() {
498
- effect(() => {
499
- const [effect, invalidate, lut, tetrahedralInterpolation] = [
500
- this.effect(),
501
- this.invalidate(),
502
- this.lut(),
503
- this.tetrahedralInterpolation(),
504
- ];
905
+ this.autoEffect = injectAutoEffect();
906
+ this.store = injectStore();
907
+ this.viewport = this.store.select('viewport');
908
+ this.raycaster = this.store.select('raycaster');
909
+ this.pointer = this.store.select('pointer');
910
+ this.effectComposer = inject(NgtpEffectComposer);
911
+ this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
912
+ this.projectedPosition = new Vector3();
913
+ this.mouse2d = new Vector2();
914
+ this.effect = computed(() => {
915
+ const { position: _, followMouse: __, smoothTime: ___, ...options } = this.options();
916
+ return new LensFlareEffect(options);
917
+ });
918
+ afterNextRender(() => {
919
+ this.autoEffect(() => {
920
+ const [effect, viewport] = [this.effect(), this.viewport()];
921
+ const iResolution = effect.uniforms.get('iResolution');
922
+ if (iResolution) {
923
+ iResolution.value.x = viewport.width;
924
+ iResolution.value.y = viewport.height;
925
+ }
926
+ });
927
+ });
928
+ injectBeforeRender(({ delta }) => {
929
+ const [effect] = [this.effect()];
505
930
  if (!effect)
506
931
  return;
507
- if (tetrahedralInterpolation)
508
- effect.tetrahedralInterpolation = tetrahedralInterpolation;
509
- if (lut)
510
- effect.lut = lut;
511
- invalidate();
932
+ const [{ followMouse, position, smoothTime }, pointer, camera, scene, raycaster] = [
933
+ this.options(),
934
+ this.pointer(),
935
+ this.effectComposer.camera(),
936
+ this.effectComposer.scene(),
937
+ this.raycaster(),
938
+ ];
939
+ const uLensPosition = effect.uniforms.get('lensPosition');
940
+ const uOpacity = effect.uniforms.get('opacity');
941
+ if (!uLensPosition || !uOpacity)
942
+ return;
943
+ let target = 1;
944
+ if (followMouse) {
945
+ uLensPosition.value.x = pointer.x;
946
+ uLensPosition.value.y = pointer.y;
947
+ target = 0;
948
+ }
949
+ else {
950
+ this.projectedPosition.copy(position).project(camera);
951
+ if (this.projectedPosition.z > 1)
952
+ return;
953
+ uLensPosition.value.x = this.projectedPosition.x;
954
+ uLensPosition.value.y = this.projectedPosition.y;
955
+ this.mouse2d.set(this.projectedPosition.x, this.projectedPosition.y);
956
+ raycaster.setFromCamera(this.mouse2d, camera);
957
+ const intersects = raycaster.intersectObjects(scene.children, true);
958
+ const { object } = intersects[0] ?? {};
959
+ if (object) {
960
+ if (object.userData?.['lensflare'] === 'no-occlusion') {
961
+ target = 0;
962
+ }
963
+ else if (object instanceof Mesh) {
964
+ if (object.material.uniforms?._transmission?.value > 0.2) {
965
+ //Check for MeshTransmissionMaterial
966
+ target = 0.2;
967
+ }
968
+ else if (object.material._transmission && object.material._transmission > 0.2) {
969
+ //Check for MeshPhysicalMaterial with transmission setting
970
+ target = 0.2;
971
+ }
972
+ else if (object.material.transparent) {
973
+ // Check for OtherMaterials with transparent parameter
974
+ target = object.material.opacity;
975
+ }
976
+ }
977
+ }
978
+ }
979
+ easing.damp(uOpacity, 'value', target, smoothTime, delta);
512
980
  });
513
981
  }
514
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpLUT, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
515
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpLUT, isStandalone: true, selector: "ngtp-lut", inputs: { effectRef: "effectRef", _lut: ["lut", "_lut"], _blendFunction: ["blendFunction", "_blendFunction"], _tetrahedralInterpolation: ["tetrahedralInterpolation", "_tetrahedralInterpolation"] }, ngImport: i0, template: `
516
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
517
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
982
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpLensFlare, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
983
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpLensFlare, isStandalone: true, selector: "ngtp-lens-flare", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
984
+ <ngt-primitive *args="[effect()]" [parameters]="{ dispose: null }" />
985
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
518
986
  }
519
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpLUT, decorators: [{
987
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpLensFlare, decorators: [{
520
988
  type: Component,
521
989
  args: [{
522
- selector: 'ngtp-lut',
990
+ selector: 'ngtp-lens-flare',
523
991
  standalone: true,
524
992
  template: `
525
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
993
+ <ngt-primitive *args="[effect()]" [parameters]="{ dispose: null }" />
526
994
  `,
527
995
  imports: [NgtArgs],
528
996
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
997
+ changeDetection: ChangeDetectionStrategy.OnPush,
529
998
  }]
530
- }], ctorParameters: function () { return []; }, propDecorators: { effectRef: [{
531
- type: Input
532
- }], _lut: [{
533
- type: Input,
534
- args: [{ required: true, alias: 'lut' }]
535
- }], _blendFunction: [{
536
- type: Input,
537
- args: [{ alias: 'blendFunction' }]
538
- }], _tetrahedralInterpolation: [{
539
- type: Input,
540
- args: [{ alias: 'tetrahedralInterpolation' }]
541
- }] } });
999
+ }], ctorParameters: () => [] });
1000
+
1001
+ class NgtpLUT {
1002
+ constructor() {
1003
+ this.autoEffect = injectAutoEffect();
1004
+ this.store = injectStore();
1005
+ this.invalidate = this.store.select('invalidate');
1006
+ this.options = input({});
1007
+ this.lut = pick(this.options, 'lut');
1008
+ this.effect = computed(() => {
1009
+ const [lut, { lut: _, ...options }] = [this.lut(), this.options()];
1010
+ return new LUT3DEffect(lut, options);
1011
+ });
1012
+ afterNextRender(() => {
1013
+ this.autoEffect(() => {
1014
+ const [effect, { lut, tetrahedralInterpolation }, invalidate] = [
1015
+ this.effect(),
1016
+ this.options(),
1017
+ this.invalidate(),
1018
+ ];
1019
+ if (tetrahedralInterpolation)
1020
+ effect.tetrahedralInterpolation = tetrahedralInterpolation;
1021
+ if (lut)
1022
+ effect.lut = lut;
1023
+ invalidate();
1024
+ });
1025
+ });
1026
+ }
1027
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpLUT, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1028
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpLUT, isStandalone: true, selector: "ngtp-lut", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1029
+ <ngt-primitive *args="[effect()]" [dispose]="null" />
1030
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1031
+ }
1032
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpLUT, decorators: [{
1033
+ type: Component,
1034
+ args: [{
1035
+ selector: 'ngtp-lut',
1036
+ template: `
1037
+ <ngt-primitive *args="[effect()]" [dispose]="null" />
1038
+ `,
1039
+ imports: [NgtArgs],
1040
+ standalone: true,
1041
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1042
+ changeDetection: ChangeDetectionStrategy.OnPush,
1043
+ }]
1044
+ }], ctorParameters: () => [] });
542
1045
 
543
1046
  extend({ NoiseEffect });
544
- class NgtpNoise extends NgtpEffect {
1047
+ class NgtpNoise {
545
1048
  constructor() {
546
- super(...arguments);
547
- this.defaultBlendFunction = BlendFunction.COLOR_DODGE;
1049
+ this.effect = inject(NgtpEffect, { host: true });
1050
+ this.options = input({});
548
1051
  }
549
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpNoise, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
550
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpNoise, isStandalone: true, selector: "ngtp-noise", usesInheritance: true, ngImport: i0, template: `
551
- <ngt-noise-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1052
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpNoise, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1053
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpNoise, isStandalone: true, selector: "ngtp-noise", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.COLOR_DODGE })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1054
+ <ngt-noise-effect *args="[options()]" [camera]="effect.camera()">
1055
+ <ngtp-effect-blend-mode />
552
1056
  <ng-content />
553
1057
  </ngt-noise-effect>
554
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1058
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
555
1059
  }
556
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpNoise, decorators: [{
1060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpNoise, decorators: [{
557
1061
  type: Component,
558
1062
  args: [{
559
1063
  selector: 'ngtp-noise',
560
- standalone: true,
561
1064
  template: `
562
- <ngt-noise-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1065
+ <ngt-noise-effect *args="[options()]" [camera]="effect.camera()">
1066
+ <ngtp-effect-blend-mode />
563
1067
  <ng-content />
564
1068
  </ngt-noise-effect>
565
1069
  `,
566
- imports: [NgtArgs],
1070
+ standalone: true,
567
1071
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1072
+ changeDetection: ChangeDetectionStrategy.OnPush,
1073
+ imports: [NgtArgs, NgtpEffectBlendMode],
1074
+ hostDirectives: [NgtpEffectHostDirective],
1075
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.COLOR_DODGE })],
568
1076
  }]
569
1077
  }] });
570
1078
 
571
- class NgtpPixelation {
1079
+ const defaultOptions$1 = {
1080
+ selectionLayer: 10,
1081
+ };
1082
+ class NgtpOutline {
572
1083
  constructor() {
573
- this.inputs = signalStore({ granularity: 30 });
574
- this.effectRef = injectNgtRef();
575
- this.granularity = this.inputs.select('granularity');
576
- this.effect = computed(() => new PixelationEffect(this.granularity()));
1084
+ this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
1085
+ this.ngtSelection = inject(NgtSelection, { optional: true });
1086
+ this.effectComposer = inject(NgtpEffectComposer);
1087
+ this.store = injectStore();
1088
+ this.invalidate = this.store.select('invalidate');
1089
+ this.selection = pick(this.options, 'selection');
1090
+ this.selectionLayer = pick(this.options, 'selectionLayer');
1091
+ this.blendFunction = pick(this.options, 'blendFunction');
1092
+ this.patternTexture = pick(this.options, 'patternTexture');
1093
+ this.edgeStrength = pick(this.options, 'edgeStrength');
1094
+ this.pulseSpeed = pick(this.options, 'pulseSpeed');
1095
+ this.visibleEdgeColor = pick(this.options, 'visibleEdgeColor');
1096
+ this.hiddenEdgeColor = pick(this.options, 'hiddenEdgeColor');
1097
+ this.width = pick(this.options, 'width');
1098
+ this.height = pick(this.options, 'height');
1099
+ this.kernelSize = pick(this.options, 'kernelSize');
1100
+ this.blur = pick(this.options, 'blur');
1101
+ this.xRay = pick(this.options, 'xRay');
1102
+ this.restOptions = omit(this.options, [
1103
+ 'blendFunction',
1104
+ 'patternTexture',
1105
+ 'edgeStrength',
1106
+ 'pulseSpeed',
1107
+ 'visibleEdgeColor',
1108
+ 'hiddenEdgeColor',
1109
+ 'width',
1110
+ 'height',
1111
+ 'kernelSize',
1112
+ 'blur',
1113
+ 'xRay',
1114
+ ]);
1115
+ this.effect = computed(() => {
1116
+ const [scene, camera, blendFunction, patternTexture, edgeStrength, pulseSpeed, visibleEdgeColor, hiddenEdgeColor, width, height, kernelSize, blur, xRay, restOptions,] = [
1117
+ this.effectComposer.scene(),
1118
+ this.effectComposer.camera(),
1119
+ this.blendFunction(),
1120
+ this.patternTexture(),
1121
+ this.edgeStrength(),
1122
+ this.pulseSpeed(),
1123
+ this.visibleEdgeColor(),
1124
+ this.hiddenEdgeColor(),
1125
+ this.width(),
1126
+ this.height(),
1127
+ this.kernelSize(),
1128
+ this.blur(),
1129
+ this.xRay(),
1130
+ untracked(this.restOptions),
1131
+ ];
1132
+ return new OutlineEffect(scene, camera, {
1133
+ blendFunction,
1134
+ patternTexture,
1135
+ edgeStrength,
1136
+ pulseSpeed,
1137
+ visibleEdgeColor,
1138
+ hiddenEdgeColor,
1139
+ width,
1140
+ height,
1141
+ kernelSize,
1142
+ blur,
1143
+ xRay,
1144
+ ...restOptions,
1145
+ });
1146
+ });
1147
+ const autoEffect = injectAutoEffect();
1148
+ afterNextRender(() => {
1149
+ autoEffect(() => {
1150
+ const effect = this.effect();
1151
+ return () => effect.dispose();
1152
+ });
1153
+ autoEffect(() => {
1154
+ const [effect, invalidate, selectionLayer] = [this.effect(), this.invalidate(), this.selectionLayer()];
1155
+ effect.selectionLayer = selectionLayer;
1156
+ invalidate();
1157
+ });
1158
+ autoEffect(() => {
1159
+ // NOTE: we run this effect if declarative NgtSelection is not enabled
1160
+ if (!this.ngtSelection) {
1161
+ // NOTE: if NgtSelection is not used and selection is not provided, we throw
1162
+ if (this.selection() === undefined) {
1163
+ throw new Error('[NGT PostProcessing]: ngtp-outline requires selection input or use NgtSelection');
1164
+ }
1165
+ return this.handleSelectionChangeEffect(this.selection, this.effect, this.invalidate);
1166
+ }
1167
+ // NOTE: we run this effect if declarative NgtSelection is enabled
1168
+ const selectionEnabled = this.ngtSelection.enabled();
1169
+ if (!selectionEnabled)
1170
+ return;
1171
+ return this.handleSelectionChangeEffect(this.ngtSelection.selected, this.effect, this.invalidate);
1172
+ });
1173
+ });
577
1174
  }
578
- set _granularity(granularity) {
579
- this.inputs.set({ granularity });
1175
+ handleSelectionChangeEffect(selected, _effect, _invalidate) {
1176
+ const selection = selected();
1177
+ if (!selection || selection.length === 0)
1178
+ return;
1179
+ const [effect, invalidate] = [_effect(), _invalidate()];
1180
+ const objects = [];
1181
+ for (const el of selection) {
1182
+ const obj = resolveRef(el);
1183
+ if (!obj)
1184
+ continue;
1185
+ objects.push(obj);
1186
+ }
1187
+ if (objects.length === 0)
1188
+ return;
1189
+ effect.selection.set(objects);
1190
+ invalidate();
1191
+ return () => {
1192
+ effect.selection.clear();
1193
+ invalidate();
1194
+ };
580
1195
  }
581
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpPixelation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
582
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpPixelation, isStandalone: true, selector: "ngtp-pixelation", inputs: { effectRef: "effectRef", _granularity: ["granularity", "_granularity"] }, ngImport: i0, template: `
583
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
584
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1196
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpOutline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1197
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpOutline, isStandalone: true, selector: "ngtp-outline", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1198
+ <ngt-primitive *args="[effect()]" />
1199
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
585
1200
  }
586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpPixelation, decorators: [{
1201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpOutline, decorators: [{
587
1202
  type: Component,
588
1203
  args: [{
589
- selector: 'ngtp-pixelation',
1204
+ selector: 'ngtp-outline',
590
1205
  standalone: true,
591
1206
  template: `
592
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
1207
+ <ngt-primitive *args="[effect()]" />
593
1208
  `,
1209
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1210
+ changeDetection: ChangeDetectionStrategy.OnPush,
594
1211
  imports: [NgtArgs],
1212
+ }]
1213
+ }], ctorParameters: () => [] });
1214
+
1215
+ class NgtpPixelation {
1216
+ constructor() {
1217
+ this.options = input({ granularity: 5 }, { transform: mergeInputs({ granularity: 5 }) });
1218
+ this.granularity = pick(this.options, 'granularity');
1219
+ this.effect = computed(() => new PixelationEffect(this.granularity()));
1220
+ }
1221
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpPixelation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1222
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpPixelation, isStandalone: true, selector: "ngtp-pixelation", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1223
+ <ngt-primitive *args="[effect()]" />
1224
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1225
+ }
1226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpPixelation, decorators: [{
1227
+ type: Component,
1228
+ args: [{
1229
+ selector: 'ngtp-pixelation',
1230
+ template: `
1231
+ <ngt-primitive *args="[effect()]" />
1232
+ `,
1233
+ standalone: true,
1234
+ changeDetection: ChangeDetectionStrategy.OnPush,
595
1235
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1236
+ imports: [NgtArgs],
596
1237
  }]
597
- }], propDecorators: { effectRef: [{
598
- type: Input
599
- }], _granularity: [{
600
- type: Input,
601
- args: [{ alias: 'granularity' }]
602
- }] } });
1238
+ }] });
603
1239
 
604
1240
  extend({ ScanlineEffect });
605
- class NgtpScanline extends NgtpEffect {
1241
+ const defaultOptions = {
1242
+ density: 1.25,
1243
+ };
1244
+ class NgtpScanline {
606
1245
  constructor() {
607
- super(...arguments);
608
- this.defaultBlendFunction = BlendFunction.OVERLAY;
1246
+ this.effect = inject(NgtpEffect, { host: true });
1247
+ this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
609
1248
  }
610
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpScanline, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
611
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpScanline, isStandalone: true, selector: "ngtp-scanline", usesInheritance: true, ngImport: i0, template: `
612
- <ngt-scanline-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1249
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpScanline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1250
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpScanline, isStandalone: true, selector: "ngtp-scanline", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.OVERLAY })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1251
+ <ngt-scanline-effect *args="[options()]" [camera]="effect.camera()">
1252
+ <ngtp-effect-blend-mode />
613
1253
  <ng-content />
614
1254
  </ngt-scanline-effect>
615
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1255
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
616
1256
  }
617
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpScanline, decorators: [{
1257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpScanline, decorators: [{
618
1258
  type: Component,
619
1259
  args: [{
620
1260
  selector: 'ngtp-scanline',
621
- standalone: true,
622
1261
  template: `
623
- <ngt-scanline-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1262
+ <ngt-scanline-effect *args="[options()]" [camera]="effect.camera()">
1263
+ <ngtp-effect-blend-mode />
624
1264
  <ng-content />
625
1265
  </ngt-scanline-effect>
626
1266
  `,
627
- imports: [NgtArgs],
1267
+ standalone: true,
628
1268
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1269
+ changeDetection: ChangeDetectionStrategy.OnPush,
1270
+ imports: [NgtArgs, NgtpEffectBlendMode],
1271
+ hostDirectives: [NgtpEffectHostDirective],
1272
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.OVERLAY })],
629
1273
  }]
630
1274
  }] });
631
1275
 
632
1276
  extend({ SepiaEffect });
633
- class NgtpSepia extends NgtpEffect {
634
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpSepia, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
635
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpSepia, isStandalone: true, selector: "ngtp-sepia", usesInheritance: true, ngImport: i0, template: `
636
- <ngt-sepia-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1277
+ class NgtpSepia {
1278
+ constructor() {
1279
+ this.effect = inject(NgtpEffect, { host: true });
1280
+ this.options = input({});
1281
+ }
1282
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpSepia, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1283
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpSepia, isStandalone: true, selector: "ngtp-sepia", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1284
+ <ngt-sepia-effect *args="[options()]" [camera]="effect.camera()">
1285
+ <ngtp-effect-blend-mode />
637
1286
  <ng-content />
638
1287
  </ngt-sepia-effect>
639
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1288
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
640
1289
  }
641
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpSepia, decorators: [{
1290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpSepia, decorators: [{
642
1291
  type: Component,
643
1292
  args: [{
644
1293
  selector: 'ngtp-sepia',
645
- standalone: true,
646
1294
  template: `
647
- <ngt-sepia-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1295
+ <ngt-sepia-effect *args="[options()]" [camera]="effect.camera()">
1296
+ <ngtp-effect-blend-mode />
648
1297
  <ng-content />
649
1298
  </ngt-sepia-effect>
650
1299
  `,
651
- imports: [NgtArgs],
1300
+ standalone: true,
652
1301
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1302
+ changeDetection: ChangeDetectionStrategy.OnPush,
1303
+ imports: [NgtArgs, NgtpEffectBlendMode],
1304
+ hostDirectives: [NgtpEffectHostDirective],
653
1305
  }]
654
1306
  }] });
655
1307
 
656
1308
  extend({ ShockWaveEffect });
657
- class NgtpShockWave extends NgtpEffect {
658
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpShockWave, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
659
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpShockWave, isStandalone: true, selector: "ngtp-shock-wave", usesInheritance: true, ngImport: i0, template: `
660
- <ngt-shock-wave-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1309
+ class NgtpShockWave {
1310
+ constructor() {
1311
+ this.effect = inject(NgtpEffect, { host: true });
1312
+ this.options = input({});
1313
+ }
1314
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpShockWave, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1315
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpShockWave, isStandalone: true, selector: "ngtp-shock-wave", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1316
+ <ngt-shock-wave-effect *args="[options()]" [camera]="effect.camera()">
1317
+ <ngtp-effect-blend-mode />
661
1318
  <ng-content />
662
1319
  </ngt-shock-wave-effect>
663
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1320
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
664
1321
  }
665
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpShockWave, decorators: [{
1322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpShockWave, decorators: [{
666
1323
  type: Component,
667
1324
  args: [{
668
1325
  selector: 'ngtp-shock-wave',
669
- standalone: true,
670
1326
  template: `
671
- <ngt-shock-wave-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1327
+ <ngt-shock-wave-effect *args="[options()]" [camera]="effect.camera()">
1328
+ <ngtp-effect-blend-mode />
672
1329
  <ng-content />
673
1330
  </ngt-shock-wave-effect>
674
1331
  `,
675
- imports: [NgtArgs],
1332
+ standalone: true,
676
1333
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1334
+ changeDetection: ChangeDetectionStrategy.OnPush,
1335
+ imports: [NgtArgs, NgtpEffectBlendMode],
1336
+ hostDirectives: [NgtpEffectHostDirective],
677
1337
  }]
678
1338
  }] });
679
1339
 
680
1340
  extend({ SMAAEffect });
681
- class NgtpSMAA extends NgtpEffect {
682
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpSMAA, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
683
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpSMAA, isStandalone: true, selector: "ngtp-SMAA", usesInheritance: true, ngImport: i0, template: `
684
- <ngt-SMAA-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1341
+ class NgtpSMAA {
1342
+ constructor() {
1343
+ this.effect = inject(NgtpEffect, { host: true });
1344
+ this.options = input({});
1345
+ }
1346
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpSMAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1347
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpSMAA, isStandalone: true, selector: "ngtp-smaa", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1348
+ <ngt-sMAA-effect *args="[options()]" [camera]="effect.camera()">
1349
+ <ngtp-effect-blend-mode />
685
1350
  <ng-content />
686
- </ngt-SMAA-effect>
687
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1351
+ </ngt-sMAA-effect>
1352
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
688
1353
  }
689
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpSMAA, decorators: [{
1354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpSMAA, decorators: [{
690
1355
  type: Component,
691
1356
  args: [{
692
- selector: 'ngtp-SMAA',
693
- standalone: true,
1357
+ selector: 'ngtp-smaa',
694
1358
  template: `
695
- <ngt-SMAA-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1359
+ <ngt-sMAA-effect *args="[options()]" [camera]="effect.camera()">
1360
+ <ngtp-effect-blend-mode />
696
1361
  <ng-content />
697
- </ngt-SMAA-effect>
1362
+ </ngt-sMAA-effect>
698
1363
  `,
699
- imports: [NgtArgs],
1364
+ standalone: true,
700
1365
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1366
+ changeDetection: ChangeDetectionStrategy.OnPush,
1367
+ imports: [NgtArgs, NgtpEffectBlendMode],
1368
+ hostDirectives: [NgtpEffectHostDirective],
701
1369
  }]
702
1370
  }] });
703
1371
 
704
- class NgtpSSAO {
1372
+ extend({ TiltShiftEffect });
1373
+ class NgtpTiltShift {
705
1374
  constructor() {
706
- this.inputs = signalStore({
707
- blendFunction: BlendFunction.MULTIPLY,
708
- samples: 30,
709
- rings: 4,
710
- distanceThreshold: 1.0,
711
- distanceFalloff: 0.0,
712
- rangeThreshold: 0.5,
713
- rangeFalloff: 0.1,
714
- luminanceInfluence: 0.9,
715
- radius: 20,
716
- bias: 0.5,
717
- intensity: 1.0,
718
- depthAwareUpsampling: true,
719
- });
720
- this.effectRef = injectNgtRef();
721
- this.effectComposerApi = injectNgtpEffectComposerApi();
722
- this.effect = computed(() => {
723
- const [state, { camera, normalPass, downSamplingPass, resolutionScale }] = [
724
- this.inputs.state(),
725
- this.effectComposerApi(),
726
- ];
727
- if (normalPass === null && downSamplingPass === null) {
728
- console.error('Please enable the NormalPass in the NgtpEffectComposer in order to use NgtpSSAO.');
729
- return null;
730
- }
731
- return new SSAOEffect(camera, normalPass && !downSamplingPass ? normalPass.texture : null, {
732
- ...state,
733
- // @ts-expect-error
734
- normalDepthBuffer: state.normalDepthBuffer || (downSamplingPass ? downSamplingPass.texture : null),
735
- resolutionScale: state.resolutionScale || (resolutionScale ?? 1),
736
- depthAwareUpsampling: state.depthAwareUpsampling ?? true,
737
- });
738
- });
739
- }
740
- set _blendFunction(blendFunction) {
741
- this.inputs.set({ blendFunction });
742
- }
743
- set _distanceScaling(distanceScaling) {
744
- this.inputs.set({ distanceScaling });
745
- }
746
- set _depthAwareUpsampling(depthAwareUpsampling) {
747
- this.inputs.set({ depthAwareUpsampling });
748
- }
749
- set _normalDepthBuffer(normalDepthBuffer) {
750
- this.inputs.set({ normalDepthBuffer });
751
- }
752
- set _samples(samples) {
753
- this.inputs.set({ samples });
754
- }
755
- set _rings(rings) {
756
- this.inputs.set({ rings });
757
- }
758
- set _worldDistanceThreshold(worldDistanceThreshold) {
759
- this.inputs.set({ worldDistanceThreshold });
760
- }
761
- set _worldDistanceFalloff(worldDistanceFalloff) {
762
- this.inputs.set({ worldDistanceFalloff });
763
- }
764
- set _worldProximityThreshold(worldProximityThreshold) {
765
- this.inputs.set({ worldProximityThreshold });
766
- }
767
- set _worldProximityFalloff(worldProximityFalloff) {
768
- this.inputs.set({ worldProximityFalloff });
769
- }
770
- set _distanceThreshold(distanceThreshold) {
771
- this.inputs.set({ distanceThreshold });
772
- }
773
- set _distanceFalloff(distanceFalloff) {
774
- this.inputs.set({ distanceFalloff });
775
- }
776
- set _rangeThreshold(rangeThreshold) {
777
- this.inputs.set({ rangeThreshold });
778
- }
779
- set _rangeFalloff(rangeFalloff) {
780
- this.inputs.set({ rangeFalloff });
781
- }
782
- set _minRadiusScale(minRadiusScale) {
783
- this.inputs.set({ minRadiusScale });
784
- }
785
- set _luminanceInfluence(luminanceInfluence) {
786
- this.inputs.set({ luminanceInfluence });
787
- }
788
- set _radius(radius) {
789
- this.inputs.set({ radius });
790
- }
791
- set _intensity(intensity) {
792
- this.inputs.set({ intensity });
793
- }
794
- set _bias(bias) {
795
- this.inputs.set({ bias });
796
- }
797
- set _fade(fade) {
798
- this.inputs.set({ fade });
799
- }
800
- set _color(color) {
801
- this.inputs.set({ color });
802
- }
803
- set _resolutionScale(resolutionScale) {
804
- this.inputs.set({ resolutionScale });
805
- }
806
- set _resolutionX(resolutionX) {
807
- this.inputs.set({ resolutionX });
808
- }
809
- set _resolutionY(resolutionY) {
810
- this.inputs.set({ resolutionY });
811
- }
812
- set _width(width) {
813
- this.inputs.set({ width });
1375
+ this.effect = inject(NgtpEffect, { host: true });
1376
+ this.options = input({});
814
1377
  }
815
- set _height(height) {
816
- this.inputs.set({ height });
817
- }
818
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpSSAO, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
819
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpSSAO, isStandalone: true, selector: "ngtp-SSAO", inputs: { effectRef: "effectRef", _blendFunction: ["blendFunction", "_blendFunction"], _distanceScaling: ["distanceScaling", "_distanceScaling"], _depthAwareUpsampling: ["depthAwareUpsampling", "_depthAwareUpsampling"], _normalDepthBuffer: ["normalDepthBuffer", "_normalDepthBuffer"], _samples: ["samples", "_samples"], _rings: ["rings", "_rings"], _worldDistanceThreshold: ["worldDistanceThreshold", "_worldDistanceThreshold"], _worldDistanceFalloff: ["worldDistanceFalloff", "_worldDistanceFalloff"], _worldProximityThreshold: ["worldProximityThreshold", "_worldProximityThreshold"], _worldProximityFalloff: ["worldProximityFalloff", "_worldProximityFalloff"], _distanceThreshold: ["distanceThreshold", "_distanceThreshold"], _distanceFalloff: ["distanceFalloff", "_distanceFalloff"], _rangeThreshold: ["rangeThreshold", "_rangeThreshold"], _rangeFalloff: ["rangeFalloff", "_rangeFalloff"], _minRadiusScale: ["minRadiusScale", "_minRadiusScale"], _luminanceInfluence: ["luminanceInfluence", "_luminanceInfluence"], _radius: ["radius", "_radius"], _intensity: ["intensity", "_intensity"], _bias: ["bias", "_bias"], _fade: ["fade", "_fade"], _color: ["color", "_color"], _resolutionScale: ["resolutionScale", "_resolutionScale"], _resolutionX: ["resolutionX", "_resolutionX"], _resolutionY: ["resolutionY", "_resolutionY"], _width: ["width", "_width"], _height: ["height", "_height"] }, ngImport: i0, template: `
820
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
821
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1378
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpTiltShift, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1379
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpTiltShift, isStandalone: true, selector: "ngtp-tilt-shift", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1380
+ <ngt-tilt-shift-effect *args="[options()]" [camera]="effect.camera()">
1381
+ <ngtp-effect-blend-mode />
1382
+ <ng-content />
1383
+ </ngt-tilt-shift-effect>
1384
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
822
1385
  }
823
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpSSAO, decorators: [{
1386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpTiltShift, decorators: [{
824
1387
  type: Component,
825
1388
  args: [{
826
- selector: 'ngtp-SSAO',
827
- standalone: true,
1389
+ selector: 'ngtp-tilt-shift',
828
1390
  template: `
829
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
1391
+ <ngt-tilt-shift-effect *args="[options()]" [camera]="effect.camera()">
1392
+ <ngtp-effect-blend-mode />
1393
+ <ng-content />
1394
+ </ngt-tilt-shift-effect>
830
1395
  `,
831
- imports: [NgtArgs],
1396
+ standalone: true,
832
1397
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1398
+ changeDetection: ChangeDetectionStrategy.OnPush,
1399
+ imports: [NgtArgs, NgtpEffectBlendMode],
1400
+ hostDirectives: [NgtpEffectHostDirective],
1401
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
833
1402
  }]
834
- }], propDecorators: { effectRef: [{
835
- type: Input
836
- }], _blendFunction: [{
837
- type: Input,
838
- args: [{ alias: 'blendFunction' }]
839
- }], _distanceScaling: [{
840
- type: Input,
841
- args: [{ alias: 'distanceScaling' }]
842
- }], _depthAwareUpsampling: [{
843
- type: Input,
844
- args: [{ alias: 'depthAwareUpsampling' }]
845
- }], _normalDepthBuffer: [{
846
- type: Input,
847
- args: [{ alias: 'normalDepthBuffer' }]
848
- }], _samples: [{
849
- type: Input,
850
- args: [{ alias: 'samples' }]
851
- }], _rings: [{
852
- type: Input,
853
- args: [{ alias: 'rings' }]
854
- }], _worldDistanceThreshold: [{
855
- type: Input,
856
- args: [{ alias: 'worldDistanceThreshold' }]
857
- }], _worldDistanceFalloff: [{
858
- type: Input,
859
- args: [{ alias: 'worldDistanceFalloff' }]
860
- }], _worldProximityThreshold: [{
861
- type: Input,
862
- args: [{ alias: 'worldProximityThreshold' }]
863
- }], _worldProximityFalloff: [{
864
- type: Input,
865
- args: [{ alias: 'worldProximityFalloff' }]
866
- }], _distanceThreshold: [{
867
- type: Input,
868
- args: [{ alias: 'distanceThreshold' }]
869
- }], _distanceFalloff: [{
870
- type: Input,
871
- args: [{ alias: 'distanceFalloff' }]
872
- }], _rangeThreshold: [{
873
- type: Input,
874
- args: [{ alias: 'rangeThreshold' }]
875
- }], _rangeFalloff: [{
876
- type: Input,
877
- args: [{ alias: 'rangeFalloff' }]
878
- }], _minRadiusScale: [{
879
- type: Input,
880
- args: [{ alias: 'minRadiusScale' }]
881
- }], _luminanceInfluence: [{
882
- type: Input,
883
- args: [{ alias: 'luminanceInfluence' }]
884
- }], _radius: [{
885
- type: Input,
886
- args: [{ alias: 'radius' }]
887
- }], _intensity: [{
888
- type: Input,
889
- args: [{ alias: 'intensity' }]
890
- }], _bias: [{
891
- type: Input,
892
- args: [{ alias: 'bias' }]
893
- }], _fade: [{
894
- type: Input,
895
- args: [{ alias: 'fade' }]
896
- }], _color: [{
897
- type: Input,
898
- args: [{ alias: 'color' }]
899
- }], _resolutionScale: [{
900
- type: Input,
901
- args: [{ alias: 'resolutionScale' }]
902
- }], _resolutionX: [{
903
- type: Input,
904
- args: [{ alias: 'resolutionX' }]
905
- }], _resolutionY: [{
906
- type: Input,
907
- args: [{ alias: 'resolutionY' }]
908
- }], _width: [{
909
- type: Input,
910
- args: [{ alias: 'width' }]
911
- }], _height: [{
912
- type: Input,
913
- args: [{ alias: 'height' }]
914
- }] } });
1403
+ }] });
915
1404
 
916
- extend({ TiltShiftEffect });
917
- class NgtpTiltShift extends NgtpEffect {
1405
+ const TiltShiftShader = {
1406
+ fragmentShader: `
1407
+
1408
+ // original shader by Evan Wallace
1409
+
1410
+ #define MAX_ITERATIONS 100
1411
+
1412
+ uniform float blur;
1413
+ uniform float taper;
1414
+ uniform vec2 start;
1415
+ uniform vec2 end;
1416
+ uniform vec2 direction;
1417
+ uniform int samples;
1418
+
1419
+ float random(vec3 scale, float seed) {
1420
+ /* use the fragment position for a different seed per-pixel */
1421
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
1422
+ }
1423
+
1424
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
1425
+ vec4 color = vec4(0.0);
1426
+ float total = 0.0;
1427
+ vec2 startPixel = vec2(start.x * resolution.x, start.y * resolution.y);
1428
+ vec2 endPixel = vec2(end.x * resolution.x, end.y * resolution.y);
1429
+ float f_samples = float(samples);
1430
+ float half_samples = f_samples / 2.0;
1431
+
1432
+ // use screen diagonal to normalize blur radii
1433
+ float maxScreenDistance = distance(vec2(0.0), resolution); // diagonal distance
1434
+ float gradientRadius = taper * (maxScreenDistance);
1435
+ float blurRadius = blur * (maxScreenDistance / 16.0);
1436
+
1437
+ /* randomize the lookup values to hide the fixed number of samples */
1438
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
1439
+ vec2 normal = normalize(vec2(startPixel.y - endPixel.y, endPixel.x - startPixel.x));
1440
+ float radius = smoothstep(0.0, 1.0, abs(dot(uv * resolution - startPixel, normal)) / gradientRadius) * blurRadius;
1441
+
1442
+ #pragma unroll_loop_start
1443
+ for (int i = 0; i <= MAX_ITERATIONS; i++) {
1444
+ if (i >= samples) { break; } // return early if over sample count
1445
+ float f_i = float(i);
1446
+ float s_i = -half_samples + f_i;
1447
+ float percent = (s_i + offset - 0.5) / half_samples;
1448
+ float weight = 1.0 - abs(percent);
1449
+ vec4 sample_i = texture2D(inputBuffer, uv + normalize(direction) / resolution * percent * radius);
1450
+ /* switch to pre-multiplied alpha to correctly blur transparent images */
1451
+ sample_i.rgb *= sample_i.a;
1452
+ color += sample_i * weight;
1453
+ total += weight;
1454
+ }
1455
+ #pragma unroll_loop_end
1456
+
1457
+ outputColor = color / total;
1458
+
1459
+ /* switch back from pre-multiplied alpha */
1460
+ outputColor.rgb /= outputColor.a + 0.00001;
1461
+ }
1462
+ `,
1463
+ };
1464
+ class TiltShift2Effect extends Effect {
1465
+ constructor({ blendFunction = BlendFunction.NORMAL, blur = 0.15, // [0, 1], can go beyond 1 for extra
1466
+ taper = 0.5, // [0, 1], can go beyond 1 for extra
1467
+ start = [0.5, 0.0], // [0,1] percentage x,y of screenspace
1468
+ end = [0.5, 1.0], // [0,1] percentage x,y of screenspace
1469
+ samples = 10.0, // number of blur samples
1470
+ direction = [1, 1], // direction of blur
1471
+ } = {}) {
1472
+ super('TiltShiftEffect', TiltShiftShader.fragmentShader, {
1473
+ blendFunction,
1474
+ attributes: EffectAttribute.CONVOLUTION,
1475
+ uniforms: new Map([
1476
+ ['blur', new Uniform(blur)],
1477
+ ['taper', new Uniform(taper)],
1478
+ ['start', new Uniform(start)],
1479
+ ['end', new Uniform(end)],
1480
+ ['samples', new Uniform(samples)],
1481
+ ['direction', new Uniform(direction)],
1482
+ ]),
1483
+ });
1484
+ }
1485
+ }
1486
+ extend({ TiltShift2Effect });
1487
+ class NgtpTiltShift2 {
918
1488
  constructor() {
919
- super(...arguments);
920
- this.defaultBlendFunction = BlendFunction.ADD;
1489
+ this.effect = inject(NgtpEffect, { host: true });
1490
+ this.options = input({});
921
1491
  }
922
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpTiltShift, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
923
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpTiltShift, isStandalone: true, selector: "ngtp-tilt-shift", usesInheritance: true, ngImport: i0, template: `
924
- <ngt-tilt-shift-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1492
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpTiltShift2, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1493
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpTiltShift2, isStandalone: true, selector: "ngtp-tilt-shift2", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1494
+ <ngt-tilt-shift2-effect *args="[options()]" [camera]="effect.camera()">
1495
+ <ngtp-effect-blend-mode />
925
1496
  <ng-content />
926
- </ngt-tilt-shift-effect>
927
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1497
+ </ngt-tilt-shift2-effect>
1498
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
928
1499
  }
929
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpTiltShift, decorators: [{
1500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpTiltShift2, decorators: [{
930
1501
  type: Component,
931
1502
  args: [{
932
- selector: 'ngtp-tilt-shift',
1503
+ selector: 'ngtp-tilt-shift2',
933
1504
  standalone: true,
934
1505
  template: `
935
- <ngt-tilt-shift-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1506
+ <ngt-tilt-shift2-effect *args="[options()]" [camera]="effect.camera()">
1507
+ <ngtp-effect-blend-mode />
936
1508
  <ng-content />
937
- </ngt-tilt-shift-effect>
1509
+ </ngt-tilt-shift2-effect>
938
1510
  `,
939
- imports: [NgtArgs],
940
1511
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1512
+ changeDetection: ChangeDetectionStrategy.OnPush,
1513
+ imports: [NgtArgs, NgtpEffectBlendMode],
1514
+ hostDirectives: [NgtpEffectHostDirective],
1515
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
941
1516
  }]
942
1517
  }] });
943
1518
 
944
- extend({ ToneMappingEffect });
945
- class NgtpToneMapping extends NgtpEffect {
946
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpToneMapping, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
947
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpToneMapping, isStandalone: true, selector: "ngtp-tone-mapping", usesInheritance: true, ngImport: i0, template: `
948
- <ngt-tone-mapping-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1519
+ extend({ VignetteEffect });
1520
+ class NgtpVignette {
1521
+ constructor() {
1522
+ this.effect = inject(NgtpEffect, { host: true });
1523
+ this.options = input({});
1524
+ }
1525
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpVignette, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1526
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpVignette, isStandalone: true, selector: "ngtp-vignette", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1527
+ <ngt-vignette-effect *args="[options()]" [camera]="effect.camera()">
1528
+ <ngtp-effect-blend-mode />
949
1529
  <ng-content />
950
- </ngt-tone-mapping-effect>
951
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1530
+ </ngt-vignette-effect>
1531
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
952
1532
  }
953
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpToneMapping, decorators: [{
1533
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpVignette, decorators: [{
954
1534
  type: Component,
955
1535
  args: [{
956
- selector: 'ngtp-tone-mapping',
957
- standalone: true,
1536
+ selector: 'ngtp-vignette',
958
1537
  template: `
959
- <ngt-tone-mapping-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1538
+ <ngt-vignette-effect *args="[options()]" [camera]="effect.camera()">
1539
+ <ngtp-effect-blend-mode />
960
1540
  <ng-content />
961
- </ngt-tone-mapping-effect>
1541
+ </ngt-vignette-effect>
962
1542
  `,
963
- imports: [NgtArgs],
1543
+ standalone: true,
964
1544
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1545
+ changeDetection: ChangeDetectionStrategy.OnPush,
1546
+ imports: [NgtArgs, NgtpEffectBlendMode],
1547
+ hostDirectives: [NgtpEffectHostDirective],
965
1548
  }]
966
1549
  }] });
967
1550
 
968
- extend({ VignetteEffect });
969
- class NgtpVignette extends NgtpEffect {
970
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpVignette, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
971
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtpVignette, isStandalone: true, selector: "ngtp-vignette", usesInheritance: true, ngImport: i0, template: `
972
- <ngt-vignette-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1551
+ const WaterShader = {
1552
+ fragmentShader: `
1553
+ uniform float factor;
1554
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
1555
+ vec2 vUv = uv;
1556
+ float frequency = 6.0 * factor;
1557
+ float amplitude = 0.015 * factor;
1558
+ float x = vUv.y * frequency + time * .7;
1559
+ float y = vUv.x * frequency + time * .3;
1560
+ vUv.x += cos(x+y) * amplitude * cos(y);
1561
+ vUv.y += sin(x-y) * amplitude * cos(y);
1562
+ vec4 rgba = texture2D(inputBuffer, vUv);
1563
+ outputColor = rgba;
1564
+ }`,
1565
+ };
1566
+ class WaterEffect extends Effect {
1567
+ constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
1568
+ super('WaterEffect', WaterShader.fragmentShader, {
1569
+ blendFunction,
1570
+ attributes: EffectAttribute.CONVOLUTION,
1571
+ uniforms: new Map([['factor', new Uniform(factor)]]),
1572
+ });
1573
+ }
1574
+ }
1575
+ extend({ WaterEffect });
1576
+ class NgtpWater {
1577
+ constructor() {
1578
+ this.effect = inject(NgtpEffect, { host: true });
1579
+ this.options = input({});
1580
+ }
1581
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpWater, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1582
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtpWater, isStandalone: true, selector: "ngtp-water", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
1583
+ <ngt-water-effect *args="[options()]" [camera]="effect.camera()">
1584
+ <ngtp-effect-blend-mode />
973
1585
  <ng-content />
974
- </ngt-vignette-effect>
975
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
1586
+ </ngt-water-effect>
1587
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
976
1588
  }
977
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtpVignette, decorators: [{
1589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtpWater, decorators: [{
978
1590
  type: Component,
979
1591
  args: [{
980
- selector: 'ngtp-vignette',
1592
+ selector: 'ngtp-water',
981
1593
  standalone: true,
982
1594
  template: `
983
- <ngt-vignette-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
1595
+ <ngt-water-effect *args="[options()]" [camera]="effect.camera()">
1596
+ <ngtp-effect-blend-mode />
984
1597
  <ng-content />
985
- </ngt-vignette-effect>
1598
+ </ngt-water-effect>
986
1599
  `,
987
- imports: [NgtArgs],
988
1600
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1601
+ changeDetection: ChangeDetectionStrategy.OnPush,
1602
+ imports: [NgtArgs, NgtpEffectBlendMode],
1603
+ hostDirectives: [NgtpEffectHostDirective],
1604
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
989
1605
  }]
990
1606
  }] });
991
1607
 
@@ -993,5 +1609,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
993
1609
  * Generated bundle index. Do not edit.
994
1610
  */
995
1611
 
996
- export { NgtpBloom, NgtpBrightnessContrast, NgtpColorDepth, NgtpDepth, NgtpDotScreen, NgtpEffect, NgtpEffectComposer, NgtpHueSaturation, NgtpLUT, NgtpNoise, NgtpPixelation, NgtpSMAA, NgtpSSAO, NgtpScanline, NgtpSepia, NgtpShockWave, NgtpTiltShift, NgtpToneMapping, NgtpVignette, injectNgtpEffectComposerApi, provideNgtpEffectComposerApi };
1612
+ export { ASCIIEffect, LensFlareEffect, NgtpASCII, NgtpBloom, NgtpBrightnessContrast, NgtpChromaticAberration, NgtpColorAverage, NgtpColorDepth, NgtpDepth, NgtpDepthOfField, NgtpDotScreen, NgtpEffect, NgtpEffectBlendMode, NgtpEffectComposer, NgtpEffectHostDirective, NgtpFXAA, NgtpGlitch, NgtpGodRays, NgtpGrid, NgtpHueSaturation, NgtpLUT, NgtpLensFlare, NgtpNoise, NgtpOutline, NgtpPixelation, NgtpSMAA, NgtpScanline, NgtpSepia, NgtpShockWave, NgtpTiltShift, NgtpTiltShift2, NgtpVignette, NgtpWater, TiltShift2Effect, WaterEffect, injectDefaultEffectOptions, provideDefaultEffectOptions };
997
1613
  //# sourceMappingURL=angular-three-postprocessing.mjs.map