angular-three-postprocessing 2.0.0-beta.24 → 2.0.0-beta.241

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