angular-three-postprocessing 4.0.0-next.98 → 4.0.0

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 (44) hide show
  1. package/README.md +80 -21
  2. package/fesm2022/angular-three-postprocessing-n8ao.mjs +42 -7
  3. package/fesm2022/angular-three-postprocessing-n8ao.mjs.map +1 -1
  4. package/fesm2022/angular-three-postprocessing.mjs +1185 -241
  5. package/fesm2022/angular-three-postprocessing.mjs.map +1 -1
  6. package/n8ao/README.md +143 -0
  7. package/package.json +7 -7
  8. package/types/angular-three-postprocessing-n8ao.d.ts +167 -0
  9. package/types/angular-three-postprocessing.d.ts +1887 -0
  10. package/index.d.ts +0 -3
  11. package/lib/effect-composer.d.ts +0 -38
  12. package/lib/effect.d.ts +0 -52
  13. package/lib/effects/ascii.d.ts +0 -24
  14. package/lib/effects/bloom.d.ts +0 -11
  15. package/lib/effects/brightness-contrast.d.ts +0 -16
  16. package/lib/effects/chromatic-abberation.d.ts +0 -17
  17. package/lib/effects/color-average.d.ts +0 -12
  18. package/lib/effects/color-depth.d.ts +0 -15
  19. package/lib/effects/depth-of-field.d.ts +0 -20
  20. package/lib/effects/depth.d.ts +0 -15
  21. package/lib/effects/dot-screen.d.ts +0 -16
  22. package/lib/effects/fxaa.d.ts +0 -14
  23. package/lib/effects/glitch.d.ts +0 -32
  24. package/lib/effects/god-rays.d.ts +0 -32
  25. package/lib/effects/grid.d.ts +0 -18
  26. package/lib/effects/hue-saturation.d.ts +0 -16
  27. package/lib/effects/index.d.ts +0 -29
  28. package/lib/effects/lens-flare.d.ts +0 -94
  29. package/lib/effects/lut.d.ts +0 -18
  30. package/lib/effects/noise.d.ts +0 -15
  31. package/lib/effects/outline.d.ts +0 -73
  32. package/lib/effects/pixelation.d.ts +0 -17
  33. package/lib/effects/scanline.d.ts +0 -18
  34. package/lib/effects/selective-bloom.d.ts +0 -42
  35. package/lib/effects/sepia.d.ts +0 -15
  36. package/lib/effects/shock-wave.d.ts +0 -12
  37. package/lib/effects/smaa.d.ts +0 -16
  38. package/lib/effects/tilt-shift-2.d.ts +0 -35
  39. package/lib/effects/tilt-shift.d.ts +0 -23
  40. package/lib/effects/tone-mapping.d.ts +0 -23
  41. package/lib/effects/vignette.d.ts +0 -18
  42. package/lib/effects/water.d.ts +0 -21
  43. package/n8ao/index.d.ts +0 -1
  44. package/n8ao/lib/n8ao.d.ts +0 -35
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This is the main entry point for post-processing effects in Angular Three. It provides a way to apply various visual effects to your 3D scene after it has been rendered. This library relies on `maath`, `three-stdlib`, and `postprocessing` as dependencies.
4
4
 
5
+ ## Documentation
6
+
7
+ All public APIs are documented with JSDoc comments. Your IDE will provide inline documentation, parameter hints, and examples as you code.
8
+
5
9
  ## Installation
6
10
 
