angular-three-postprocessing 2.0.0-beta.235 → 2.0.0-beta.236

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 (59) hide show
  1. package/esm2022/lib/effect-composer.mjs +14 -3
  2. package/esm2022/lib/effects/ascii.mjs +121 -0
  3. package/esm2022/lib/effects/brightness-contrast.mjs +48 -0
  4. package/esm2022/lib/effects/chromatic-abberation.mjs +48 -0
  5. package/esm2022/lib/effects/color-average.mjs +34 -0
  6. package/esm2022/lib/effects/color-depth.mjs +38 -0
  7. package/esm2022/lib/effects/depth-of-field.mjs +57 -0
  8. package/esm2022/lib/effects/depth.mjs +38 -0
  9. package/esm2022/lib/effects/dot-screen.mjs +38 -0
  10. package/esm2022/lib/effects/fxaa.mjs +38 -0
  11. package/esm2022/lib/effects/glitch.mjs +65 -0
  12. package/esm2022/lib/effects/god-rays.mjs +42 -0
  13. package/esm2022/lib/effects/grid.mjs +45 -0
  14. package/esm2022/lib/effects/hue-saturation.mjs +38 -0
  15. package/esm2022/lib/effects/index.mjs +26 -1
  16. package/esm2022/lib/effects/lens-flare.mjs +195 -0
  17. package/esm2022/lib/effects/lut.mjs +51 -0
  18. package/esm2022/lib/effects/noise.mjs +39 -0
  19. package/esm2022/lib/effects/pixelation.mjs +31 -0
  20. package/esm2022/lib/effects/scanline.mjs +43 -0
  21. package/esm2022/lib/effects/sepia.mjs +38 -0
  22. package/esm2022/lib/effects/shock-wave.mjs +38 -0
  23. package/esm2022/lib/effects/smaa.mjs +38 -0
  24. package/esm2022/lib/effects/tilt-shift-2.mjs +121 -0
  25. package/esm2022/lib/effects/tilt-shift.mjs +39 -0
  26. package/esm2022/lib/effects/vignette.mjs +38 -0
  27. package/esm2022/lib/effects/water.mjs +64 -0
  28. package/esm2022/lib/utils.mjs +14 -0
  29. package/fesm2022/angular-three-postprocessing.mjs +1262 -7
  30. package/fesm2022/angular-three-postprocessing.mjs.map +1 -1
  31. package/lib/effect-composer.d.ts +48 -0
  32. package/lib/effects/ascii.d.ts +24 -0
  33. package/lib/effects/brightness-contrast.d.ts +15 -0
  34. package/lib/effects/chromatic-abberation.d.ts +16 -0
  35. package/lib/effects/color-average.d.ts +12 -0
  36. package/lib/effects/color-depth.d.ts +14 -0
  37. package/lib/effects/depth-of-field.d.ts +30 -0
  38. package/lib/effects/depth.d.ts +14 -0
  39. package/lib/effects/dot-screen.d.ts +15 -0
  40. package/lib/effects/fxaa.d.ts +13 -0
  41. package/lib/effects/glitch.d.ts +30 -0
  42. package/lib/effects/god-rays.d.ts +38 -0
  43. package/lib/effects/grid.d.ts +24 -0
  44. package/lib/effects/hue-saturation.d.ts +15 -0
  45. package/lib/effects/index.d.ts +25 -0
  46. package/lib/effects/lens-flare.d.ts +111 -0
  47. package/lib/effects/lut.d.ts +20 -0
  48. package/lib/effects/noise.d.ts +14 -0
  49. package/lib/effects/pixelation.d.ts +17 -0
  50. package/lib/effects/scanline.d.ts +17 -0
  51. package/lib/effects/sepia.d.ts +14 -0
  52. package/lib/effects/shock-wave.d.ts +11 -0
  53. package/lib/effects/smaa.d.ts +15 -0
  54. package/lib/effects/tilt-shift-2.d.ts +35 -0
  55. package/lib/effects/tilt-shift.d.ts +22 -0
  56. package/lib/effects/vignette.d.ts +17 -0
  57. package/lib/effects/water.d.ts +20 -0
  58. package/lib/utils.d.ts +3 -0
  59. package/package.json +7 -1
@@ -1,12 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
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, injectBeforeRender, getLocalState, NgtArgs } from 'angular-three';
3
+ import { injectNgtRef, injectNgtStore, extend, createApiToken, injectBeforeRender, getLocalState, NgtArgs, is } from 'angular-three';
4
4
  import { injectAutoEffect } from 'ngxtension/auto-effect';
5
5
  import { createNoopInjectionToken } from 'ngxtension/create-injection-token';
6
6
  import { mergeInputs } from 'ngxtension/inject-inputs';
7
- import { EffectAttribute, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, BloomEffect, BlendFunction } from 'postprocessing';
8
- import { Group, HalfFloatType, NoToneMapping } from 'three';
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';
9
9
  import { isWebGL2Available } from 'three-stdlib';
10
+ import { easing } from 'maath';
10
11
 
11
12
  const [injectDefaultEffectOptions, provideDefaultEffectOptions] = createNoopInjectionToken('Default Effect options');
12
13
  class NgtpEffectBlendMode {
@@ -57,7 +58,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
57
58
  const NgtpEffectHostDirective = { directive: NgtpEffect, inputs: ['blendFunction', 'opacity', 'effectRef'] };
58
59
 
59
60
  extend({ Group });
60
- const defaultOptions = {
61
+ const [injectEffectComposerApi, provideEffectComposerApi] = createApiToken(() => NgtpEffectComposer);
62
+ const defaultOptions$3 = {
61
63
  enabled: true,
62
64
  renderPriority: 1,
63
65
  autoClear: true,
@@ -77,7 +79,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
77
79
  }] });
