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

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 (45) hide show
  1. package/esm2022/lib/effect-composer.mjs +127 -173
  2. package/esm2022/lib/effect.mjs +45 -70
  3. package/esm2022/lib/effects/bloom.mjs +39 -0
  4. package/esm2022/lib/effects/index.mjs +2 -18
  5. package/fesm2022/angular-three-postprocessing.mjs +183 -888
  6. package/fesm2022/angular-three-postprocessing.mjs.map +1 -1
  7. package/lib/effect-composer.d.ts +37 -81
  8. package/lib/effect.d.ts +55 -24
  9. package/lib/effects/bloom.d.ts +10 -0
  10. package/lib/effects/index.d.ts +1 -17
  11. package/package.json +48 -46
  12. package/esm2022/lib/effects/bloom/bloom.mjs +0 -33
  13. package/esm2022/lib/effects/brightness-contrast/brightness-contrast.mjs +0 -29
  14. package/esm2022/lib/effects/color-depth/color-depth.mjs +0 -29
  15. package/esm2022/lib/effects/depth/depth.mjs +0 -29
  16. package/esm2022/lib/effects/dot-screen/dot-screen.mjs +0 -29
  17. package/esm2022/lib/effects/hue-saturation/hue-saturation.mjs +0 -29
  18. package/esm2022/lib/effects/lut/lut.mjs +0 -74
  19. package/esm2022/lib/effects/noise/noise.mjs +0 -33
  20. package/esm2022/lib/effects/pixelation/pixelation.mjs +0 -37
  21. package/esm2022/lib/effects/scanline/scanline.mjs +0 -33
  22. package/esm2022/lib/effects/sepia/sepia.mjs +0 -29
  23. package/esm2022/lib/effects/shock-wave/shock-wave.mjs +0 -29
  24. package/esm2022/lib/effects/smaa/smaa.mjs +0 -29
  25. package/esm2022/lib/effects/ssao/ssao.mjs +0 -217
  26. package/esm2022/lib/effects/tilt-shift/tilt-shift.mjs +0 -33
  27. package/esm2022/lib/effects/tone-mapping/tone-mapping.mjs +0 -29
  28. package/esm2022/lib/effects/vignette/vignette.mjs +0 -29
  29. package/lib/effects/bloom/bloom.d.ts +0 -13
  30. package/lib/effects/brightness-contrast/brightness-contrast.d.ts +0 -15
  31. package/lib/effects/color-depth/color-depth.d.ts +0 -14
  32. package/lib/effects/depth/depth.d.ts +0 -14
  33. package/lib/effects/dot-screen/dot-screen.d.ts +0 -15
  34. package/lib/effects/hue-saturation/hue-saturation.d.ts +0 -15
  35. package/lib/effects/lut/lut.d.ts +0 -29
  36. package/lib/effects/noise/noise.d.ts +0 -15
  37. package/lib/effects/pixelation/pixelation.d.ts +0 -20
  38. package/lib/effects/scanline/scanline.d.ts +0 -15
  39. package/lib/effects/sepia/sepia.d.ts +0 -14
  40. package/lib/effects/shock-wave/shock-wave.d.ts +0 -17
  41. package/lib/effects/smaa/smaa.d.ts +0 -16
  42. package/lib/effects/ssao/ssao.d.ts +0 -42
  43. package/lib/effects/tilt-shift/tilt-shift.d.ts +0 -23
  44. package/lib/effects/tone-mapping/tone-mapping.d.ts +0 -22
  45. package/lib/effects/vignette/vignette.d.ts +0 -17
@@ -1,223 +1,212 @@
1
1
  import * as i0 from '@angular/core';