7
11
  ```bash
@@ -14,7 +18,16 @@ npm install angular-three-postprocessing three-stdlib maath postprocessing
14
18
 
15
19
  This is a wrapper component that manages and applies post-processing effects to your scene. It takes content children of effects and applies them in the order they are provided.
16
20
 
17
- ### Object Inputs (NgtpEffectComposerOptions)
21
+ ### Usage
22
+
23
+ ```html
24
+ <ngtp-effect-composer [options]="{ multisampling: 0 }">
25
+ <ngtp-bloom [options]="{ luminanceThreshold: 0.9, intensity: 0.5 }" />
26
+ <ngtp-vignette [options]="{ darkness: 0.5 }" />
27
+ </ngtp-effect-composer>
28
+ ```
29
+
30
+ ### Options (NgtpEffectComposerOptions)
18
31
 
19
32
  | Property | Description | Default Value |
20
33
  | ------------------ | ------------------------------------------------------------------------------------------------- | ------------- |
@@ -30,30 +43,76 @@ This is a wrapper component that manages and applies post-processing effects to
30
43
  | `camera` | The camera to use for rendering. If not provided, the default camera from the store will be used. | undefined |
31
44
  | `scene` | The scene to render. If not provided, the default scene from the store will be used. | undefined |
32
45
 
33
- ````html
34
- <ngtp-effect-composer [options]="{ multisampling: 0, frameBufferType: FloatType, enableNormalPass: true }">
35
- <ngtp-bloom />
36
- </ngtp-effect-composer>
37
- ```
38
- ````
46
+ ## Effects
47
+
48
+ All effects are available from `angular-three-postprocessing`:
39
49
 
40
- ### NgtpEffectComposerApi
50
+ | Effect | Selector | Description |
51
+ | ------------------------- | --------------------------- | ------------------------------------- |
52
+ | `NgtpAscii` | `ngtp-ascii` | ASCII art effect |
53
+ | `NgtpBloom` | `ngtp-bloom` | Bloom/glow effect |
54
+ | `NgtpBrightnessContrast` | `ngtp-brightness-contrast` | Brightness and contrast adjustment |
55
+ | `NgtpChromaticAberration` | `ngtp-chromatic-aberration` | Chromatic aberration effect |
56
+ | `NgtpColorAverage` | `ngtp-color-average` | Color averaging effect |
57
+ | `NgtpColorDepth` | `ngtp-color-depth` | Color depth reduction |
58
+ | `NgtpDepth` | `ngtp-depth` | Depth visualization |
59
+ | `NgtpDepthOfField` | `ngtp-depth-of-field` | Depth of field effect |
60
+ | `NgtpDotScreen` | `ngtp-dot-screen` | Dot screen effect |
61
+ | `NgtpFXAA` | `ngtp-fxaa` | Fast approximate anti-aliasing |
62
+ | `NgtpGlitch` | `ngtp-glitch` | Glitch effect |
63
+ | `NgtpGodRays` | `ngtp-god-rays` | God rays/light shafts |
64
+ | `NgtpGrid` | `ngtp-grid` | Grid overlay |
65
+ | `NgtpHueSaturation` | `ngtp-hue-saturation` | Hue and saturation adjustment |
66
+ | `NgtpLensFlare` | `ngtp-lens-flare` | Lens flare effect |
67
+ | `NgtpLUT` | `ngtp-lut` | LUT (Look-Up Table) color grading |
68
+ | `NgtpNoise` | `ngtp-noise` | Noise effect |
69
+ | `NgtpOutline` | `ngtp-outline` | Outline effect |
70
+ | `NgtpPixelation` | `ngtp-pixelation` | Pixelation effect |
71
+ | `NgtpScanline` | `ngtp-scanline` | Scanline effect |
72
+ | `NgtpSelectiveBloom` | `ngtp-selective-bloom` | Selective bloom on specific objects |
73
+ | `NgtpSepia` | `ngtp-sepia` | Sepia tone effect |
74
+ | `NgtpShockWave` | `ngtp-shock-wave` | Shock wave distortion |
75
+ | `NgtpSMAA` | `ngtp-smaa` | Subpixel morphological anti-aliasing |
76
+ | `NgtpTiltShift` | `ngtp-tilt-shift` | Tilt-shift blur |
77
+ | `NgtpTiltShift2` | `ngtp-tilt-shift-2` | Alternative tilt-shift implementation |
78
+ | `NgtpToneMapping` | `ngtp-tone-mapping` | Tone mapping |
79
+ | `NgtpVignette` | `ngtp-vignette` | Vignette darkening |
80
+ | `NgtpWater` | `ngtp-water` | Water effect |
41
81
 