78
80
  class NgtpEffectComposer {
79
81
  constructor() {
80
- this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
82
+ this.options = input(defaultOptions$3, { transform: mergeInputs(defaultOptions$3) });
81
83
  this.injector = inject(Injector);
82
84
  this.autoEffect = injectAutoEffect();
83
85
  this.store = injectNgtStore();
@@ -133,6 +135,15 @@ class NgtpEffectComposer {
133
135
  }
134
136
  return { composer, normalPass, downSamplingPass };
135
137
  });
138
+ this.api = computed(() => {
139
+ const [{ composer, normalPass, downSamplingPass }, camera, scene, resolutionScale] = [
140
+ this.composerData(),
141
+ this.camera(),
142
+ this.scene(),
143
+ this.resolutionScale(),
144
+ ];
145
+ return { composer, camera, scene, normalPass, downSamplingPass, resolutionScale };
146
+ });
136
147
  afterNextRender(() => {
137
148
  this.disableToneMapping();
138
149
  this.setComposerSize();
@@ -233,7 +244,7 @@ class NgtpEffectComposer {
233
244
  });
234
245
  }
235
246
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffectComposer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
236
- 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 } }, 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: `
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: `
237
248
  <ngt-group #group ngtCompound></ngt-group>
238
249
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
239
250
  }
@@ -245,11 +256,127 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
245
256
  template: `
246
257
  <ngt-group #group ngtCompound></ngt-group>
247
258
  `,
259
+ providers: [provideEffectComposerApi()],
248
260
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
249
261
  changeDetection: ChangeDetectionStrategy.OnPush,
250
262
  }]
251
263
  }], ctorParameters: () => [] });