2
- import { computed, effect, Directive, Input, forwardRef, inject, Injector, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
- import { signalStore, injectNgtRef, injectNgtStore, getLocalState, is, extend, createInjectionToken, injectBeforeRender, NgtArgs } from 'angular-three';
4
- import { BlendFunction, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, BloomEffect, BrightnessContrastEffect, ColorDepthEffect, DepthEffect, DotScreenEffect, HueSaturationEffect, LUT3DEffect, NoiseEffect, PixelationEffect, ScanlineEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, SSAOEffect, TiltShiftEffect, ToneMappingEffect, VignetteEffect } from 'postprocessing';
5
- import * as THREE from 'three';
6
- import { Group } from 'three';
2
+ import { inject, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, input, Directive, Injector, computed, viewChild, ViewContainerRef, contentChild, TemplateRef, afterNextRender } from '@angular/core';
3
+ import { injectNgtRef, injectNgtStore, extend, injectBeforeRender, getLocalState, NgtArgs } from 'angular-three';
4
+ import { injectAutoEffect } from 'ngxtension/auto-effect';
5
+ import { createNoopInjectionToken } from 'ngxtension/create-injection-token';
6
+ import { mergeInputs } from 'ngxtension/inject-inputs';
7
+ import { EffectAttribute, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, BloomEffect, BlendFunction } from 'postprocessing';
8
+ import { Group, HalfFloatType, NoToneMapping } from 'three';
7
9
  import { isWebGL2Available } from 'three-stdlib';
8
10
 
11
+ const [injectDefaultEffectOptions, provideDefaultEffectOptions] = createNoopInjectionToken('Default Effect options');
12
+ class NgtpEffectBlendMode {
13
+ constructor() {
14
+ this.effect = inject(NgtpEffect, { optional: true });
15
+ }
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffectBlendMode, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
17
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.3", type: NgtpEffectBlendMode, isStandalone: true, selector: "ngtp-effect-blend-mode", ngImport: i0, template: `
18
+ @if (effect) {
19
+ <ngt-value [rawValue]="effect.blendFunction()" attach="blendMode.blendFunction" />
20
+ <ngt-value [rawValue]="effect.opacity()" attach="blendMode.opacity.value" />
21
+ }
22
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
23
+ }
24
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffectBlendMode, decorators: [{
25
+ type: Component,
26
+ args: [{
27
+ selector: 'ngtp-effect-blend-mode',
28
+ standalone: true,
29
+ template: `
30
+ @if (effect) {
31
+ <ngt-value [rawValue]="effect.blendFunction()" attach="blendMode.blendFunction" />
32
+ <ngt-value [rawValue]="effect.opacity()" attach="blendMode.opacity.value" />
33
+ }
34
+ `,
35
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
36
+ changeDetection: ChangeDetectionStrategy.OnPush,
37
+ }]
38
+ }] });
9
39
  class NgtpEffect {
10
- set _blendFunction(blendFunction) {
11
- this.inputs.set({ blendFunction });
12
- }
13
- set _opacity(opacity) {
14
- this.inputs.set({ opacity });
15
- }
16
40
  constructor() {
17
- this.inputs = signalStore();
18
- this.effectRef = injectNgtRef();
19
- this.defaultBlendFunction = BlendFunction.NORMAL;
20
- this.nativeArgs = () => [];
21
- this.blendFunction = this.inputs.select('blendFunction');
22
- this.opacity = this.inputs.select('opacity');
41
+ this.defaultEffectOptions = injectDefaultEffectOptions({ optional: true });
42
+ this.effectRef = input(injectNgtRef());
43
+ this.blendFunction = input(this.defaultEffectOptions?.blendFunction);
44
+ this.opacity = input(this.defaultEffectOptions?.opacity);
45
+ this.autoEffect = injectAutoEffect();
23
46
  this.store = injectNgtStore();
24
47
  this.camera = this.store.select('camera');
25
48
  this.invalidate = this.store.select('invalidate');
26
- this.nativeInputs = computed(() => {
27
- const effect = this.effectRef.nativeElement;
28
- if (!effect)
29
- return this.previousInputs || null;
30
- const localState = getLocalState(effect);
31
- if (!localState)
32
- return this.previousInputs || null;
33
- const nativeProps = localState.nativeProps.state();
34
- delete nativeProps['__ngt_dummy_state__'];
35
- if ('camera' in nativeProps) {
36
- delete nativeProps['camera'];
37
- }
38
- if (!Object.keys(nativeProps).length)
39
- return this.previousInputs || null;
40
- return (this.previousInputs = nativeProps);
41
- }, { equal: (a, b) => is.equ(a, b, { objects: 'shallow' }) });
42
- this.args = computed(() => {
43
- const [nativeInputs, nativeArgs] = [this.nativeInputs(), this.nativeArgs()];
44
- if (nativeInputs) {
45
- nativeArgs.push(nativeInputs);
46
- }
47
- return nativeArgs;
48
- });
49
- this.setBlendMode();
50
- }
51
- setBlendMode() {
52
- effect(() => {
53
- const [blendFunction, opacity, effect, invalidate] = [
54
- this.blendFunction(),
55
- this.opacity(),
56
- this.effectRef.nativeElement,
57
- this.invalidate(),
58
- ];
59
- if (!effect)
60
- return;
61
- effect.blendMode.blendFunction =
62
- !blendFunction && blendFunction !== 0 ? this.defaultBlendFunction : blendFunction;
63
- if (opacity !== undefined)
64
- effect.blendMode.opacity.value = opacity;
65
- invalidate();
66
- });
67
49
  }
68
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpEffect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
69
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.2", type: NgtpEffect, inputs: { effectRef: "effectRef", _blendFunction: ["blendFunction", "_blendFunction"], _opacity: ["opacity", "_opacity"] }, ngImport: i0 }); }
50
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
51
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.3", type: NgtpEffect, isStandalone: true, inputs: { effectRef: { classPropertyName: "effectRef", publicName: "effectRef", isSignal: true, isRequired: false, transformFunction: null }, blendFunction: { classPropertyName: "blendFunction", publicName: "blendFunction", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
70
52
  }
71
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpEffect, decorators: [{
72
- type: Directive
73
- }], ctorParameters: function () { return []; }, propDecorators: { effectRef: [{
74
- type: Input
75
- }], _blendFunction: [{
76
- type: Input,
77
- args: [{ alias: 'blendFunction' }]
78
- }], _opacity: [{
79
- type: Input,
80
- args: [{ alias: 'opacity' }]
81
- }] } });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffect, decorators: [{
54
+ type: Directive,
55
+ args: [{ standalone: true }]
56
+ }] });
57
+ const NgtpEffectHostDirective = { directive: NgtpEffect, inputs: ['blendFunction', 'opacity', 'effectRef'] };
82
58
 
83
59
  extend({ Group });