42
- This is an interface that provides access to the underlying `NgtpEffectComposer` instance, as well as the `camera` and `scene` being used. It also includes references to the `NormalPass` and `DepthDownsamplingPass` if they are enabled
82
+ ### Effect Example
43
83
 
44
- ```ts
45
- export interface NgtpEffectComposerApi {
46
- composer: EffectComposer;
47
- camera: Camera;
48
- scene: Scene;
49
- normalPass: NormalPass | null;
50
- downSamplingPass: DepthDownsamplingPass | null;
51
- resolutionScale?: number;
52
- }
84
+ ```typescript
85
+ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
86
+ import { NgtpEffectComposer, NgtpBloom, NgtpVignette, NgtpNoise } from 'angular-three-postprocessing';
87
+
88
+ @Component({
89
+ template: `
90
+ <ngtp-effect-composer>
91
+ <ngtp-bloom [options]="{ luminanceThreshold: 0.9, luminanceSmoothing: 0.025, intensity: 0.5 }" />
92
+ <ngtp-noise [options]="{ opacity: 0.02 }" />
93
+ <ngtp-vignette [options]="{ eskil: false, offset: 0.1, darkness: 1.1 }" />
94
+ </ngtp-effect-composer>
95
+ `,
96
+ imports: [NgtpEffectComposer, NgtpBloom, NgtpVignette, NgtpNoise],
97
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
98
+ })
99
+ export class PostProcessing {}
53
100
  ```
54
101
 
55
- To retrieve the `NgtpEffectComposerApi` for components within `<ngtp-effect-composer />`, you can use the `injectEffectComposerApi` function.
102
+ ## N8AO (Ambient Occlusion)
56
103
 
57
- ## Effects
104
+ A separate sub-library provides N8 Ambient Occlusion:
105
+
106
+ ```bash
107
+ npm install n8ao
108
+ ```
58
109
 
59
- TBD
110
+ ```typescript
111
+ import { NgtpN8AO } from 'angular-three-postprocessing/n8ao';
112
+ ```
113
+
114
+ ```html
115
+ <ngtp-effect-composer [options]="{ enableNormalPass: true }">
116
+ <ngtp-n8ao [options]="{ aoRadius: 0.5, intensity: 1 }" />
117
+ </ngtp-effect-composer>
118
+ ```
@@ -1,6 +1,6 @@
1
1
  import { N8AOPostPass } from 'n8ao';
2
2
  import * as i0 from '@angular/core';
3
- import { input, inject, computed, effect, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy } from '@angular/core';
3
+ import { input, inject, computed, effect, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
4
4
  import { pick, applyProps, NgtArgs } from 'angular-three';
5
5
  import { NgtpEffectComposer } from 'angular-three-postprocessing';
6
6
  import { mergeInputs } from 'ngxtension/inject-inputs';
@@ -28,15 +28,46 @@ const defaultOptions = {
28
28
  transparencyAware: false,
29
29
  accumulate: false,
30
30
  };
31
+ /**
32
+ * Angular component that applies N8AO (N8 Ambient Occlusion) to the scene.
33
+ *
34
+ * N8AO is a high-quality screen-space ambient occlusion effect that adds
35
+ * realistic shadowing to crevices, corners, and areas where objects meet.
36
+ * It provides various quality presets and fine-grained control over the
37
+ * AO appearance.
38
+ *
39
+ * @example
40
+ * ```html
41
+ * <ngtp-effect-composer>
42
+ * <ngtp-n8ao [options]="{ intensity: 3, aoRadius: 2 }" />
43
+ * </ngtp-effect-composer>
44
+ * ```
45
+ *
46
+ * @example
47
+ * ```html
48
+ * <!-- Using quality preset -->
49
+ * <ngtp-effect-composer>
50
+ * <ngtp-n8ao [options]="{ quality: 'high' }" />
51
+ * </ngtp-effect-composer>
52
+ * ```
53
+ */
31
54
  class NgtpN8AO {
32
55
  constructor() {
33
- this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
56
+ /**
57
+ * Configuration options for the N8AO effect.
58
+ * @see NgtpN8AOOptions
59
+ */
60
+ this.options = input(defaultOptions, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions) });
34
61
  this.quality = pick(this.options, 'quality');
35
62
  this.effectComposer = inject(NgtpEffectComposer);
63
+ /**
64
+ * The underlying N8AOPostPass instance.
65
+ * Created with the scene and camera from the effect composer.
66
+ */
36
67
  this.effect = computed(() => {
37
68
  const [scene, camera] = [this.effectComposer.scene(), this.effectComposer.camera()];
38
69
  return new N8AOPostPass(scene, camera);
39
- });
70
+ }, ...(ngDevMode ? [{ debugName: "effect" }] : []));
40
71
  effect(() => {
41
72
  const n8aoEffect = this.effect();
42
73
  if (!n8aoEffect)
@@ -52,6 +83,10 @@ class NgtpN8AO {
52
83
  onCleanup(() => effect.dispose());
53
84
  });
54
85
  }
86
+ /**
87
+ * Applies a quality preset to the effect.
88
+ * Converts the quality string to title case and calls the effect's setQuality method.
89
+ */
55
90
  setQualityEffect() {
56
91
  const effect = this.effect();
57
92
  if (!effect)
@@ -62,12 +97,12 @@ class NgtpN8AO {
62
97
  const titleCaseQuality = quality.charAt(0).toUpperCase() + quality.slice(1);
63
98
  effect.setQuality(titleCaseQuality);
64
99
  }
65
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: NgtpN8AO, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
66
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.1", type: NgtpN8AO, isStandalone: true, selector: "ngtp-n8ao", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpN8AO, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
101
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpN8AO, isStandalone: true, selector: "ngtp-n8ao", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
67
102
  <ngt-primitive *args="[effect()]" />
68
103
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
69
104
  }
70
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: NgtpN8AO, decorators: [{
105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpN8AO, decorators: [{
71
106
  type: Component,
72
107
  args: [{
73
108
  selector: 'ngtp-n8ao',
@@ -78,7 +113,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
78
113
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
79
114
  changeDetection: ChangeDetectionStrategy.OnPush,
80
115
  }]
81
- }], ctorParameters: () => [] });
116
+ }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
82
117
 
83
118
  /**
84
119
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"angular-three-postprocessing-n8ao.mjs","sources":["../../../../libs/postprocessing/n8ao/src/lib/n8ao.ts","../../../../libs/postprocessing/n8ao/src/angular-three-postprocessing-n8ao.ts"],"sourcesContent":["// @ts-expect-error - n8ao is not typed\nimport { N8AOPostPass } from 'n8ao';\n\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tCUSTOM_ELEMENTS_SCHEMA,\n\teffect,\n\tinject,\n\tinput,\n} from '@angular/core';\nimport { applyProps, NgtArgs, pick } from 'angular-three';\nimport { NgtpEffectComposer } from 'angular-three-postprocessing';\nimport { mergeInputs } from 'ngxtension/inject-inputs';\nimport * as THREE from 'three';\n\nexport interface NgtpN8AOOptions {\n\taoRadius: number;\n\taoTones: number;\n\tdistanceFalloff: number;\n\tintensity: number;\n\tbiasOffset: number;\n\tbiasMultiplier: number;\n\taoSamples: number;\n\tdenoiseSamples: number;\n\tdenoiseRadius: number;\n\tcolor: THREE.ColorRepresentation;\n\thalfRes: boolean;\n\tdepthAwareUpsampling: boolean;\n\tscreenSpaceRadius: boolean;\n\trenderMode: 0 | 1 | 2 | 3 | 4;\n\tdenoiseIterations: number;\n\ttransparencyAware: boolean;\n\tgammaCorrection: boolean;\n\tlogarithmicDepthBuffer: boolean;\n\tcolorMultiply: boolean;\n\taccumulate: boolean;\n\tquality?: 'performance' | 'low' | 'medium' | 'high' | 'ultra';\n}\n\nconst defaultOptions: NgtpN8AOOptions = {\n\taoSamples: 16,\n\taoRadius: 5.0,\n\taoTones: 0.0,\n\tdenoiseSamples: 8,\n\tdenoiseRadius: 12,\n\tdistanceFalloff: 1.0,\n\tintensity: 5,\n\tdenoiseIterations: 2.0,\n\trenderMode: 0,\n\tbiasOffset: 0.0,\n\tbiasMultiplier: 0.0,\n\tcolor: 'black',\n\tgammaCorrection: true,\n\tlogarithmicDepthBuffer: false,\n\tscreenSpaceRadius: false,\n\thalfRes: false,\n\tdepthAwareUpsampling: true,\n\tcolorMultiply: true,\n\ttransparencyAware: false,\n\taccumulate: false,\n};\n\n@Component({\n\tselector: 'ngtp-n8ao',\n\ttemplate: `\n\t\t<ngt-primitive *args=\"[effect()]\" />\n\t`,\n\timports: [NgtArgs],\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgtpN8AO {\n\toptions = input(defaultOptions, { transform: mergeInputs(defaultOptions) });\n\n\tprivate quality = pick(this.options, 'quality');\n\n\tprivate effectComposer = inject(NgtpEffectComposer);\n\n\tprotected effect = computed(() => {\n\t\tconst [scene, camera] = [this.effectComposer.scene(), this.effectComposer.camera()];\n\t\treturn new N8AOPostPass(scene, camera);\n\t});\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst n8aoEffect = this.effect();\n\t\t\tif (!n8aoEffect) return;\n\n\t\t\tconst { quality: _, ...configurations } = this.options();\n\t\t\tapplyProps(n8aoEffect.configuration, configurations);\n\t\t});\n\n\t\teffect(() => {\n\t\t\tthis.setQualityEffect();\n\t\t});\n\n\t\teffect((onCleanup) => {\n\t\t\tconst effect = this.effect();\n\t\t\tonCleanup(() => effect.dispose());\n\t\t});\n\t}\n\n\tprivate setQualityEffect() {\n\t\tconst effect = this.effect();\n\t\tif (!effect) return;\n\n\t\tconst quality = this.quality();\n\t\tif (!quality) return;\n\n\t\tconst titleCaseQuality = quality.charAt(0).toUpperCase() + quality.slice(1);\n\t\teffect.setQuality(titleCaseQuality);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;AAyCA,MAAM,cAAc,GAAoB;AACvC,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,QAAQ,EAAE,GAAG;AACb,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,aAAa,EAAE,EAAE;AACjB,IAAA,eAAe,EAAE,GAAG;AACpB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,iBAAiB,EAAE,GAAG;AACtB,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,cAAc,EAAE,GAAG;AACnB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,sBAAsB,EAAE,KAAK;AAC7B,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,oBAAoB,EAAE,IAAI;AAC1B,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,UAAU,EAAE,KAAK;CACjB;MAWY,QAAQ,CAAA;AAYpB,IAAA,WAAA,GAAA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AE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA;;;ACxED;;AAEG;;;;"}
1
+ {"version":3,"file":"angular-three-postprocessing-n8ao.mjs","sources":["../../../../libs/postprocessing/n8ao/src/lib/n8ao.ts","../../../../libs/postprocessing/n8ao/src/angular-three-postprocessing-n8ao.ts"],"sourcesContent":["// @ts-expect-error - n8ao is not typed\nimport { N8AOPostPass } from 'n8ao';\n\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tCUSTOM_ELEMENTS_SCHEMA,\n\teffect,\n\tinject,\n\tinput,\n} from '@angular/core';\nimport { applyProps, NgtArgs, pick } from 'angular-three';\nimport { NgtpEffectComposer } from 'angular-three-postprocessing';\nimport { mergeInputs } from 'ngxtension/inject-inputs';\nimport * as THREE from 'three';\n\n/**\n * Configuration options for the N8AO (N8 Ambient Occlusion) effect.\n *\n * N8AO is a high-quality, screen-space ambient occlusion implementation\n * that provides realistic shadowing in crevices and corners.\n */\nexport interface NgtpN8AOOptions {\n\t/**\n\t * Radius of the ambient occlusion effect in world units.\n\t * @default 5.0\n\t */\n\taoRadius: number;\n\n\t/**\n\t * Number of tones for AO gradient.\n\t * @default 0.0\n\t */\n\taoTones: number;\n\n\t/**\n\t * How quickly the AO effect falls off with distance.\n\t * @default 1.0\n\t */\n\tdistanceFalloff: number;\n\n\t/**\n\t * Intensity/strength of the ambient occlusion effect.\n\t * @default 5\n\t */\n\tintensity: number;\n\n\t/**\n\t * Bias offset for depth comparison.\n\t * @default 0.0\n\t */\n\tbiasOffset: number;\n\n\t/**\n\t * Bias multiplier for depth comparison.\n\t * @default 0.0\n\t */\n\tbiasMultiplier: number;\n\n\t/**\n\t * Number of samples for ambient occlusion calculation.\n\t * Higher values = better quality but slower.\n\t * @default 16\n\t */\n\taoSamples: number;\n\n\t/**\n\t * Number of samples for denoising.\n\t * @default 8\n\t */\n\tdenoiseSamples: number;\n\n\t/**\n\t * Radius of the denoising filter.\n\t * @default 12\n\t */\n\tdenoiseRadius: number;\n\n\t/**\n\t * Color of the ambient occlusion shadows.\n\t * @default 'black'\n\t */\n\tcolor: THREE.ColorRepresentation;\n\n\t/**\n\t * Whether to render at half resolution for better performance.\n\t * @default false\n\t */\n\thalfRes: boolean;\n\n\t/**\n\t * Whether to use depth-aware upsampling when using half resolution.\n\t * @default true\n\t */\n\tdepthAwareUpsampling: boolean;\n\n\t/**\n\t * Whether to use screen-space radius instead of world-space.\n\t * @default false\n\t */\n\tscreenSpaceRadius: boolean;\n\n\t/**\n\t * Render mode for debugging and visualization.\n\t * 0: Combined, 1: AO only, 2: Normals, 3: Depth, 4: Denoise\n\t * @default 0\n\t */\n\trenderMode: 0 | 1 | 2 | 3 | 4;\n\n\t/**\n\t * Number of iterations for the denoising filter.\n\t * @default 2.0\n\t */\n\tdenoiseIterations: number;\n\n\t/**\n\t * Whether to handle transparent objects correctly.\n\t * @default false\n\t */\n\ttransparencyAware: boolean;\n\n\t/**\n\t * Whether to apply gamma correction.\n\t * @default true\n\t */\n\tgammaCorrection: boolean;\n\n\t/**\n\t * Whether to use logarithmic depth buffer.\n\t * @default false\n\t */\n\tlogarithmicDepthBuffer: boolean;\n\n\t/**\n\t * Whether to multiply the color instead of darkening.\n\t * @default true\n\t */\n\tcolorMultiply: boolean;\n\n\t/**\n\t * Whether to accumulate samples over frames for better quality.\n\t * @default false\n\t */\n\taccumulate: boolean;\n\n\t/**\n\t * Quality preset that overrides individual settings.\n\t * Options: 'performance', 'low', 'medium', 'high', 'ultra'\n\t * @default undefined\n\t */\n\tquality?: 'performance' | 'low' | 'medium' | 'high' | 'ultra';\n}\n\nconst defaultOptions: NgtpN8AOOptions = {\n\taoSamples: 16,\n\taoRadius: 5.0,\n\taoTones: 0.0,\n\tdenoiseSamples: 8,\n\tdenoiseRadius: 12,\n\tdistanceFalloff: 1.0,\n\tintensity: 5,\n\tdenoiseIterations: 2.0,\n\trenderMode: 0,\n\tbiasOffset: 0.0,\n\tbiasMultiplier: 0.0,\n\tcolor: 'black',\n\tgammaCorrection: true,\n\tlogarithmicDepthBuffer: false,\n\tscreenSpaceRadius: false,\n\thalfRes: false,\n\tdepthAwareUpsampling: true,\n\tcolorMultiply: true,\n\ttransparencyAware: false,\n\taccumulate: false,\n};\n\n/**\n * Angular component that applies N8AO (N8 Ambient Occlusion) to the scene.\n *\n * N8AO is a high-quality screen-space ambient occlusion effect that adds\n * realistic shadowing to crevices, corners, and areas where objects meet.\n * It provides various quality presets and fine-grained control over the\n * AO appearance.\n *\n * @example\n * ```html\n * <ngtp-effect-composer>\n * <ngtp-n8ao [options]=\"{ intensity: 3, aoRadius: 2 }\" />\n * </ngtp-effect-composer>\n * ```\n *\n * @example\n * ```html\n * <!-- Using quality preset -->\n * <ngtp-effect-composer>\n * <ngtp-n8ao [options]=\"{ quality: 'high' }\" />\n * </ngtp-effect-composer>\n * ```\n */\n@Component({\n\tselector: 'ngtp-n8ao',\n\ttemplate: `\n\t\t<ngt-primitive *args=\"[effect()]\" />\n\t`,\n\timports: [NgtArgs],\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgtpN8AO {\n\t/**\n\t * Configuration options for the N8AO effect.\n\t * @see NgtpN8AOOptions\n\t */\n\toptions = input(defaultOptions, { transform: mergeInputs(defaultOptions) });\n\n\tprivate quality = pick(this.options, 'quality');\n\n\tprivate effectComposer = inject(NgtpEffectComposer);\n\n\t/**\n\t * The underlying N8AOPostPass instance.\n\t * Created with the scene and camera from the effect composer.\n\t */\n\tprotected effect = computed(() => {\n\t\tconst [scene, camera] = [this.effectComposer.scene(), this.effectComposer.camera()];\n\t\treturn new N8AOPostPass(scene, camera);\n\t});\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst n8aoEffect = this.effect();\n\t\t\tif (!n8aoEffect) return;\n\n\t\t\tconst { quality: _, ...configurations } = this.options();\n\t\t\tapplyProps(n8aoEffect.configuration, configurations);\n\t\t});\n\n\t\teffect(() => {\n\t\t\tthis.setQualityEffect();\n\t\t});\n\n\t\teffect((onCleanup) => {\n\t\t\tconst effect = this.effect();\n\t\t\tonCleanup(() => effect.dispose());\n\t\t});\n\t}\n\n\t/**\n\t * Applies a quality preset to the effect.\n\t * Converts the quality string to title case and calls the effect's setQuality method.\n\t */\n\tprivate setQualityEffect() {\n\t\tconst effect = this.effect();\n\t\tif (!effect) return;\n\n\t\tconst quality = this.quality();\n\t\tif (!quality) return;\n\n\t\tconst titleCaseQuality = quality.charAt(0).toUpperCase() + quality.slice(1);\n\t\teffect.setQuality(titleCaseQuality);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;AA0JA,MAAM,cAAc,GAAoB;AACvC,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,QAAQ,EAAE,GAAG;AACb,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,aAAa,EAAE,EAAE;AACjB,IAAA,eAAe,EAAE,GAAG;AACpB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,iBAAiB,EAAE,GAAG;AACtB,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,cAAc,EAAE,GAAG;AACnB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,sBAAsB,EAAE,KAAK;AAC7B,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,oBAAoB,EAAE,IAAI;AAC1B,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,UAAU,EAAE,KAAK;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;AAsBG;MAUU,QAAQ,CAAA;AAoBpB,IAAA,WAAA,GAAA;AAnBA;;;AAGG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC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