252
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 />
373
+ `,
374
+ imports: [NgtArgs],
375
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
376
+ changeDetection: ChangeDetectionStrategy.OnPush,
377
+ }]
378
+ }] });
379
+
253
380
  extend({ BloomEffect });
254
381
  class NgtpBloom {
255
382
  constructor() {
@@ -283,9 +410,1137 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
283
410
  }]
284
411
  }] });
285
412
 
413
+ extend({ BrightnessContrastEffect });
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 />
428
+ <ng-content />
429
+ </ngt-brightness-contrast-effect>
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 }); }
431
+ }
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpBrightnessContrast, decorators: [{
433
+ type: Component,
434
+ args: [{
435
+ selector: 'ngtp-brightness-contrast',
436
+ standalone: true,
437
+ template: `
438
+ <ngt-brightness-contrast-effect
439
+ *args="[options()]"
440
+ [camera]="effect.camera()"
441
+ [ref]="effect.effectRef()"
442
+ ngtCompound
443
+ >
444
+ <ngtp-effect-blend-mode />
445
+ <ng-content />
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>
519
+ `,
520
+ imports: [NgtArgs],
521
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
522
+ changeDetection: ChangeDetectionStrategy.OnPush,
523
+ }]
524
+ }] });
525
+
526
+ extend({ ColorDepthEffect });
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 />
536
+ <ng-content />
537
+ </ngt-color-depth-effect>
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 }); }
539
+ }
540
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpColorDepth, decorators: [{
541
+ type: Component,
542
+ args: [{
543
+ selector: 'ngtp-color-depth',
544
+ template: `
545
+ <ngt-color-depth-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
546
+ <ngtp-effect-blend-mode />
547
+ <ng-content />
548
+ </ngt-color-depth-effect>
549
+ `,
550
+ standalone: true,
551
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
552
+ changeDetection: ChangeDetectionStrategy.OnPush,
553
+ imports: [NgtArgs, NgtpEffectBlendMode],
554
+ hostDirectives: [NgtpEffectHostDirective],
555
+ }]
556
+ }] });
557
+
558
+ extend({ DepthEffect });
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 />
568
+ <ng-content />
569
+ </ngt-depth-effect>
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 }); }
571
+ }
572
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpDepth, decorators: [{
573
+ type: Component,
574
+ args: [{
575
+ selector: 'ngtp-depth',
576
+ template: `
577
+ <ngt-depth-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
578
+ <ngtp-effect-blend-mode />
579
+ <ng-content />
580
+ </ngt-depth-effect>
581
+ `,
582
+ standalone: true,
583
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
584
+ changeDetection: ChangeDetectionStrategy.OnPush,
585
+ imports: [NgtArgs, NgtpEffectBlendMode],
586
+ hostDirectives: [NgtpEffectHostDirective],
587
+ }]
588
+ }] });
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
+
640
+ extend({ DotScreenEffect });
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 />
650
+ <ng-content />
651
+ </ngt-dot-screen-effect>
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 }); }
653
+ }
654
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpDotScreen, decorators: [{
655
+ type: Component,
656
+ args: [{
657
+ selector: 'ngtp-dot-screen',
658
+ template: `
659
+ <ngt-dot-screen-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
660
+ <ngtp-effect-blend-mode />
661
+ <ng-content />
662
+ </ngt-dot-screen-effect>
663
+ `,
664
+ standalone: true,
665
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
666
+ changeDetection: ChangeDetectionStrategy.OnPush,
667
+ imports: [NgtArgs, NgtpEffectBlendMode],
668
+ hostDirectives: [NgtpEffectHostDirective],
669
+ }]
670
+ }] });
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
+ function vector2(options, key) {
705
+ return computed(() => {
706
+ const value = options()[key];
707
+ if (typeof value === 'number')
708
+ return new Vector2(value, value);
709
+ else if (value)
710
+ return new Vector2(...value);
711
+ else
712
+ return new Vector2();
713
+ });
714
+ }
715
+
716
+ class NgtpGlitch {
717
+ constructor() {
718
+ this.autoEffect = injectAutoEffect();
719
+ this.store = injectNgtStore();
720
+ this.invalidate = this.store.select('invalidate');
721
+ this.effectRef = input(injectNgtRef());
722
+ this.options = input({ active: true }, { transform: mergeInputs({ active: true }) });
723
+ this.active = computed(() => this.options().active);
724
+ this.mode = computed(() => this.options().mode);
725
+ this.delay = vector2(this.options, 'delay');
726
+ this.duration = vector2(this.options, 'duration');
727
+ this.chromaticAberrationOffset = vector2(this.options, 'chromaticAberrationOffset');
728
+ this.strength = vector2(this.options, 'strength');
729
+ this.effect = computed(() => {
730
+ const [{ ratio, dtSize, columns, blendFunction, perturbationMap }, delay, duration, chromaticAberrationOffset, strength,] = [this.options(), this.delay(), this.duration(), this.chromaticAberrationOffset(), this.strength()];
731
+ return new GlitchEffect({
732
+ ratio,
733
+ dtSize,
734
+ columns,
735
+ blendFunction,
736
+ perturbationMap,
737
+ delay,
738
+ duration,
739
+ chromaticAberrationOffset,
740
+ strength,
741
+ });
742
+ });
743
+ afterNextRender(() => {
744
+ this.autoEffect(() => {
745
+ const effect = this.effect();
746
+ return () => effect.dispose();
747
+ });
748
+ this.autoEffect(() => {
749
+ const [effect, invalidate, mode, active] = [this.effect(), this.invalidate(), this.mode(), this.active()];
750
+ effect.mode = active ? mode || GlitchMode.SPORADIC : GlitchMode.DISABLED;
751
+ invalidate();
752
+ });
753
+ });
754
+ }
755
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpGlitch, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
756
+ 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: `
757
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" [dispose]="null" ngtCompound />
758
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
759
+ }
760
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpGlitch, decorators: [{
761
+ type: Component,
762
+ args: [{
763
+ selector: 'ngtp-glitch',
764
+ standalone: true,
765
+ template: `
766
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" [dispose]="null" ngtCompound />
767
+ `,
768
+ imports: [NgtArgs],
769
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
770
+ changeDetection: ChangeDetectionStrategy.OnPush,
771
+ }]
772
+ }], ctorParameters: () => [] });
773
+
774
+ class NgtpGodRays {
775
+ constructor() {
776
+ this.autoEffect = injectAutoEffect();
777
+ this.composerApi = injectEffectComposerApi();
778
+ this.effectRef = input(injectNgtRef());
779
+ this.options = input({});
780
+ this.effect = computed(() => {
781
+ const [{ camera }, { sun, ...options }] = [this.composerApi(), this.options()];
782
+ return new GodRaysEffect(camera, is.ref(sun) ? sun.nativeElement : sun, options);
783
+ });
784
+ afterNextRender(() => {
785
+ this.autoEffect(() => {
786
+ const [sun, effect] = [this.options().sun, this.effect()];
787
+ effect.lightSource = is.ref(sun) ? sun.nativeElement : sun;
788
+ });
789
+ });
790
+ }
791
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpGodRays, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
792
+ 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: `
793
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" ngtCompound />
794
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
795
+ }
796
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpGodRays, decorators: [{
797
+ type: Component,
798
+ args: [{
799
+ selector: 'ngtp-god-rays',
800
+ standalone: true,
801
+ template: `
802
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" ngtCompound />
803
+ `,
804
+ imports: [NgtArgs],
805
+ changeDetection: ChangeDetectionStrategy.OnPush,
806
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
807
+ }]
808
+ }], ctorParameters: () => [] });
809
+
810
+ class NgtpGrid {
811
+ constructor() {
812
+ this.autoEffect = injectAutoEffect();
813
+ this.store = injectNgtStore();
814
+ this.invalidate = this.store.select('invalidate');
815
+ this.effectRef = input(injectNgtRef());
816
+ this.options = input({});
817
+ this.size = computed(() => this.options().size);
818
+ this.effect = computed(() => {
819
+ const { size: _, ...options } = this.options();
820
+ return new GridEffect(options);
821
+ });
822
+ afterNextRender(() => {
823
+ this.autoEffect(() => {
824
+ const [size, effect] = [this.size(), this.effect()];
825
+ if (size) {
826
+ effect.setSize(size.width, size.height);
827
+ }
828
+ });
829
+ });
830
+ }
831
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
832
+ 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: `
833
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" ngtCompound />
834
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
835
+ }
836
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpGrid, decorators: [{
837
+ type: Component,
838
+ args: [{
839
+ selector: 'ngtp-grid',
840
+ standalone: true,
841
+ template: `
842
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" ngtCompound />
843
+ `,
844
+ imports: [NgtArgs],
845
+ changeDetection: ChangeDetectionStrategy.OnPush,
846
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
847
+ }]
848
+ }], ctorParameters: () => [] });
849
+
850
+ extend({ HueSaturationEffect });
851
+ class NgtpHueSaturation {
852
+ constructor() {
853
+ this.effect = inject(NgtpEffect, { host: true });
854
+ this.options = input({});
855
+ }
856
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpHueSaturation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
857
+ 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: `
858
+ <ngt-hue-saturation-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
859
+ <ngtp-effect-blend-mode />
860
+ <ng-content />
861
+ </ngt-hue-saturation-effect>
862
+ `, 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 }); }
863
+ }
864
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpHueSaturation, decorators: [{
865
+ type: Component,
866
+ args: [{
867
+ selector: 'ngtp-hue-saturation',
868
+ template: `
869
+ <ngt-hue-saturation-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
870
+ <ngtp-effect-blend-mode />
871
+ <ng-content />
872
+ </ngt-hue-saturation-effect>
873
+ `,
874
+ standalone: true,
875
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
876
+ changeDetection: ChangeDetectionStrategy.OnPush,
877
+ imports: [NgtArgs, NgtpEffectBlendMode],
878
+ hostDirectives: [NgtpEffectHostDirective],
879
+ }]
880
+ }] });
881
+
882
+ // Created by Anderson Mancini 2023
883
+ // React Three Fiber Ultimate LensFlare
884
+ const LensFlareShader = {
885
+ fragmentShader: /* glsl */ `
886
+
887
+ uniform float iTime;
888
+ uniform vec2 lensPosition;
889
+ uniform vec2 iResolution;
890
+ uniform vec3 colorGain;
891
+ uniform float starPoints;
892
+ uniform float glareSize;
893
+ uniform float flareSize;
894
+ uniform float flareSpeed;
895
+ uniform float flareShape;
896
+ uniform float haloScale;
897
+ uniform float opacity;
898
+ uniform bool animated;
899
+ uniform bool anamorphic;
900
+ uniform bool enabled;
901
+ uniform bool secondaryGhosts;
902
+ uniform bool starBurst;
903
+ uniform float ghostScale;
904
+ uniform bool aditionalStreaks;
905
+ uniform sampler2D lensDirtTexture;
906
+ vec2 vxtC;
907
+
908
+ 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);}
909
+ 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);}
910
+ 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);}
911
+ 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.;}}
912
+ 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));}
913
+ 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);}
914
+ 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;}
915
+ 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);}
916
+ 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;}
917
+ 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;}
918
+ 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;}
919
+ 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;}
920
+ 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);}
921
+ 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);}
922
+ 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;}
923
+ 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);}
924
+ 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);}
925
+ 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); }}
926
+ 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);}
927
+ 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));}
928
+ 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);}
929
+ `,
930
+ };
931
+ class LensFlareEffect extends Effect {
932
+ 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, } = {}) {
933
+ super('LensFlareEffect', LensFlareShader.fragmentShader, {
934
+ blendFunction,
935
+ uniforms: new Map([
936
+ ['enabled', new Uniform(enabled)],
937
+ ['glareSize', new Uniform(glareSize)],
938
+ ['lensPosition', new Uniform(lensPosition)],
939
+ ['iTime', new Uniform(0)],
940
+ ['iResolution', new Uniform(iResolution)],
941
+ ['starPoints', new Uniform(starPoints)],
942
+ ['flareSize', new Uniform(flareSize)],
943
+ ['flareSpeed', new Uniform(flareSpeed)],
944
+ ['flareShape', new Uniform(flareShape)],
945
+ ['animated', new Uniform(animated)],
946
+ ['anamorphic', new Uniform(anamorphic)],
947
+ ['colorGain', new Uniform(colorGain)],
948
+ ['lensDirtTexture', new Uniform(lensDirtTexture)],
949
+ ['haloScale', new Uniform(haloScale)],
950
+ ['secondaryGhosts', new Uniform(secondaryGhosts)],
951
+ ['aditionalStreaks', new Uniform(aditionalStreaks)],
952
+ ['ghostScale', new Uniform(ghostScale)],
953
+ ['starBurst', new Uniform(starBurst)],
954
+ ['opacity', new Uniform(opacity)],
955
+ ]),
956
+ });
957
+ }
958
+ update(_renderer, _inputBuffer, deltaTime) {
959
+ const iTime = this.uniforms.get('iTime');
960
+ if (iTime) {
961
+ iTime.value += deltaTime;
962
+ }
963
+ }
964
+ }
965
+ const defaultOptions$1 = {
966
+ position: new Vector3(-25, 6, -60),
967
+ followMouse: false,
968
+ smoothTime: 0.7,
969
+ };
970
+ class NgtpLensFlare {
971
+ constructor() {
972
+ this.autoEffect = injectAutoEffect();
973
+ this.store = injectNgtStore();
974
+ this.viewport = this.store.select('viewport');
975
+ this.raycaster = this.store.select('raycaster');
976
+ this.pointer = this.store.select('pointer');
977
+ this.composerApi = injectEffectComposerApi();
978
+ this.effectRef = input(injectNgtRef());
979
+ this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
980
+ this.projectedPosition = new Vector3();
981
+ this.mouse2d = new Vector2();
982
+ this.effect = computed(() => {
983
+ const { position: _, followMouse: __, smoothTime: ___, ...options } = this.options();
984
+ return new LensFlareEffect(options);
985
+ });
986
+ afterNextRender(() => {
987
+ this.autoEffect(() => {
988
+ const [effect, viewport] = [this.effect(), this.viewport()];
989
+ const iResolution = effect.uniforms.get('iResolution');
990
+ if (iResolution) {
991
+ iResolution.value.x = viewport.width;
992
+ iResolution.value.y = viewport.height;
993
+ }
994
+ });
995
+ });
996
+ injectBeforeRender(({ delta }) => {
997
+ const [effect] = [this.effect()];
998
+ if (!effect)
999
+ return;
1000
+ const [{ followMouse, position, smoothTime }, pointer, { camera, scene }, raycaster] = [
1001
+ this.options(),
1002
+ this.pointer(),
1003
+ this.composerApi(),
1004
+ this.raycaster(),
1005
+ ];
1006
+ const uLensPosition = effect.uniforms.get('lensPosition');
1007
+ const uOpacity = effect.uniforms.get('opacity');
1008
+ if (!uLensPosition || !uOpacity)
1009
+ return;
1010
+ let target = 1;
1011
+ if (followMouse) {
1012
+ uLensPosition.value.x = pointer.x;
1013
+ uLensPosition.value.y = pointer.y;
1014
+ target = 0;
1015
+ }
1016
+ else {
1017
+ this.projectedPosition.copy(position).project(camera);
1018
+ if (this.projectedPosition.z > 1)
1019
+ return;
1020
+ uLensPosition.value.x = this.projectedPosition.x;
1021
+ uLensPosition.value.y = this.projectedPosition.y;
1022
+ this.mouse2d.set(this.projectedPosition.x, this.projectedPosition.y);
1023
+ raycaster.setFromCamera(this.mouse2d, camera);
1024
+ const intersects = raycaster.intersectObjects(scene.children, true);
1025
+ const { object } = intersects[0] ?? {};
1026
+ if (object) {
1027
+ if (object.userData?.['lensflare'] === 'no-occlusion') {
1028
+ target = 0;
1029
+ }
1030
+ else if (object instanceof Mesh) {
1031
+ if (object.material.uniforms?._transmission?.value > 0.2) {
1032
+ //Check for MeshTransmissionMaterial
1033
+ target = 0.2;
1034
+ }
1035
+ else if (object.material._transmission && object.material._transmission > 0.2) {
1036
+ //Check for MeshPhysicalMaterial with transmission setting
1037
+ target = 0.2;
1038
+ }
1039
+ else if (object.material.transparent) {
1040
+ // Check for OtherMaterials with transparent parameter
1041
+ target = object.material.opacity;
1042
+ }
1043
+ }
1044
+ }
1045
+ }
1046
+ easing.damp(uOpacity, 'value', target, smoothTime, delta);
1047
+ });
1048
+ }
1049
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpLensFlare, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1050
+ 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: `
1051
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" [dispose]="null" ngtCompound />
1052
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1053
+ }
1054
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpLensFlare, decorators: [{
1055
+ type: Component,
1056
+ args: [{
1057
+ selector: 'ngtp-lens-flare',
1058
+ standalone: true,
1059
+ template: `
1060
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" [dispose]="null" ngtCompound />
1061
+ `,
1062
+ imports: [NgtArgs],
1063
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1064
+ changeDetection: ChangeDetectionStrategy.OnPush,
1065
+ }]
1066
+ }], ctorParameters: () => [] });
1067
+
1068
+ class NgtpLUT {
1069
+ constructor() {
1070
+ this.autoEffect = injectAutoEffect();
1071
+ this.store = injectNgtStore();
1072
+ this.invalidate = this.store.select('invalidate');
1073
+ this.effectRef = input(injectNgtRef());
1074
+ this.options = input({});
1075
+ this.lut = computed(() => this.options().lut);
1076
+ this.effect = computed(() => {
1077
+ const [lut, { lut: _, ...options }] = [this.lut(), this.options()];
1078
+ return new LUT3DEffect(lut, options);
1079
+ });
1080
+ afterNextRender(() => {
1081
+ this.autoEffect(() => {
1082
+ const [effect, { lut, tetrahedralInterpolation }, invalidate] = [
1083
+ this.effect(),
1084
+ this.options(),
1085
+ this.invalidate(),
1086
+ ];
1087
+ if (tetrahedralInterpolation)
1088
+ effect.tetrahedralInterpolation = tetrahedralInterpolation;
1089
+ if (lut)
1090
+ effect.lut = lut;
1091
+ invalidate();
1092
+ });
1093
+ });
1094
+ }
1095
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpLUT, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1096
+ 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: `
1097
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" [dispose]="null" ngtCompound />
1098
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1099
+ }
1100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpLUT, decorators: [{
1101
+ type: Component,
1102
+ args: [{
1103
+ selector: 'ngtp-lut',
1104
+ template: `
1105
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" [dispose]="null" ngtCompound />
1106
+ `,
1107
+ imports: [NgtArgs],
1108
+ standalone: true,
1109
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1110
+ changeDetection: ChangeDetectionStrategy.OnPush,
1111
+ }]
1112
+ }], ctorParameters: () => [] });
1113
+
1114
+ extend({ NoiseEffect });
1115
+ class NgtpNoise {
1116
+ constructor() {
1117
+ this.effect = inject(NgtpEffect, { host: true });
1118
+ this.options = input({});
1119
+ }
1120
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpNoise, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1121
+ 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: `
1122
+ <ngt-noise-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1123
+ <ngtp-effect-blend-mode />
1124
+ <ng-content />
1125
+ </ngt-noise-effect>
1126
+ `, 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 }); }
1127
+ }
1128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpNoise, decorators: [{
1129
+ type: Component,
1130
+ args: [{
1131
+ selector: 'ngtp-noise',
1132
+ template: `
1133
+ <ngt-noise-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1134
+ <ngtp-effect-blend-mode />
1135
+ <ng-content />
1136
+ </ngt-noise-effect>
1137
+ `,
1138
+ standalone: true,
1139
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1140
+ changeDetection: ChangeDetectionStrategy.OnPush,
1141
+ imports: [NgtArgs, NgtpEffectBlendMode],
1142
+ hostDirectives: [NgtpEffectHostDirective],
1143
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.COLOR_DODGE })],
1144
+ }]
1145
+ }] });
1146
+
1147
+ class NgtpPixelation {
1148
+ constructor() {
1149
+ this.effectRef = input(injectNgtRef());
1150
+ this.options = input({ granularity: 5 }, { transform: mergeInputs({ granularity: 5 }) });
1151
+ this.granularity = computed(() => this.options().granularity);
1152
+ this.effect = computed(() => new PixelationEffect(this.granularity()));
1153
+ }
1154
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpPixelation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1155
+ 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: `
1156
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" ngtCompound />
1157
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1158
+ }
1159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpPixelation, decorators: [{
1160
+ type: Component,
1161
+ args: [{
1162
+ selector: 'ngtp-pixelation',
1163
+ template: `
1164
+ <ngt-primitive *args="[effect()]" [ref]="effectRef()" ngtCompound />
1165
+ `,
1166
+ standalone: true,
1167
+ changeDetection: ChangeDetectionStrategy.OnPush,
1168
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1169
+ imports: [NgtArgs],
1170
+ }]
1171
+ }] });
1172
+
1173
+ extend({ ScanlineEffect });
1174
+ const defaultOptions = {
1175
+ density: 1.25,
1176
+ };
1177
+ class NgtpScanline {
1178
+ constructor() {
1179
+ this.effect = inject(NgtpEffect, { host: true });
1180
+ this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
1181
+ }
1182
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpScanline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1183
+ 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: `
1184
+ <ngt-scanline-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1185
+ <ngtp-effect-blend-mode />
1186
+ <ng-content />
1187
+ </ngt-scanline-effect>
1188
+ `, 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 }); }
1189
+ }
1190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpScanline, decorators: [{
1191
+ type: Component,
1192
+ args: [{
1193
+ selector: 'ngtp-scanline',
1194
+ template: `
1195
+ <ngt-scanline-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1196
+ <ngtp-effect-blend-mode />
1197
+ <ng-content />
1198
+ </ngt-scanline-effect>
1199
+ `,
1200
+ standalone: true,
1201
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1202
+ changeDetection: ChangeDetectionStrategy.OnPush,
1203
+ imports: [NgtArgs, NgtpEffectBlendMode],
1204
+ hostDirectives: [NgtpEffectHostDirective],
1205
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.OVERLAY })],
1206
+ }]
1207
+ }] });
1208
+
1209
+ extend({ SepiaEffect });
1210
+ class NgtpSepia {
1211
+ constructor() {
1212
+ this.effect = inject(NgtpEffect, { host: true });
1213
+ this.options = input({});
1214
+ }
1215
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpSepia, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1216
+ 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: `
1217
+ <ngt-sepia-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1218
+ <ngtp-effect-blend-mode />
1219
+ <ng-content />
1220
+ </ngt-sepia-effect>
1221
+ `, 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 }); }
1222
+ }
1223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpSepia, decorators: [{
1224
+ type: Component,
1225
+ args: [{
1226
+ selector: 'ngtp-sepia',
1227
+ template: `
1228
+ <ngt-sepia-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1229
+ <ngtp-effect-blend-mode />
1230
+ <ng-content />
1231
+ </ngt-sepia-effect>
1232
+ `,
1233
+ standalone: true,
1234
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1235
+ changeDetection: ChangeDetectionStrategy.OnPush,
1236
+ imports: [NgtArgs, NgtpEffectBlendMode],
1237
+ hostDirectives: [NgtpEffectHostDirective],
1238
+ }]
1239
+ }] });
1240
+
1241
+ extend({ ShockWaveEffect });
1242
+ class NgtpShockWave {
1243
+ constructor() {
1244
+ this.effect = inject(NgtpEffect, { host: true });
1245
+ this.options = input({});
1246
+ }
1247
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpShockWave, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1248
+ 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: `
1249
+ <ngt-shock-wave-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1250
+ <ngtp-effect-blend-mode />
1251
+ <ng-content />
1252
+ </ngt-shock-wave-effect>
1253
+ `, 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 }); }
1254
+ }
1255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpShockWave, decorators: [{
1256
+ type: Component,
1257
+ args: [{
1258
+ selector: 'ngtp-shock-wave',
1259
+ template: `
1260
+ <ngt-shock-wave-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1261
+ <ngtp-effect-blend-mode />
1262
+ <ng-content />
1263
+ </ngt-shock-wave-effect>
1264
+ `,
1265
+ standalone: true,
1266
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1267
+ changeDetection: ChangeDetectionStrategy.OnPush,
1268
+ imports: [NgtArgs, NgtpEffectBlendMode],
1269
+ hostDirectives: [NgtpEffectHostDirective],
1270
+ }]
1271
+ }] });
1272
+
1273
+ extend({ SMAAEffect });
1274
+ class NgtpSMAA {
1275
+ constructor() {
1276
+ this.effect = inject(NgtpEffect, { host: true });
1277
+ this.options = input({});
1278
+ }
1279
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpSMAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1280
+ 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: `
1281
+ <ngt-sMAA-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1282
+ <ngtp-effect-blend-mode />
1283
+ <ng-content />
1284
+ </ngt-sMAA-effect>
1285
+ `, 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 }); }
1286
+ }
1287
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpSMAA, decorators: [{
1288
+ type: Component,
1289
+ args: [{
1290
+ selector: 'ngtp-smaa',
1291
+ template: `
1292
+ <ngt-sMAA-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1293
+ <ngtp-effect-blend-mode />
1294
+ <ng-content />
1295
+ </ngt-sMAA-effect>
1296
+ `,
1297
+ standalone: true,
1298
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1299
+ changeDetection: ChangeDetectionStrategy.OnPush,
1300
+ imports: [NgtArgs, NgtpEffectBlendMode],
1301
+ hostDirectives: [NgtpEffectHostDirective],
1302
+ }]
1303
+ }] });
1304
+
1305
+ extend({ TiltShiftEffect });
1306
+ class NgtpTiltShift {
1307
+ constructor() {
1308
+ this.effect = inject(NgtpEffect, { host: true });
1309
+ this.options = input({});
1310
+ }
1311
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpTiltShift, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1312
+ 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: `
1313
+ <ngt-tilt-shift-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1314
+ <ngtp-effect-blend-mode />
1315
+ <ng-content />
1316
+ </ngt-tilt-shift-effect>
1317
+ `, 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 }); }
1318
+ }
1319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpTiltShift, decorators: [{
1320
+ type: Component,
1321
+ args: [{
1322
+ selector: 'ngtp-tilt-shift',
1323
+ template: `
1324
+ <ngt-tilt-shift-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1325
+ <ngtp-effect-blend-mode />
1326
+ <ng-content />
1327
+ </ngt-tilt-shift-effect>
1328
+ `,
1329
+ standalone: true,
1330
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1331
+ changeDetection: ChangeDetectionStrategy.OnPush,
1332
+ imports: [NgtArgs, NgtpEffectBlendMode],
1333
+ hostDirectives: [NgtpEffectHostDirective],
1334
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
1335
+ }]
1336
+ }] });
1337
+
1338
+ const TiltShiftShader = {
1339
+ fragmentShader: `
1340
+
1341
+ // original shader by Evan Wallace
1342
+
1343
+ #define MAX_ITERATIONS 100
1344
+
1345
+ uniform float blur;
1346
+ uniform float taper;
1347
+ uniform vec2 start;
1348
+ uniform vec2 end;
1349
+ uniform vec2 direction;
1350
+ uniform int samples;
1351
+
1352
+ float random(vec3 scale, float seed) {
1353
+ /* use the fragment position for a different seed per-pixel */
1354
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
1355
+ }
1356
+
1357
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
1358
+ vec4 color = vec4(0.0);
1359
+ float total = 0.0;
1360
+ vec2 startPixel = vec2(start.x * resolution.x, start.y * resolution.y);
1361
+ vec2 endPixel = vec2(end.x * resolution.x, end.y * resolution.y);
1362
+ float f_samples = float(samples);
1363
+ float half_samples = f_samples / 2.0;
1364
+
1365
+ // use screen diagonal to normalize blur radii
1366
+ float maxScreenDistance = distance(vec2(0.0), resolution); // diagonal distance
1367
+ float gradientRadius = taper * (maxScreenDistance);
1368
+ float blurRadius = blur * (maxScreenDistance / 16.0);
1369
+
1370
+ /* randomize the lookup values to hide the fixed number of samples */
1371
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
1372
+ vec2 normal = normalize(vec2(startPixel.y - endPixel.y, endPixel.x - startPixel.x));
1373
+ float radius = smoothstep(0.0, 1.0, abs(dot(uv * resolution - startPixel, normal)) / gradientRadius) * blurRadius;
1374
+
1375
+ #pragma unroll_loop_start
1376
+ for (int i = 0; i <= MAX_ITERATIONS; i++) {
1377
+ if (i >= samples) { break; } // return early if over sample count
1378
+ float f_i = float(i);
1379
+ float s_i = -half_samples + f_i;
1380
+ float percent = (s_i + offset - 0.5) / half_samples;
1381
+ float weight = 1.0 - abs(percent);
1382
+ vec4 sample_i = texture2D(inputBuffer, uv + normalize(direction) / resolution * percent * radius);
1383
+ /* switch to pre-multiplied alpha to correctly blur transparent images */
1384
+ sample_i.rgb *= sample_i.a;
1385
+ color += sample_i * weight;
1386
+ total += weight;
1387
+ }
1388
+ #pragma unroll_loop_end
1389
+
1390
+ outputColor = color / total;
1391
+
1392
+ /* switch back from pre-multiplied alpha */
1393
+ outputColor.rgb /= outputColor.a + 0.00001;
1394
+ }
1395
+ `,
1396
+ };
1397
+ class TiltShift2Effect extends Effect {
1398
+ constructor({ blendFunction = BlendFunction.NORMAL, blur = 0.15, // [0, 1], can go beyond 1 for extra
1399
+ taper = 0.5, // [0, 1], can go beyond 1 for extra
1400
+ start = [0.5, 0.0], // [0,1] percentage x,y of screenspace
1401
+ end = [0.5, 1.0], // [0,1] percentage x,y of screenspace
1402
+ samples = 10.0, // number of blur samples
1403
+ direction = [1, 1], // direction of blur
1404
+ } = {}) {
1405
+ super('TiltShiftEffect', TiltShiftShader.fragmentShader, {
1406
+ blendFunction,
1407
+ attributes: EffectAttribute.CONVOLUTION,
1408
+ uniforms: new Map([
1409
+ ['blur', new Uniform(blur)],
1410
+ ['taper', new Uniform(taper)],
1411
+ ['start', new Uniform(start)],
1412
+ ['end', new Uniform(end)],
1413
+ ['samples', new Uniform(samples)],
1414
+ ['direction', new Uniform(direction)],
1415
+ ]),
1416
+ });
1417
+ }
1418
+ }
1419
+ extend({ TiltShift2Effect });
1420
+ class NgtpTiltShift2 {
1421
+ constructor() {
1422
+ this.effect = inject(NgtpEffect, { host: true });
1423
+ this.options = input({});
1424
+ }
1425
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpTiltShift2, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1426
+ 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: `
1427
+ <ngt-tilt-shift2-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1428
+ <ngtp-effect-blend-mode />
1429
+ <ng-content />
1430
+ </ngt-tilt-shift2-effect>
1431
+ `, 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 }); }
1432
+ }
1433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpTiltShift2, decorators: [{
1434
+ type: Component,
1435
+ args: [{
1436
+ selector: 'ngtp-tilt-shift2',
1437
+ standalone: true,
1438
+ template: `
1439
+ <ngt-tilt-shift2-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1440
+ <ngtp-effect-blend-mode />
1441
+ <ng-content />
1442
+ </ngt-tilt-shift2-effect>
1443
+ `,
1444
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1445
+ changeDetection: ChangeDetectionStrategy.OnPush,
1446
+ imports: [NgtArgs, NgtpEffectBlendMode],
1447
+ hostDirectives: [NgtpEffectHostDirective],
1448
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
1449
+ }]
1450
+ }] });
1451
+
1452
+ extend({ VignetteEffect });
1453
+ class NgtpVignette {
1454
+ constructor() {
1455
+ this.effect = inject(NgtpEffect, { host: true });
1456
+ this.options = input({});
1457
+ }
1458
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpVignette, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1459
+ 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: `
1460
+ <ngt-vignette-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1461
+ <ngtp-effect-blend-mode />
1462
+ <ng-content />
1463
+ </ngt-vignette-effect>
1464
+ `, 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 }); }
1465
+ }
1466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpVignette, decorators: [{
1467
+ type: Component,
1468
+ args: [{
1469
+ selector: 'ngtp-vignette',
1470
+ template: `
1471
+ <ngt-vignette-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1472
+ <ngtp-effect-blend-mode />
1473
+ <ng-content />
1474
+ </ngt-vignette-effect>
1475
+ `,
1476
+ standalone: true,
1477
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1478
+ changeDetection: ChangeDetectionStrategy.OnPush,
1479
+ imports: [NgtArgs, NgtpEffectBlendMode],
1480
+ hostDirectives: [NgtpEffectHostDirective],
1481
+ }]
1482
+ }] });
1483
+
1484
+ const WaterShader = {
1485
+ fragmentShader: `
1486
+ uniform float factor;
1487
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
1488
+ vec2 vUv = uv;
1489
+ float frequency = 6.0 * factor;
1490
+ float amplitude = 0.015 * factor;
1491
+ float x = vUv.y * frequency + time * .7;
1492
+ float y = vUv.x * frequency + time * .3;
1493
+ vUv.x += cos(x+y) * amplitude * cos(y);
1494
+ vUv.y += sin(x-y) * amplitude * cos(y);
1495
+ vec4 rgba = texture2D(inputBuffer, vUv);
1496
+ outputColor = rgba;
1497
+ }`,
1498
+ };
1499
+ class WaterEffect extends Effect {
1500
+ constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
1501
+ super('WaterEffect', WaterShader.fragmentShader, {
1502
+ blendFunction,
1503
+ attributes: EffectAttribute.CONVOLUTION,
1504
+ uniforms: new Map([['factor', new Uniform(factor)]]),
1505
+ });
1506
+ }
1507
+ }
1508
+ extend({ WaterEffect });
1509
+ class NgtpWater {
1510
+ constructor() {
1511
+ this.effect = inject(NgtpEffect, { host: true });
1512
+ this.options = input({});
1513
+ }
1514
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpWater, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1515
+ 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: `
1516
+ <ngt-water-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1517
+ <ngtp-effect-blend-mode />
1518
+ <ng-content />
1519
+ </ngt-water-effect>
1520
+ `, 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 }); }
1521
+ }
1522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpWater, decorators: [{
1523
+ type: Component,
1524
+ args: [{
1525
+ selector: 'ngtp-water',
1526
+ standalone: true,
1527
+ template: `
1528
+ <ngt-water-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
1529
+ <ngtp-effect-blend-mode />
1530
+ <ng-content />
1531
+ </ngt-water-effect>
1532
+ `,
1533
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1534
+ changeDetection: ChangeDetectionStrategy.OnPush,
1535
+ imports: [NgtArgs, NgtpEffectBlendMode],
1536
+ hostDirectives: [NgtpEffectHostDirective],
1537
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
1538
+ }]
1539
+ }] });
1540
+
286
1541
  /**
287
1542
  * Generated bundle index. Do not edit.
288
1543
  */
289
1544
 
290
- export { NgtpBloom, NgtpEffect, NgtpEffectBlendMode, NgtpEffectComposer, NgtpEffectHostDirective, NgtpEffects, injectDefaultEffectOptions, provideDefaultEffectOptions };
1545
+ 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 };
291
1546
  //# sourceMappingURL=angular-three-postprocessing.mjs.map