84
- const [injectNgtpEffectComposerApi, provideNgtpEffectComposerApi] = createInjectionToken((composer) => composer.api, { isRoot: false, deps: [forwardRef(() => NgtpEffectComposer)] });
60
+ const defaultOptions = {
61
+ enabled: true,
62
+ renderPriority: 1,
63
+ autoClear: true,
64
+ multisampling: 8,
65
+ frameBufferType: HalfFloatType,
66
+ };
67
+ function isConvolution(effect) {
68
+ return (effect.getAttributes() & EffectAttribute.CONVOLUTION) === EffectAttribute.CONVOLUTION;
69
+ }
70
+ class NgtpEffects {
71
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffects, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
72
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: NgtpEffects, isStandalone: true, selector: "ng-template[effects]", ngImport: i0 }); }
73
+ }
74
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffects, decorators: [{
75
+ type: Directive,
76
+ args: [{ selector: 'ng-template[effects]', standalone: true }]
77
+ }] });
85
78
  class NgtpEffectComposer {
86
- set _enabled(enabled) {
87
- this.inputs.set({ enabled });
88
- }
89
- set _depthBuffer(depthBuffer) {
90
- this.inputs.set({ depthBuffer });
91
- }
92
- set _disableNormalPass(disableNormalPass) {
93
- this.inputs.set({ disableNormalPass });
94
- }
95
- set _stencilBuffer(stencilBuffer) {
96
- this.inputs.set({ stencilBuffer });
97
- }
98
- set _autoClear(autoClear) {
99
- this.inputs.set({ autoClear });
100
- }
101
- set _resolutionScale(resolutionScale) {
102
- this.inputs.set({ resolutionScale });
103
- }
104
- set _multisampling(multisampling) {
105
- this.inputs.set({ multisampling });
106
- }
107
- set _frameBufferType(frameBufferType) {
108
- this.inputs.set({ frameBufferType });
109
- }
110
- set _renderPriority(renderPriority) {
111
- this.inputs.set({ renderPriority });
112
- }
113
- set _camera(camera) {
114
- this.inputs.set({ camera });
115
- }
116
- set _scene(scene) {
117
- this.inputs.set({ scene });
118
- }
119
79
  constructor() {
120
- this.inputs = signalStore({
121
- enabled: true,
122
- renderPriority: 1,
123
- autoClear: true,
124
- multisampling: 8,
125
- frameBufferType: THREE.HalfFloatType,
126
- });
127
- this.composerRef = injectNgtRef();
80
+ this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
128
81
  this.injector = inject(Injector);
82
+ this.autoEffect = injectAutoEffect();
129
83
  this.store = injectNgtStore();
84
+ this.size = this.store.select('size');
130
85
  this.gl = this.store.select('gl');
131
86
  this.defaultScene = this.store.select('scene');
132
87
  this.defaultCamera = this.store.select('camera');
133
- this.size = this.store.select('size');
134
- this.depthBuffer = this.inputs.select('depthBuffer');
135
- this.stencilBuffer = this.inputs.select('stencilBuffer');
136
- this.multisampling = this.inputs.select('multisampling');
137
- this.frameBufferType = this.inputs.select('frameBufferType');
138
- this.scene = this.inputs.select('scene');
139
- this.camera = this.inputs.select('camera');
140
- this.disableNormalPass = this.inputs.select('disableNormalPass');
141
- this.resolutionScale = this.inputs.select('resolutionScale');
142
- this.autoClear = this.inputs.select('autoClear');
143
- this.activeScene = computed(() => this.scene() || this.defaultScene());
144
- this.activeCamera = computed(() => this.camera() || this.defaultCamera());
145
- this.composerEntities = computed(() => {
88
+ this.depthBuffer = computed(() => this.options().depthBuffer);
89
+ this.stencilBuffer = computed(() => this.options().stencilBuffer);
90
+ this.multisampling = computed(() => this.options().multisampling);
91
+ this.frameBufferType = computed(() => this.options().frameBufferType);
92
+ this.scene = computed(() => this.options().scene ?? this.defaultScene());
93
+ this.camera = computed(() => this.options().camera ?? this.defaultCamera());
94
+ this.enableNormalPass = computed(() => this.options().enableNormalPass);
95
+ this.resolutionScale = computed(() => this.options().resolutionScale);
96
+ this.group = viewChild.required('group');
97
+ this.groupAnchor = viewChild.required('group', { read: ViewContainerRef });
98
+ this.content = contentChild.required(NgtpEffects, { read: TemplateRef });
99
+ this.composerData = computed(() => {
146
100
  const webGL2Available = isWebGL2Available();
147
- const [gl, depthBuffer, stencilBuffer, multisampling, frameBufferType, scene, camera, disableNormalPass, resolutionScale,] = [
101
+ const [gl, scene, camera, depthBuffer, stencilBuffer, multisampling, frameBufferType, enableNormalPass, resolutionScale,] = [
148
102
  this.gl(),
103
+ this.scene(),
104
+ this.camera(),
149
105
  this.depthBuffer(),
150
106
  this.stencilBuffer(),
151
107
  this.multisampling(),
152
108
  this.frameBufferType(),
153
- this.activeScene(),
154
- this.activeCamera(),
155
- this.disableNormalPass(),
109
+ this.enableNormalPass(),
156
110
  this.resolutionScale(),
157
111
  ];
158
- // Initialize composer
159
- const effectComposer = new EffectComposer(gl, {
112
+ // initialize composer
113
+ const composer = new EffectComposer(gl, {
160
114
  depthBuffer,
161
115
  stencilBuffer,
162
116
  multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,
163
117
  frameBufferType,
164
118
  });
165
- // Add render pass
166
- effectComposer.addPass(new RenderPass(scene, camera));
167
- // Create normal pass
119
+ // add render pass
120
+ composer.addPass(new RenderPass(scene, camera));
121
+ // create normal pass
168
122
  let downSamplingPass = null;
169
123
  let normalPass = null;
170
- if (!disableNormalPass) {
124
+ if (enableNormalPass) {
171
125
  normalPass = new NormalPass(scene, camera);
172
126
  normalPass.enabled = false;
173
- effectComposer.addPass(normalPass);
127
+ composer.addPass(normalPass);
174
128
  if (resolutionScale !== undefined && webGL2Available) {
175
129
  downSamplingPass = new DepthDownsamplingPass({ normalBuffer: normalPass.texture, resolutionScale });
176
130
  downSamplingPass.enabled = false;
177
- effectComposer.addPass(downSamplingPass);
131
+ composer.addPass(downSamplingPass);
178
132
  }
179
133
  }
180
- return { effectComposer, normalPass, downSamplingPass };
134
+ return { composer, normalPass, downSamplingPass };
181
135
  });
182
- this.composer = computed(() => this.composerEntities().effectComposer);
183
- this.api = computed(() => {
184
- const [{ effectComposer: composer, normalPass, downSamplingPass }, resolutionScale, camera, scene] = [
185
- this.composerEntities(),
186
- this.resolutionScale(),
187
- this.activeCamera(),
188
- this.activeScene(),
189
- ];
190
- return { composer, normalPass, downSamplingPass, resolutionScale, camera, scene };
136
+ afterNextRender(() => {
137
+ this.disableToneMapping();
138
+ this.setComposerSize();
139
+ this.render();
140
+ this.updatePasses();
141
+ injectBeforeRender(({ delta }) => {
142
+ const [{ composer }, { enabled, autoClear, stencilBuffer }, gl] = [
143
+ this.composerData(),
144
+ this.options(),
145
+ this.gl(),
146
+ ];
147
+ if (enabled) {
148
+ const currentAutoClear = gl.autoClear;
149
+ gl.autoClear = autoClear;
150
+ if (stencilBuffer && !autoClear)
151
+ gl.clearStencil();
152
+ composer.render(delta);
153
+ gl.autoClear = currentAutoClear;
154
+ }
155
+ }, { injector: this.injector, priority: this.options().enabled ? this.options().renderPriority : 0 });
191
156
  });
192
- this.setComposerSize();
193
- this.updatePasses();
194
157
  }
195
- ngOnInit() {
196
- this.beforeRender();
158
+ // NOTE: Disable tone mapping because threejs disallows tonemapping on render targets
159
+ disableToneMapping() {
160
+ this.autoEffect(() => {
161
+ const gl = this.gl();
162
+ const currentTonemapping = gl.toneMapping;
163
+ gl.toneMapping = NoToneMapping;
164
+ return () => {
165
+ gl.toneMapping = currentTonemapping;
166
+ };
167
+ });
197
168
  }
198
169
  setComposerSize() {
199
- effect(() => {
200
- const [composer, size] = [this.composer(), this.size()];
201
- composer.setSize(size.width, size.height);
170
+ this.autoEffect(() => {
171
+ const [{ composer }, { width, height }] = [this.composerData(), this.size()];
172
+ if (composer) {
173
+ composer.setSize(width, height);
174
+ }
202
175
  });
203
176
  }
177
+ render() {
178
+ this.autoEffect((injector) => {
179
+ const ref = this.groupAnchor().createEmbeddedView(this.content(), {}, { injector });
180
+ ref.detectChanges();
181
+ return () => ref.destroy();
182
+ }, { allowSignalWrites: true });
183
+ }
204
184
  updatePasses() {
205
- effect((onCleanup) => {
206
- const [{ effectComposer: composer, normalPass, downSamplingPass }, instance, children, camera] = [
207
- this.composerEntities(),
208
- this.composerRef.nativeElement,
209
- this.composerRef.children('nonObjects')(),
210
- this.activeCamera(),
185
+ this.autoEffect(() => {
186
+ const [group, { composer, normalPass, downSamplingPass }, camera] = [
187
+ this.group(),
188
+ this.composerData(),
189
+ this.camera(),
211
190
  ];
212
191
  const passes = [];
213
- if (instance && composer && children.length) {
192
+ if (group.nativeElement && composer) {
193
+ const localState = getLocalState(group.nativeElement);
194
+ if (!localState)
195
+ return;
196
+ const children = localState.nonObjects();
214
197
  for (let i = 0; i < children.length; i++) {
215
198
  const child = children[i];
216
199
  if (child instanceof Effect) {
217
- const effects = [];
218
- while (children[i] instanceof Effect)
219
- effects.push(children[i++]);
220
- i--;
200
+ const effects = [child];
201
+ if (!isConvolution(child)) {
202
+ let next = null;
203
+ while ((next = children[i + 1]) instanceof Effect) {
204
+ if (isConvolution(next))
205
+ break;
206
+ effects.push(next);
207
+ i++;
208
+ }
209
+ }
221
210
  const pass = new EffectPass(camera, ...effects);
222
211
  passes.push(pass);
223
212
  }
@@ -225,766 +214,72 @@ class NgtpEffectComposer {
225
214
  passes.push(child);
226
215
  }
227
216
  }
228
- for (const pass of passes)
217
+ for (const pass of passes) {
229
218
  composer.addPass(pass);
219
+ }
230
220
  if (normalPass)
231
221
  normalPass.enabled = true;
232
222
  if (downSamplingPass)
233
223
  downSamplingPass.enabled = true;
234
224
  }
235
- onCleanup(() => {
225
+ return () => {
236
226
  for (const pass of passes)
237
227
  composer?.removePass(pass);
238
228
  if (normalPass)
239
229
  normalPass.enabled = false;
240
230
  if (downSamplingPass)
241
231
  downSamplingPass.enabled = false;
242
- });
232
+ };
243
233
  });
244
234
  }
245
- beforeRender() {
246
- injectBeforeRender(({ delta }) => {
247
- const [enabled, gl, autoClear, stencilBuffer, composer] = [
248
- this.inputs.get('enabled'),
249
- this.gl(),
250
- this.autoClear(),
251
- this.stencilBuffer(),
252
- this.composer(),
253
- ];
254
- if (enabled) {
255
- const currentAutoClear = gl.autoClear;
256
- gl.autoClear = autoClear;
257
- if (stencilBuffer && !autoClear)
258
- gl.clearStencil();
259
- composer.render(delta);
260
- gl.autoClear = currentAutoClear;
261
- }
262
- }, {
263
- injector: this.injector,
264
- priority: this.inputs.get('enabled') ? this.inputs.get('renderPriority') : 0,
265
- });
266
- }
267
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpEffectComposer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
268
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpEffectComposer, isStandalone: true, selector: "ngtp-effect-composer", inputs: { composerRef: "composerRef", _enabled: ["enabled", "_enabled"], _depthBuffer: ["depthBuffer", "_depthBuffer"], _disableNormalPass: ["disableNormalPass", "_disableNormalPass"], _stencilBuffer: ["stencilBuffer", "_stencilBuffer"], _autoClear: ["autoClear", "_autoClear"], _resolutionScale: ["resolutionScale", "_resolutionScale"], _multisampling: ["multisampling", "_multisampling"], _frameBufferType: ["frameBufferType", "_frameBufferType"], _renderPriority: ["renderPriority", "_renderPriority"], _camera: ["camera", "_camera"], _scene: ["scene", "_scene"] }, providers: [provideNgtpEffectComposerApi()], ngImport: i0, template: `
269
- <ngt-group [ref]="composerRef">
270
- <ng-content />
271
- </ngt-group>
272
- `, isInline: true }); }
235
+ 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: `
237
+ <ngt-group #group ngtCompound></ngt-group>
238
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
273
239
  }
274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpEffectComposer, decorators: [{
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpEffectComposer, decorators: [{
275
241
  type: Component,
276
242
  args: [{
277
243
  selector: 'ngtp-effect-composer',
278
244
  standalone: true,
279
245
  template: `
280
- <ngt-group [ref]="composerRef">
281
- <ng-content />
282
- </ngt-group>
246
+ <ngt-group #group ngtCompound></ngt-group>
283
247
  `,
284
- providers: [provideNgtpEffectComposerApi()],
285
248
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
249
+ changeDetection: ChangeDetectionStrategy.OnPush,
286
250
  }]
287
- }], ctorParameters: function () { return []; }, propDecorators: { composerRef: [{
288
- type: Input
289
- }], _enabled: [{
290
- type: Input,
291
- args: [{ alias: 'enabled' }]
292
- }], _depthBuffer: [{
293
- type: Input,
294
- args: [{ alias: 'depthBuffer' }]
295
- }], _disableNormalPass: [{
296
- type: Input,
297
- args: [{ alias: 'disableNormalPass' }]
298
- }], _stencilBuffer: [{
299
- type: Input,
300
- args: [{ alias: 'stencilBuffer' }]
301
- }], _autoClear: [{
302
- type: Input,
303
- args: [{ alias: 'autoClear' }]
304
- }], _resolutionScale: [{
305
- type: Input,
306
- args: [{ alias: 'resolutionScale' }]
307
- }], _multisampling: [{
308
- type: Input,
309
- args: [{ alias: 'multisampling' }]
310
- }], _frameBufferType: [{
311
- type: Input,
312
- args: [{ alias: 'frameBufferType' }]
313
- }], _renderPriority: [{
314
- type: Input,
315
- args: [{ alias: 'renderPriority' }]
316
- }], _camera: [{
317
- type: Input,
318
- args: [{ alias: 'camera' }]
319
- }], _scene: [{
320
- type: Input,
321
- args: [{ alias: 'scene' }]
322
- }] } });
251
+ }], ctorParameters: () => [] });
323
252
 
324
253
  extend({ BloomEffect });
325
- class NgtpBloom extends NgtpEffect {
254
+ class NgtpBloom {
326
255
  constructor() {
327
- super(...arguments);
328
- this.defaultBlendFunction = BlendFunction.ADD;
256
+ this.effect = inject(NgtpEffect, { host: true });
257
+ this.options = input({});
329
258
  }
330
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpBloom, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
331
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpBloom, isStandalone: true, selector: "ngtp-bloom", usesInheritance: true, ngImport: i0, template: `
332
- <ngt-bloom-effect ngtCompound *args="args()" [ref]="effectRef" [camera]="camera()">
259
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpBloom, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
260
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.0.3", type: NgtpBloom, isStandalone: true, selector: "ngtp-bloom", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity", "effectRef", "effectRef"] }], ngImport: i0, template: `
261
+ <ngt-bloom-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
262
+ <ngtp-effect-blend-mode />
333
263
  <ng-content />
334
264
  </ngt-bloom-effect>
335
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
265
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
336
266
  }
337
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpBloom, decorators: [{
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgtpBloom, decorators: [{
338
268
  type: Component,
339
269
  args: [{
340
270
  selector: 'ngtp-bloom',
341
271
  standalone: true,
342
272
  template: `
343
- <ngt-bloom-effect ngtCompound *args="args()" [ref]="effectRef" [camera]="camera()">
273
+ <ngt-bloom-effect *args="[options()]" [camera]="effect.camera()" [ref]="effect.effectRef()" ngtCompound>
274
+ <ngtp-effect-blend-mode />
344
275
  <ng-content />
345
276
  </ngt-bloom-effect>
346
277
  `,
347
- imports: [NgtArgs],
348
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
349
- }]
350
- }] });
351
-
352
- extend({ BrightnessContrastEffect });
353
- class NgtpBrightnessContrast extends NgtpEffect {
354
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpBrightnessContrast, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
355
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpBrightnessContrast, isStandalone: true, selector: "ngtp-brightness-contrast", usesInheritance: true, ngImport: i0, template: `
356
- <ngt-brightness-contrast-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
357
- <ng-content />
358
- </ngt-brightness-contrast-effect>
359
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
360
- }
361
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpBrightnessContrast, decorators: [{
362
- type: Component,
363
- args: [{
364
- selector: 'ngtp-brightness-contrast',
365
- standalone: true,
366
- template: `
367
- <ngt-brightness-contrast-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
368
- <ng-content />
369
- </ngt-brightness-contrast-effect>
370
- `,
371
- imports: [NgtArgs],
372
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
373
- }]
374
- }] });
375
-
376
- extend({ ColorDepthEffect });
377
- class NgtpColorDepth extends NgtpEffect {
378
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpColorDepth, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
379
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpColorDepth, isStandalone: true, selector: "ngtp-color-depth", usesInheritance: true, ngImport: i0, template: `
380
- <ngt-color-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
381
- <ng-content />
382
- </ngt-color-depth-effect>
383
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
384
- }
385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpColorDepth, decorators: [{
386
- type: Component,
387
- args: [{
388
- selector: 'ngtp-color-depth',
389
- standalone: true,
390
- template: `
391
- <ngt-color-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
392
- <ng-content />
393
- </ngt-color-depth-effect>
394
- `,
395
- imports: [NgtArgs],
396
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
397
- }]
398
- }] });
399
-
400
- extend({ DepthEffect });
401
- class NgtpDepth extends NgtpEffect {
402
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpDepth, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
403
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpDepth, isStandalone: true, selector: "ngtp-depth", usesInheritance: true, ngImport: i0, template: `
404
- <ngt-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
405
- <ng-content />
406
- </ngt-depth-effect>
407
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
408
- }
409
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpDepth, decorators: [{
410
- type: Component,
411
- args: [{
412
- selector: 'ngtp-depth',
413
- standalone: true,
414
- template: `
415
- <ngt-depth-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
416
- <ng-content />
417
- </ngt-depth-effect>
418
- `,
419
- imports: [NgtArgs],
420
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
421
- }]
422
- }] });
423
-
424
- extend({ DotScreenEffect });
425
- class NgtpDotScreen extends NgtpEffect {
426
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpDotScreen, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
427
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpDotScreen, isStandalone: true, selector: "ngtp-dot-screen", usesInheritance: true, ngImport: i0, template: `
428
- <ngt-dot-screen-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
429
- <ng-content />
430
- </ngt-dot-screen-effect>
431
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
432
- }
433
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpDotScreen, decorators: [{
434
- type: Component,
435
- args: [{
436
- selector: 'ngtp-dot-screen',
437
- standalone: true,
438
- template: `
439
- <ngt-dot-screen-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
440
- <ng-content />
441
- </ngt-dot-screen-effect>
442
- `,
443
- imports: [NgtArgs],
444
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
445
- }]
446
- }] });
447
-
448
- extend({ HueSaturationEffect });
449
- class NgtpHueSaturation extends NgtpEffect {
450
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpHueSaturation, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
451
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpHueSaturation, isStandalone: true, selector: "ngtp-hue-saturation", usesInheritance: true, ngImport: i0, template: `
452
- <ngt-hue-saturation-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
453
- <ng-content />
454
- </ngt-hue-saturation-effect>
455
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
456
- }
457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpHueSaturation, decorators: [{
458
- type: Component,
459
- args: [{
460
- selector: 'ngtp-hue-saturation',
461
- standalone: true,
462
- template: `
463
- <ngt-hue-saturation-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
464
- <ng-content />
465
- </ngt-hue-saturation-effect>
466
- `,
467
- imports: [NgtArgs],
468
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
469
- }]
470
- }] });
471
-
472
- class NgtpLUT {
473
- set _lut(lut) {
474
- this.inputs.set({ lut });
475
- }
476
- set _blendFunction(blendFunction) {
477
- this.inputs.set({ blendFunction });
478
- }
479
- set _tetrahedralInterpolation(tetrahedralInterpolation) {
480
- this.inputs.set({ tetrahedralInterpolation });
481
- }
482
- constructor() {
483
- this.inputs = signalStore({});
484
- this.effectRef = injectNgtRef();
485
- this.lut = this.inputs.select('lut');
486
- this.tetrahedralInterpolation = this.inputs.select('tetrahedralInterpolation');
487
- this.blendFunction = this.inputs.select('blendFunction');
488
- this.store = injectNgtStore();
489
- this.invalidate = this.store.select('invalidate');
490
- this.effect = computed(() => new LUT3DEffect(this.lut(), {
491
- blendFunction: this.blendFunction(),
492
- tetrahedralInterpolation: this.tetrahedralInterpolation(),
493
- }));
494
- this.setState();
495
- }
496
- setState() {
497
- effect(() => {
498
- const [effect, invalidate, lut, tetrahedralInterpolation] = [
499
- this.effect(),
500
- this.invalidate(),
501
- this.lut(),
502
- this.tetrahedralInterpolation(),
503
- ];
504
- if (!effect)
505
- return;
506
- if (tetrahedralInterpolation)
507
- effect.tetrahedralInterpolation = tetrahedralInterpolation;
508
- if (lut)
509
- effect.lut = lut;
510
- invalidate();
511
- });
512
- }
513
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpLUT, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
514
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpLUT, isStandalone: true, selector: "ngtp-lut", inputs: { effectRef: "effectRef", _lut: ["lut", "_lut"], _blendFunction: ["blendFunction", "_blendFunction"], _tetrahedralInterpolation: ["tetrahedralInterpolation", "_tetrahedralInterpolation"] }, ngImport: i0, template: `
515
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
516
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
517
- }
518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpLUT, decorators: [{
519
- type: Component,
520
- args: [{
521
- selector: 'ngtp-lut',
522
- standalone: true,
523
- template: `
524
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
525
- `,
526
- imports: [NgtArgs],
527
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
528
- }]
529
- }], ctorParameters: function () { return []; }, propDecorators: { effectRef: [{
530
- type: Input
531
- }], _lut: [{
532
- type: Input,
533
- args: [{ required: true, alias: 'lut' }]
534
- }], _blendFunction: [{
535
- type: Input,
536
- args: [{ alias: 'blendFunction' }]
537
- }], _tetrahedralInterpolation: [{
538
- type: Input,
539
- args: [{ alias: 'tetrahedralInterpolation' }]
540
- }] } });
541
-
542
- extend({ NoiseEffect });
543
- class NgtpNoise extends NgtpEffect {
544
- constructor() {
545
- super(...arguments);
546
- this.defaultBlendFunction = BlendFunction.COLOR_DODGE;
547
- }
548
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpNoise, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
549
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpNoise, isStandalone: true, selector: "ngtp-noise", usesInheritance: true, ngImport: i0, template: `
550
- <ngt-noise-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
551
- <ng-content />
552
- </ngt-noise-effect>
553
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
554
- }
555
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpNoise, decorators: [{
556
- type: Component,
557
- args: [{
558
- selector: 'ngtp-noise',
559
- standalone: true,
560
- template: `
561
- <ngt-noise-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
562
- <ng-content />
563
- </ngt-noise-effect>
564
- `,
565
- imports: [NgtArgs],
566
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
567
- }]
568
- }] });
569
-
570
- class NgtpPixelation {
571
- constructor() {
572
- this.inputs = signalStore({ granularity: 30 });
573
- this.effectRef = injectNgtRef();
574
- this.granularity = this.inputs.select('granularity');
575
- this.effect = computed(() => new PixelationEffect(this.granularity()));
576
- }
577
- set _granularity(granularity) {
578
- this.inputs.set({ granularity });
579
- }
580
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpPixelation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
581
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpPixelation, isStandalone: true, selector: "ngtp-pixelation", inputs: { effectRef: "effectRef", _granularity: ["granularity", "_granularity"] }, ngImport: i0, template: `
582
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
583
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
584
- }
585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpPixelation, decorators: [{
586
- type: Component,
587
- args: [{
588
- selector: 'ngtp-pixelation',
589
- standalone: true,
590
- template: `
591
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
592
- `,
593
- imports: [NgtArgs],
594
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
595
- }]
596
- }], propDecorators: { effectRef: [{
597
- type: Input
598
- }], _granularity: [{
599
- type: Input,
600
- args: [{ alias: 'granularity' }]
601
- }] } });
602
-
603
- extend({ ScanlineEffect });
604
- class NgtpScanline extends NgtpEffect {
605
- constructor() {
606
- super(...arguments);
607
- this.defaultBlendFunction = BlendFunction.OVERLAY;
608
- }
609
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpScanline, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
610
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpScanline, isStandalone: true, selector: "ngtp-scanline", usesInheritance: true, ngImport: i0, template: `
611
- <ngt-scanline-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
612
- <ng-content />
613
- </ngt-scanline-effect>
614
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
615
- }
616
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpScanline, decorators: [{
617
- type: Component,
618
- args: [{
619
- selector: 'ngtp-scanline',
620
- standalone: true,
621
- template: `
622
- <ngt-scanline-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
623
- <ng-content />
624
- </ngt-scanline-effect>
625
- `,
626
- imports: [NgtArgs],
627
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
628
- }]
629
- }] });
630
-
631
- extend({ SepiaEffect });
632
- class NgtpSepia extends NgtpEffect {
633
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpSepia, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
634
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpSepia, isStandalone: true, selector: "ngtp-sepia", usesInheritance: true, ngImport: i0, template: `
635
- <ngt-sepia-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
636
- <ng-content />
637
- </ngt-sepia-effect>
638
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
639
- }
640
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpSepia, decorators: [{
641
- type: Component,
642
- args: [{
643
- selector: 'ngtp-sepia',
644
- standalone: true,
645
- template: `
646
- <ngt-sepia-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
647
- <ng-content />
648
- </ngt-sepia-effect>
649
- `,
650
- imports: [NgtArgs],
651
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
652
- }]
653
- }] });
654
-
655
- extend({ ShockWaveEffect });
656
- class NgtpShockWave extends NgtpEffect {
657
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpShockWave, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
658
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpShockWave, isStandalone: true, selector: "ngtp-shock-wave", usesInheritance: true, ngImport: i0, template: `
659
- <ngt-shock-wave-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
660
- <ng-content />
661
- </ngt-shock-wave-effect>
662
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
663
- }
664
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpShockWave, decorators: [{
665
- type: Component,
666
- args: [{
667
- selector: 'ngtp-shock-wave',
668
- standalone: true,
669
- template: `
670
- <ngt-shock-wave-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
671
- <ng-content />
672
- </ngt-shock-wave-effect>
673
- `,
674
- imports: [NgtArgs],
675
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
676
- }]
677
- }] });
678
-
679
- extend({ SMAAEffect });
680
- class NgtpSMAA extends NgtpEffect {
681
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpSMAA, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
682
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpSMAA, isStandalone: true, selector: "ngtp-SMAA", usesInheritance: true, ngImport: i0, template: `
683
- <ngt-SMAA-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
684
- <ng-content />
685
- </ngt-SMAA-effect>
686
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
687
- }
688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpSMAA, decorators: [{
689
- type: Component,
690
- args: [{
691
- selector: 'ngtp-SMAA',
692
- standalone: true,
693
- template: `
694
- <ngt-SMAA-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
695
- <ng-content />
696
- </ngt-SMAA-effect>
697
- `,
698
- imports: [NgtArgs],
699
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
700
- }]
701
- }] });
702
-
703
- class NgtpSSAO {
704
- constructor() {
705
- this.inputs = signalStore({
706
- blendFunction: BlendFunction.MULTIPLY,
707
- samples: 30,
708
- rings: 4,
709
- distanceThreshold: 1.0,
710
- distanceFalloff: 0.0,
711
- rangeThreshold: 0.5,
712
- rangeFalloff: 0.1,
713
- luminanceInfluence: 0.9,
714
- radius: 20,
715
- bias: 0.5,
716
- intensity: 1.0,
717
- depthAwareUpsampling: true,
718
- });
719
- this.effectRef = injectNgtRef();
720
- this.effectComposerApi = injectNgtpEffectComposerApi();
721
- this.effect = computed(() => {
722
- const [state, { camera, normalPass, downSamplingPass, resolutionScale }] = [
723
- this.inputs.state(),
724
- this.effectComposerApi(),
725
- ];
726
- if (normalPass === null && downSamplingPass === null) {
727
- console.error('Please enable the NormalPass in the NgtpEffectComposer in order to use NgtpSSAO.');
728
- return null;
729
- }
730
- return new SSAOEffect(camera, normalPass && !downSamplingPass ? normalPass.texture : null, {
731
- ...state,
732
- // @ts-expect-error
733
- normalDepthBuffer: state.normalDepthBuffer || (downSamplingPass ? downSamplingPass.texture : null),
734
- resolutionScale: state.resolutionScale || (resolutionScale ?? 1),
735
- depthAwareUpsampling: state.depthAwareUpsampling ?? true,
736
- });
737
- });
738
- }
739
- set _blendFunction(blendFunction) {
740
- this.inputs.set({ blendFunction });
741
- }
742
- set _distanceScaling(distanceScaling) {
743
- this.inputs.set({ distanceScaling });
744
- }
745
- set _depthAwareUpsampling(depthAwareUpsampling) {
746
- this.inputs.set({ depthAwareUpsampling });
747
- }
748
- set _normalDepthBuffer(normalDepthBuffer) {
749
- this.inputs.set({ normalDepthBuffer });
750
- }
751
- set _samples(samples) {
752
- this.inputs.set({ samples });
753
- }
754
- set _rings(rings) {
755
- this.inputs.set({ rings });
756
- }
757
- set _worldDistanceThreshold(worldDistanceThreshold) {
758
- this.inputs.set({ worldDistanceThreshold });
759
- }
760
- set _worldDistanceFalloff(worldDistanceFalloff) {
761
- this.inputs.set({ worldDistanceFalloff });
762
- }
763
- set _worldProximityThreshold(worldProximityThreshold) {
764
- this.inputs.set({ worldProximityThreshold });
765
- }
766
- set _worldProximityFalloff(worldProximityFalloff) {
767
- this.inputs.set({ worldProximityFalloff });
768
- }
769
- set _distanceThreshold(distanceThreshold) {
770
- this.inputs.set({ distanceThreshold });
771
- }
772
- set _distanceFalloff(distanceFalloff) {
773
- this.inputs.set({ distanceFalloff });
774
- }
775
- set _rangeThreshold(rangeThreshold) {
776
- this.inputs.set({ rangeThreshold });
777
- }
778
- set _rangeFalloff(rangeFalloff) {
779
- this.inputs.set({ rangeFalloff });
780
- }
781
- set _minRadiusScale(minRadiusScale) {
782
- this.inputs.set({ minRadiusScale });
783
- }
784
- set _luminanceInfluence(luminanceInfluence) {
785
- this.inputs.set({ luminanceInfluence });
786
- }
787
- set _radius(radius) {
788
- this.inputs.set({ radius });
789
- }
790
- set _intensity(intensity) {
791
- this.inputs.set({ intensity });
792
- }
793
- set _bias(bias) {
794
- this.inputs.set({ bias });
795
- }
796
- set _fade(fade) {
797
- this.inputs.set({ fade });
798
- }
799
- set _color(color) {
800
- this.inputs.set({ color });
801
- }
802
- set _resolutionScale(resolutionScale) {
803
- this.inputs.set({ resolutionScale });
804
- }
805
- set _resolutionX(resolutionX) {
806
- this.inputs.set({ resolutionX });
807
- }
808
- set _resolutionY(resolutionY) {
809
- this.inputs.set({ resolutionY });
810
- }
811
- set _width(width) {
812
- this.inputs.set({ width });
813
- }
814
- set _height(height) {
815
- this.inputs.set({ height });
816
- }
817
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpSSAO, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
818
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpSSAO, isStandalone: true, selector: "ngtp-SSAO", inputs: { effectRef: "effectRef", _blendFunction: ["blendFunction", "_blendFunction"], _distanceScaling: ["distanceScaling", "_distanceScaling"], _depthAwareUpsampling: ["depthAwareUpsampling", "_depthAwareUpsampling"], _normalDepthBuffer: ["normalDepthBuffer", "_normalDepthBuffer"], _samples: ["samples", "_samples"], _rings: ["rings", "_rings"], _worldDistanceThreshold: ["worldDistanceThreshold", "_worldDistanceThreshold"], _worldDistanceFalloff: ["worldDistanceFalloff", "_worldDistanceFalloff"], _worldProximityThreshold: ["worldProximityThreshold", "_worldProximityThreshold"], _worldProximityFalloff: ["worldProximityFalloff", "_worldProximityFalloff"], _distanceThreshold: ["distanceThreshold", "_distanceThreshold"], _distanceFalloff: ["distanceFalloff", "_distanceFalloff"], _rangeThreshold: ["rangeThreshold", "_rangeThreshold"], _rangeFalloff: ["rangeFalloff", "_rangeFalloff"], _minRadiusScale: ["minRadiusScale", "_minRadiusScale"], _luminanceInfluence: ["luminanceInfluence", "_luminanceInfluence"], _radius: ["radius", "_radius"], _intensity: ["intensity", "_intensity"], _bias: ["bias", "_bias"], _fade: ["fade", "_fade"], _color: ["color", "_color"], _resolutionScale: ["resolutionScale", "_resolutionScale"], _resolutionX: ["resolutionX", "_resolutionX"], _resolutionY: ["resolutionY", "_resolutionY"], _width: ["width", "_width"], _height: ["height", "_height"] }, ngImport: i0, template: `
819
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
820
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
821
- }
822
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpSSAO, decorators: [{
823
- type: Component,
824
- args: [{
825
- selector: 'ngtp-SSAO',
826
- standalone: true,
827
- template: `
828
- <ngt-primitive *args="[effect()]" [ref]="effectRef" />
829
- `,
830
- imports: [NgtArgs],
831
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
832
- }]
833
- }], propDecorators: { effectRef: [{
834
- type: Input
835
- }], _blendFunction: [{
836
- type: Input,
837
- args: [{ alias: 'blendFunction' }]
838
- }], _distanceScaling: [{
839
- type: Input,
840
- args: [{ alias: 'distanceScaling' }]
841
- }], _depthAwareUpsampling: [{
842
- type: Input,
843
- args: [{ alias: 'depthAwareUpsampling' }]
844
- }], _normalDepthBuffer: [{
845
- type: Input,
846
- args: [{ alias: 'normalDepthBuffer' }]
847
- }], _samples: [{
848
- type: Input,
849
- args: [{ alias: 'samples' }]
850
- }], _rings: [{
851
- type: Input,
852
- args: [{ alias: 'rings' }]
853
- }], _worldDistanceThreshold: [{
854
- type: Input,
855
- args: [{ alias: 'worldDistanceThreshold' }]
856
- }], _worldDistanceFalloff: [{
857
- type: Input,
858
- args: [{ alias: 'worldDistanceFalloff' }]
859
- }], _worldProximityThreshold: [{
860
- type: Input,
861
- args: [{ alias: 'worldProximityThreshold' }]
862
- }], _worldProximityFalloff: [{
863
- type: Input,
864
- args: [{ alias: 'worldProximityFalloff' }]
865
- }], _distanceThreshold: [{
866
- type: Input,
867
- args: [{ alias: 'distanceThreshold' }]
868
- }], _distanceFalloff: [{
869
- type: Input,
870
- args: [{ alias: 'distanceFalloff' }]
871
- }], _rangeThreshold: [{
872
- type: Input,
873
- args: [{ alias: 'rangeThreshold' }]
874
- }], _rangeFalloff: [{
875
- type: Input,
876
- args: [{ alias: 'rangeFalloff' }]
877
- }], _minRadiusScale: [{
878
- type: Input,
879
- args: [{ alias: 'minRadiusScale' }]
880
- }], _luminanceInfluence: [{
881
- type: Input,
882
- args: [{ alias: 'luminanceInfluence' }]
883
- }], _radius: [{
884
- type: Input,
885
- args: [{ alias: 'radius' }]
886
- }], _intensity: [{
887
- type: Input,
888
- args: [{ alias: 'intensity' }]
889
- }], _bias: [{
890
- type: Input,
891
- args: [{ alias: 'bias' }]
892
- }], _fade: [{
893
- type: Input,
894
- args: [{ alias: 'fade' }]
895
- }], _color: [{
896
- type: Input,
897
- args: [{ alias: 'color' }]
898
- }], _resolutionScale: [{
899
- type: Input,
900
- args: [{ alias: 'resolutionScale' }]
901
- }], _resolutionX: [{
902
- type: Input,
903
- args: [{ alias: 'resolutionX' }]
904
- }], _resolutionY: [{
905
- type: Input,
906
- args: [{ alias: 'resolutionY' }]
907
- }], _width: [{
908
- type: Input,
909
- args: [{ alias: 'width' }]
910
- }], _height: [{
911
- type: Input,
912
- args: [{ alias: 'height' }]
913
- }] } });
914
-
915
- extend({ TiltShiftEffect });
916
- class NgtpTiltShift extends NgtpEffect {
917
- constructor() {
918
- super(...arguments);
919
- this.defaultBlendFunction = BlendFunction.ADD;
920
- }
921
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpTiltShift, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
922
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpTiltShift, isStandalone: true, selector: "ngtp-tilt-shift", usesInheritance: true, ngImport: i0, template: `
923
- <ngt-tilt-shift-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
924
- <ng-content />
925
- </ngt-tilt-shift-effect>
926
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
927
- }
928
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpTiltShift, decorators: [{
929
- type: Component,
930
- args: [{
931
- selector: 'ngtp-tilt-shift',
932
- standalone: true,
933
- template: `
934
- <ngt-tilt-shift-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
935
- <ng-content />
936
- </ngt-tilt-shift-effect>
937
- `,
938
- imports: [NgtArgs],
939
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
940
- }]
941
- }] });
942
-
943
- extend({ ToneMappingEffect });
944
- class NgtpToneMapping extends NgtpEffect {
945
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpToneMapping, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
946
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpToneMapping, isStandalone: true, selector: "ngtp-tone-mapping", usesInheritance: true, ngImport: i0, template: `
947
- <ngt-tone-mapping-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
948
- <ng-content />
949
- </ngt-tone-mapping-effect>
950
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
951
- }
952
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpToneMapping, decorators: [{
953
- type: Component,
954
- args: [{
955
- selector: 'ngtp-tone-mapping',
956
- standalone: true,
957
- template: `
958
- <ngt-tone-mapping-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
959
- <ng-content />
960
- </ngt-tone-mapping-effect>
961
- `,
962
- imports: [NgtArgs],
963
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
964
- }]
965
- }] });
966
-
967
- extend({ VignetteEffect });
968
- class NgtpVignette extends NgtpEffect {
969
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpVignette, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
970
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: NgtpVignette, isStandalone: true, selector: "ngtp-vignette", usesInheritance: true, ngImport: i0, template: `
971
- <ngt-vignette-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
972
- <ng-content />
973
- </ngt-vignette-effect>
974
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
975
- }
976
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgtpVignette, decorators: [{
977
- type: Component,
978
- args: [{
979
- selector: 'ngtp-vignette',
980
- standalone: true,
981
- template: `
982
- <ngt-vignette-effect ngtCompound *args="args()" [camera]="camera()" [ref]="effectRef">
983
- <ng-content />
984
- </ngt-vignette-effect>
985
- `,
986
- imports: [NgtArgs],
278
+ imports: [NgtArgs, NgtpEffectBlendMode],
987
279
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
280
+ changeDetection: ChangeDetectionStrategy.OnPush,
281
+ hostDirectives: [NgtpEffectHostDirective],
282
+ providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
988
283
  }]
989
284
  }] });
990
285
 
@@ -992,5 +287,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImpor
992
287
  * Generated bundle index. Do not edit.
993
288
  */
994
289
 
995
- export { NgtpBloom, NgtpBrightnessContrast, NgtpColorDepth, NgtpDepth, NgtpDotScreen, NgtpEffect, NgtpEffectComposer, NgtpHueSaturation, NgtpLUT, NgtpNoise, NgtpPixelation, NgtpSMAA, NgtpSSAO, NgtpScanline, NgtpSepia, NgtpShockWave, NgtpTiltShift, NgtpToneMapping, NgtpVignette, injectNgtpEffectComposerApi, provideNgtpEffectComposerApi };
290
+ export { NgtpBloom, NgtpEffect, NgtpEffectBlendMode, NgtpEffectComposer, NgtpEffectHostDirective, NgtpEffects, injectDefaultEffectOptions, provideDefaultEffectOptions };
996
291
  //# sourceMappingURL=angular-three-postprocessing.mjs.map