angular-three-postprocessing 4.0.0-next.12 → 4.0.0-next.120
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.
- package/README.md +80 -21
- package/fesm2022/angular-three-postprocessing-n8ao.mjs +42 -7
- package/fesm2022/angular-three-postprocessing-n8ao.mjs.map +1 -1
- package/fesm2022/angular-three-postprocessing.mjs +1150 -218
- package/fesm2022/angular-three-postprocessing.mjs.map +1 -1
- package/n8ao/README.md +143 -0
- package/package.json +7 -7
- package/types/angular-three-postprocessing-n8ao.d.ts +167 -0
- package/types/angular-three-postprocessing.d.ts +1868 -0
- package/index.d.ts +0 -3
- package/lib/effect-composer.d.ts +0 -39
- package/lib/effect.d.ts +0 -52
- package/lib/effects/ascii.d.ts +0 -24
- package/lib/effects/bloom.d.ts +0 -11
- package/lib/effects/brightness-contrast.d.ts +0 -16
- package/lib/effects/chromatic-abberation.d.ts +0 -17
- package/lib/effects/color-average.d.ts +0 -12
- package/lib/effects/color-depth.d.ts +0 -15
- package/lib/effects/depth-of-field.d.ts +0 -20
- package/lib/effects/depth.d.ts +0 -15
- package/lib/effects/dot-screen.d.ts +0 -16
- package/lib/effects/fxaa.d.ts +0 -14
- package/lib/effects/glitch.d.ts +0 -32
- package/lib/effects/god-rays.d.ts +0 -32
- package/lib/effects/grid.d.ts +0 -18
- package/lib/effects/hue-saturation.d.ts +0 -16
- package/lib/effects/index.d.ts +0 -29
- package/lib/effects/lens-flare.d.ts +0 -94
- package/lib/effects/lut.d.ts +0 -18
- package/lib/effects/noise.d.ts +0 -15
- package/lib/effects/outline.d.ts +0 -73
- package/lib/effects/pixelation.d.ts +0 -17
- package/lib/effects/scanline.d.ts +0 -18
- package/lib/effects/selective-bloom.d.ts +0 -42
- package/lib/effects/sepia.d.ts +0 -15
- package/lib/effects/shock-wave.d.ts +0 -12
- package/lib/effects/smaa.d.ts +0 -16
- package/lib/effects/tilt-shift-2.d.ts +0 -35
- package/lib/effects/tilt-shift.d.ts +0 -23
- package/lib/effects/tone-mapping.d.ts +0 -23
- package/lib/effects/vignette.d.ts +0 -18
- package/lib/effects/water.d.ts +0 -21
- package/n8ao/index.d.ts +0 -1
- package/n8ao/lib/n8ao.d.ts +0 -35
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject,
|
|
3
|
-
import { injectStore, pick, extend, getInstanceState,
|
|
2
|
+
import { inject, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component, input, Directive, computed, viewChild, effect, untracked } from '@angular/core';
|
|
3
|
+
import { injectStore, pick, extend, getInstanceState, beforeRender, NgtArgs, vector2, omit, resolveRef, vector3, is, NgtSelectionApi } from 'angular-three';
|
|
4
4
|
import { createNoopInjectionToken } from 'ngxtension/create-injection-token';
|
|
5
5
|
import { mergeInputs } from 'ngxtension/inject-inputs';
|
|
6
6
|
import { EffectAttribute, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, BloomEffect, BlendFunction, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, DepthOfFieldEffect, MaskFunction, DotScreenEffect, FXAAEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, LUT3DEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SelectiveBloomEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, TiltShiftEffect, ToneMappingEffect, VignetteEffect } from 'postprocessing';
|
|
@@ -9,20 +9,48 @@ import { Group } from 'three';
|
|
|
9
9
|
import { isWebGL2Available } from 'three-stdlib';
|
|
10
10
|
import { easing } from 'maath';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Injection token for providing default effect options.
|
|
14
|
+
*
|
|
15
|
+
* Use `injectDefaultEffectOptions` to inject default options in effect components.
|
|
16
|
+
* Use `provideDefaultEffectOptions` to provide default options for effects.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* @Component({
|
|
21
|
+
* providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD, opacity: 0.5 })]
|
|
22
|
+
* })
|
|
23
|
+
* export class MyEffect {}
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
12
26
|
const [injectDefaultEffectOptions, provideDefaultEffectOptions] = createNoopInjectionToken('Default Effect options');
|
|
27
|
+
/**
|
|
28
|
+
* Component that applies blend mode settings to a postprocessing effect.
|
|
29
|
+
*
|
|
30
|
+
* This component is used internally by effect components to apply `blendFunction`
|
|
31
|
+
* and `opacity` values to the effect's blend mode.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```html
|
|
35
|
+
* <ngt-bloom-effect *args="[options()]">
|
|
36
|
+
* <ngtp-effect-blend-mode />
|
|
37
|
+
* </ngt-bloom-effect>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
13
40
|
class NgtpEffectBlendMode {
|
|
14
41
|
constructor() {
|
|
42
|
+
/** Reference to the parent NgtpEffect directive, if available */
|
|
15
43
|
this.effect = inject(NgtpEffect, { optional: true });
|
|
16
44
|
}
|
|
17
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
18
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpEffectBlendMode, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
46
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: NgtpEffectBlendMode, isStandalone: true, selector: "ngtp-effect-blend-mode", ngImport: i0, template: `
|
|
19
47
|
@if (effect) {
|
|
20
48
|
<ngt-value [rawValue]="effect.blendFunction()" attach="blendMode.blendFunction" />
|
|
21
49
|
<ngt-value [rawValue]="effect.opacity()" attach="blendMode.opacity.value" />
|
|
22
50
|
}
|
|
23
51
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
24
52
|
}
|
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpEffectBlendMode, decorators: [{
|
|
26
54
|
type: Component,
|
|
27
55
|
args: [{
|
|
28
56
|
selector: 'ngtp-effect-blend-mode',
|
|
@@ -36,21 +64,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
36
64
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
65
|
}]
|
|
38
66
|
}] });
|
|
67
|
+
/**
|
|
68
|
+
* Base directive for postprocessing effects that provides common functionality.
|
|
69
|
+
*
|
|
70
|
+
* This directive is used as a host directive by effect components to provide:
|
|
71
|
+
* - `blendFunction`: Controls how the effect blends with the scene
|
|
72
|
+
* - `opacity`: Controls the effect's opacity
|
|
73
|
+
* - Access to the camera and invalidate function from the store
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* @Component({
|
|
78
|
+
* hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }]
|
|
79
|
+
* })
|
|
80
|
+
* export class NgtpBloom {}
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
39
83
|
class NgtpEffect {
|
|
40
84
|
constructor() {
|
|
85
|
+
/** Default effect options injected from parent providers */
|
|
41
86
|
this.defaultEffectOptions = injectDefaultEffectOptions({ optional: true });
|
|
42
|
-
|
|
43
|
-
|
|
87
|
+
/**
|
|
88
|
+
* The blend function used to combine this effect with the scene.
|
|
89
|
+
* @see BlendFunction from postprocessing library
|
|
90
|
+
*/
|
|
91
|
+
this.blendFunction = input(this.defaultEffectOptions?.blendFunction, ...(ngDevMode ? [{ debugName: "blendFunction" }] : []));
|
|
92
|
+
/**
|
|
93
|
+
* The opacity of the effect.
|
|
94
|
+
* @default undefined (uses effect's default)
|
|
95
|
+
*/
|
|
96
|
+
this.opacity = input(this.defaultEffectOptions?.opacity, ...(ngDevMode ? [{ debugName: "opacity" }] : []));
|
|
44
97
|
this.store = injectStore();
|
|
98
|
+
/** The current camera from the store */
|
|
45
99
|
this.camera = this.store.camera;
|
|
100
|
+
/** Function to invalidate the render loop, triggering a re-render */
|
|
46
101
|
this.invalidate = this.store.invalidate;
|
|
47
102
|
}
|
|
48
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
49
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
103
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpEffect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
104
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: NgtpEffect, isStandalone: true, inputs: { blendFunction: { classPropertyName: "blendFunction", publicName: "blendFunction", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
50
105
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpEffect, decorators: [{
|
|
52
107
|
type: Directive
|
|
53
|
-
}] });
|
|
108
|
+
}], propDecorators: { blendFunction: [{ type: i0.Input, args: [{ isSignal: true, alias: "blendFunction", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }] } });
|
|
54
109
|
|
|
55
110
|
const defaultOptions$5 = {
|
|
56
111
|
enabled: true,
|
|
@@ -59,13 +114,46 @@ const defaultOptions$5 = {
|
|
|
59
114
|
multisampling: 8,
|
|
60
115
|
frameBufferType: THREE.HalfFloatType,
|
|
61
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Checks if an effect has the convolution attribute.
|
|
119
|
+
*
|
|
120
|
+
* @param effect - The effect to check
|
|
121
|
+
* @returns True if the effect has the convolution attribute
|
|
122
|
+
*/
|
|
62
123
|
function isConvolution(effect) {
|
|
63
124
|
return (effect.getAttributes() & EffectAttribute.CONVOLUTION) === EffectAttribute.CONVOLUTION;
|
|
64
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Angular component that manages postprocessing effects for a Three.js scene.
|
|
128
|
+
*
|
|
129
|
+
* The effect composer wraps the postprocessing library's EffectComposer and provides
|
|
130
|
+
* a declarative way to add effects to your scene. Effects are added as children of
|
|
131
|
+
* this component and are automatically composed into an effect pass.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```html
|
|
135
|
+
* <ngtp-effect-composer>
|
|
136
|
+
* <ngtp-bloom [options]="{ intensity: 1, luminanceThreshold: 0.9 }" />
|
|
137
|
+
* <ngtp-vignette [options]="{ darkness: 0.5 }" />
|
|
138
|
+
* </ngtp-effect-composer>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```html
|
|
143
|
+
* <!-- With custom options -->
|
|
144
|
+
* <ngtp-effect-composer [options]="{ multisampling: 4, autoClear: false }">
|
|
145
|
+
* <ngtp-smaa />
|
|
146
|
+
* <ngtp-tone-mapping />
|
|
147
|
+
* </ngtp-effect-composer>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
65
150
|
class NgtpEffectComposer {
|
|
66
151
|
constructor() {
|
|
67
|
-
|
|
68
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Configuration options for the effect composer.
|
|
154
|
+
* @see NgtpEffectComposerOptions
|
|
155
|
+
*/
|
|
156
|
+
this.options = input(defaultOptions$5, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$5) });
|
|
69
157
|
this.store = injectStore();
|
|
70
158
|
this.depthBuffer = pick(this.options, 'depthBuffer');
|
|
71
159
|
this.stencilBuffer = pick(this.options, 'stencilBuffer');
|
|
@@ -75,15 +163,31 @@ class NgtpEffectComposer {
|
|
|
75
163
|
this.resolutionScale = pick(this.options, 'resolutionScale');
|
|
76
164
|
this.enabled = pick(this.options, 'enabled');
|
|
77
165
|
this.renderPriority = pick(this.options, 'renderPriority');
|
|
78
|
-
|
|
79
|
-
|
|
166
|
+
/**
|
|
167
|
+
* The scene used for rendering effects.
|
|
168
|
+
* Uses custom scene from options if provided, otherwise uses the store's scene.
|
|
169
|
+
*/
|
|
170
|
+
this.scene = computed(() => this.options().scene ?? this.store.scene(), ...(ngDevMode ? [{ debugName: "scene" }] : []));
|
|
171
|
+
/**
|
|
172
|
+
* The camera used for rendering effects.
|
|
173
|
+
* Uses custom camera from options if provided, otherwise uses the store's camera.
|
|
174
|
+
*/
|
|
175
|
+
this.camera = computed(() => this.options().camera ?? this.store.camera(), ...(ngDevMode ? [{ debugName: "camera" }] : []));
|
|
80
176
|
this.groupRef = viewChild.required('group');
|
|
177
|
+
/**
|
|
178
|
+
* Computed render priority based on whether the composer is enabled.
|
|
179
|
+
* Returns 0 when disabled, otherwise returns the configured renderPriority.
|
|
180
|
+
*/
|
|
81
181
|
this.priority = computed(() => {
|
|
82
182
|
const enabled = this.enabled();
|
|
83
183
|
if (!enabled)
|
|
84
184
|
return 0;
|
|
85
185
|
return this.renderPriority();
|
|
86
|
-
});
|
|
186
|
+
}, ...(ngDevMode ? [{ debugName: "priority" }] : []));
|
|
187
|
+
/**
|
|
188
|
+
* Creates and configures the effect composer with render pass, normal pass,
|
|
189
|
+
* and depth downsampling pass based on options.
|
|
190
|
+
*/
|
|
87
191
|
this.composerData = computed(() => {
|
|
88
192
|
const webGL2Available = isWebGL2Available();
|
|
89
193
|
const [gl, scene, camera, depthBuffer, stencilBuffer, multisampling, frameBufferType, enableNormalPass, resolutionScale,] = [
|
|
@@ -120,7 +224,11 @@ class NgtpEffectComposer {
|
|
|
120
224
|
}
|
|
121
225
|
}
|
|
122
226
|
return { composer, normalPass, downSamplingPass };
|
|
123
|
-
});
|
|
227
|
+
}, ...(ngDevMode ? [{ debugName: "composerData" }] : []));
|
|
228
|
+
/**
|
|
229
|
+
* The underlying postprocessing EffectComposer instance.
|
|
230
|
+
* Can be used to access the composer directly for advanced use cases.
|
|
231
|
+
*/
|
|
124
232
|
this.effectComposer = pick(this.composerData, 'composer');
|
|
125
233
|
extend({ Group });
|
|
126
234
|
// NOTE: Disable tone mapping because threejs disallows tonemapping on render targets
|
|
@@ -133,7 +241,11 @@ class NgtpEffectComposer {
|
|
|
133
241
|
});
|
|
134
242
|
});
|
|
135
243
|
effect(() => {
|
|
136
|
-
const [
|
|
244
|
+
const [composer, width, height] = [
|
|
245
|
+
this.effectComposer(),
|
|
246
|
+
this.store.size.width(),
|
|
247
|
+
this.store.size.height(),
|
|
248
|
+
];
|
|
137
249
|
if (composer) {
|
|
138
250
|
composer.setSize(width, height);
|
|
139
251
|
}
|
|
@@ -187,34 +299,30 @@ class NgtpEffectComposer {
|
|
|
187
299
|
downSamplingPass.enabled = false;
|
|
188
300
|
});
|
|
189
301
|
});
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
gl.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
}, { injector: this.injector, priority });
|
|
207
|
-
onCleanup(() => sub());
|
|
208
|
-
});
|
|
302
|
+
beforeRender(({ delta }) => {
|
|
303
|
+
const [composer, { enabled, autoClear, stencilBuffer }, gl] = [
|
|
304
|
+
this.effectComposer(),
|
|
305
|
+
this.options(),
|
|
306
|
+
this.store.snapshot.gl,
|
|
307
|
+
];
|
|
308
|
+
if (enabled) {
|
|
309
|
+
const currentAutoClear = gl.autoClear;
|
|
310
|
+
gl.autoClear = autoClear;
|
|
311
|
+
if (stencilBuffer && !autoClear)
|
|
312
|
+
gl.clearStencil();
|
|
313
|
+
composer.render(delta);
|
|
314
|
+
gl.autoClear = currentAutoClear;
|
|
315
|
+
}
|
|
316
|
+
}, { priority: this.priority });
|
|
209
317
|
}
|
|
210
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
211
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
318
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpEffectComposer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
319
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: NgtpEffectComposer, isStandalone: true, selector: "ngtp-effect-composer", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
212
320
|
<ngt-group #group>
|
|
213
321
|
<ng-content />
|
|
214
322
|
</ngt-group>
|
|
215
323
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
216
324
|
}
|
|
217
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpEffectComposer, decorators: [{
|
|
218
326
|
type: Component,
|
|
219
327
|
args: [{
|
|
220
328
|
selector: 'ngtp-effect-composer',
|
|
@@ -226,8 +334,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
226
334
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
227
335
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
228
336
|
}]
|
|
229
|
-
}], ctorParameters: () => [] });
|
|
337
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], groupRef: [{ type: i0.ViewChild, args: ['group', { isSignal: true }] }] } });
|
|
230
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Fragment shader for the ASCII effect.
|
|
341
|
+
* Converts the scene into ASCII character representation based on pixel brightness.
|
|
342
|
+
*/
|
|
231
343
|
const fragment = /* language=glsl glsl */ `
|
|
232
344
|
uniform sampler2D uCharacters;
|
|
233
345
|
uniform float uCharactersCount;
|
|
@@ -268,6 +380,21 @@ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor)
|
|
|
268
380
|
outputColor = asciiCharacter;
|
|
269
381
|
}
|
|
270
382
|
`;
|
|
383
|
+
/**
|
|
384
|
+
* A postprocessing effect that renders the scene as ASCII art.
|
|
385
|
+
*
|
|
386
|
+
* This effect converts the rendered scene into a grid of ASCII characters,
|
|
387
|
+
* where the character used depends on the brightness of the underlying pixels.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```typescript
|
|
391
|
+
* const effect = new ASCIIEffect({
|
|
392
|
+
* cellSize: 12,
|
|
393
|
+
* color: '#00ff00',
|
|
394
|
+
* characters: ' .:-=+*#%@'
|
|
395
|
+
* });
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
271
398
|
class ASCIIEffect extends Effect {
|
|
272
399
|
constructor({ font = 'arial', characters = ` .:,'-^=*+?!|0#X%WM@`, fontSize = 54, cellSize = 16, color = '#ffffff', invert = false, } = {}) {
|
|
273
400
|
const uniforms = new Map([
|
|
@@ -283,7 +410,17 @@ class ASCIIEffect extends Effect {
|
|
|
283
410
|
charactersTextureUniform.value = this.createCharactersTexture(characters, font, fontSize);
|
|
284
411
|
}
|
|
285
412
|
}
|
|
286
|
-
/**
|
|
413
|
+
/**
|
|
414
|
+
* Creates a texture containing all the ASCII characters.
|
|
415
|
+
*
|
|
416
|
+
* Draws each character in the character set onto a canvas and creates
|
|
417
|
+
* a texture that can be sampled in the shader.
|
|
418
|
+
*
|
|
419
|
+
* @param characters - The character set to render
|
|
420
|
+
* @param font - The font family to use
|
|
421
|
+
* @param fontSize - The font size in pixels
|
|
422
|
+
* @returns A Three.js texture containing the rendered characters
|
|
423
|
+
*/
|
|
287
424
|
createCharactersTexture(characters, font, fontSize) {
|
|
288
425
|
const canvas = document.createElement('canvas');
|
|
289
426
|
const SIZE = 1024;
|
|
@@ -318,21 +455,39 @@ const defaultOptions$4 = {
|
|
|
318
455
|
color: '#ffffff',
|
|
319
456
|
invert: false,
|
|
320
457
|
};
|
|
458
|
+
/**
|
|
459
|
+
* Angular component that applies an ASCII art postprocessing effect to the scene.
|
|
460
|
+
*
|
|
461
|
+
* Renders the scene as ASCII characters, where character selection is based on
|
|
462
|
+
* the brightness of the underlying pixels.
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```html
|
|
466
|
+
* <ngtp-effect-composer>
|
|
467
|
+
* <ngtp-ascii [options]="{ cellSize: 12, color: '#00ff00' }" />
|
|
468
|
+
* </ngtp-effect-composer>
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
321
471
|
class NgtpASCII {
|
|
322
472
|
constructor() {
|
|
323
|
-
|
|
324
|
-
|
|
473
|
+
/**
|
|
474
|
+
* Configuration options for the ASCII effect.
|
|
475
|
+
* @see ASCIIEffectOptions
|
|
476
|
+
*/
|
|
477
|
+
this.options = input(defaultOptions$4, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$4) });
|
|
478
|
+
/** The underlying ASCIIEffect instance */
|
|
479
|
+
this.effect = computed(() => new ASCIIEffect(this.options()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
325
480
|
effect((onCleanup) => {
|
|
326
481
|
const effect = this.effect();
|
|
327
482
|
onCleanup(() => effect.dispose());
|
|
328
483
|
});
|
|
329
484
|
}
|
|
330
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
331
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
485
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpASCII, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
486
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpASCII, isStandalone: true, selector: "ngtp-ascii", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
332
487
|
<ngt-primitive *args="[effect()]" />
|
|
333
488
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
334
489
|
}
|
|
335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpASCII, decorators: [{
|
|
336
491
|
type: Component,
|
|
337
492
|
args: [{
|
|
338
493
|
selector: 'ngtp-ascii',
|
|
@@ -343,23 +498,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
343
498
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
344
499
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
345
500
|
}]
|
|
346
|
-
}], ctorParameters: () => [] });
|
|
501
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
347
502
|
|
|
503
|
+
/**
|
|
504
|
+
* Angular component that applies a bloom postprocessing effect to the scene.
|
|
505
|
+
*
|
|
506
|
+
* The bloom effect creates a glow around bright areas of the scene, simulating
|
|
507
|
+
* the way bright light bleeds in cameras and the human eye.
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```html
|
|
511
|
+
* <ngtp-effect-composer>
|
|
512
|
+
* <ngtp-bloom [options]="{ intensity: 1, luminanceThreshold: 0.9 }" />
|
|
513
|
+
* </ngtp-effect-composer>
|
|
514
|
+
* ```
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```html
|
|
518
|
+
* <!-- With custom blend function -->
|
|
519
|
+
* <ngtp-effect-composer>
|
|
520
|
+
* <ngtp-bloom
|
|
521
|
+
* [blendFunction]="BlendFunction.SCREEN"
|
|
522
|
+
* [options]="{ intensity: 0.5, luminanceSmoothing: 0.9 }"
|
|
523
|
+
* />
|
|
524
|
+
* </ngtp-effect-composer>
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
348
527
|
class NgtpBloom {
|
|
349
528
|
constructor() {
|
|
350
|
-
|
|
529
|
+
/**
|
|
530
|
+
* Configuration options for the bloom effect.
|
|
531
|
+
* Accepts all BloomEffectOptions except blendFunction (use the blendFunction input instead).
|
|
532
|
+
* @see BloomEffectOptions from postprocessing library
|
|
533
|
+
*/
|
|
534
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
535
|
+
/** Reference to the host NgtpEffect directive */
|
|
351
536
|
this.effect = inject(NgtpEffect, { host: true });
|
|
352
537
|
extend({ BloomEffect });
|
|
353
538
|
}
|
|
354
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
355
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
539
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBloom, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
540
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpBloom, isStandalone: true, selector: "ngtp-bloom", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
356
541
|
<ngt-bloom-effect *args="[options()]" [camera]="effect.camera()">
|
|
357
542
|
<ngtp-effect-blend-mode />
|
|
358
543
|
<ng-content />
|
|
359
544
|
</ngt-bloom-effect>
|
|
360
545
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtpEffectBlendMode, selector: "ngtp-effect-blend-mode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
361
546
|
}
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBloom, decorators: [{
|
|
363
548
|
type: Component,
|
|
364
549
|
args: [{
|
|
365
550
|
selector: 'ngtp-bloom',
|
|
@@ -375,23 +560,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
375
560
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
376
561
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
|
|
377
562
|
}]
|
|
378
|
-
}], ctorParameters: () => [] });
|
|
563
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
379
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Angular component that applies brightness and contrast adjustments to the scene.
|
|
567
|
+
*
|
|
568
|
+
* This effect allows you to modify the overall brightness and contrast of the
|
|
569
|
+
* rendered scene as a postprocessing step.
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```html
|
|
573
|
+
* <ngtp-effect-composer>
|
|
574
|
+
* <ngtp-brightness-contrast [options]="{ brightness: 0.1, contrast: 0.2 }" />
|
|
575
|
+
* </ngtp-effect-composer>
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
380
578
|
class NgtpBrightnessContrast {
|
|
381
579
|
constructor() {
|
|
382
|
-
|
|
580
|
+
/**
|
|
581
|
+
* Configuration options for the brightness/contrast effect.
|
|
582
|
+
* @see BrightnessEffectOptions
|
|
583
|
+
*/
|
|
584
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
585
|
+
/** Reference to the host NgtpEffect directive */
|
|
383
586
|
this.effect = inject(NgtpEffect, { host: true });
|
|
384
587
|
extend({ BrightnessContrastEffect });
|
|
385
588
|
}
|
|
386
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
387
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
589
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBrightnessContrast, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
590
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpBrightnessContrast, isStandalone: true, selector: "ngtp-brightness-contrast", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
388
591
|
<ngt-brightness-contrast-effect *args="[options()]" [camera]="effect.camera()">
|
|
389
592
|
<ngtp-effect-blend-mode />
|
|
390
593
|
<ng-content />
|
|
391
594
|
</ngt-brightness-contrast-effect>
|
|
392
595
|
`, 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 }); }
|
|
393
596
|
}
|
|
394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBrightnessContrast, decorators: [{
|
|
395
598
|
type: Component,
|
|
396
599
|
args: [{
|
|
397
600
|
selector: 'ngtp-brightness-contrast',
|
|
@@ -406,23 +609,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
406
609
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
407
610
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
408
611
|
}]
|
|
409
|
-
}], ctorParameters: () => [] });
|
|
612
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
410
613
|
|
|
614
|
+
/**
|
|
615
|
+
* Angular component that applies a chromatic aberration effect to the scene.
|
|
616
|
+
*
|
|
617
|
+
* Chromatic aberration simulates the color fringing that occurs in real camera lenses
|
|
618
|
+
* when different wavelengths of light are focused at different distances.
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```html
|
|
622
|
+
* <ngtp-effect-composer>
|
|
623
|
+
* <ngtp-chromatic-aberration [options]="{ offset: [0.002, 0.002] }" />
|
|
624
|
+
* </ngtp-effect-composer>
|
|
625
|
+
* ```
|
|
626
|
+
*/
|
|
411
627
|
class NgtpChromaticAberration {
|
|
412
628
|
constructor() {
|
|
413
|
-
|
|
629
|
+
/**
|
|
630
|
+
* Configuration options for the chromatic aberration effect.
|
|
631
|
+
* @see ChromaticAberrationEffectOptions
|
|
632
|
+
*/
|
|
633
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
634
|
+
/** Reference to the host NgtpEffect directive */
|
|
414
635
|
this.effect = inject(NgtpEffect, { host: true });
|
|
415
636
|
extend({ ChromaticAberrationEffect });
|
|
416
637
|
}
|
|
417
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
418
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
638
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpChromaticAberration, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
639
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpChromaticAberration, isStandalone: true, selector: "ngtp-chromatic-aberration", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
419
640
|
<ngt-chromatic-aberration-effect *args="[options()]" [camera]="effect.camera()">
|
|
420
641
|
<ngtp-effect-blend-mode />
|
|
421
642
|
<ng-content />
|
|
422
643
|
</ngt-chromatic-aberration-effect>
|
|
423
644
|
`, 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 }); }
|
|
424
645
|
}
|
|
425
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
646
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpChromaticAberration, decorators: [{
|
|
426
647
|
type: Component,
|
|
427
648
|
args: [{
|
|
428
649
|
selector: 'ngtp-chromatic-aberration',
|
|
@@ -437,21 +658,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
437
658
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
438
659
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
439
660
|
}]
|
|
440
|
-
}], ctorParameters: () => [] });
|
|
661
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
441
662
|
|
|
663
|
+
/**
|
|
664
|
+
* Angular component that applies a color averaging effect to the scene.
|
|
665
|
+
*
|
|
666
|
+
* This effect converts the scene to grayscale by averaging the color channels,
|
|
667
|
+
* which can create a desaturated or monochrome look.
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* ```html
|
|
671
|
+
* <ngtp-effect-composer>
|
|
672
|
+
* <ngtp-color-average />
|
|
673
|
+
* </ngtp-effect-composer>
|
|
674
|
+
* ```
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```html
|
|
678
|
+
* <!-- With custom blend function -->
|
|
679
|
+
* <ngtp-effect-composer>
|
|
680
|
+
* <ngtp-color-average [options]="{ blendFunction: BlendFunction.MULTIPLY }" />
|
|
681
|
+
* </ngtp-effect-composer>
|
|
682
|
+
* ```
|
|
683
|
+
*/
|
|
442
684
|
class NgtpColorAverage {
|
|
443
685
|
constructor() {
|
|
444
|
-
|
|
686
|
+
/**
|
|
687
|
+
* Configuration options for the color average effect.
|
|
688
|
+
* @default { blendFunction: BlendFunction.NORMAL }
|
|
689
|
+
*/
|
|
690
|
+
this.options = input({ blendFunction: BlendFunction.NORMAL }, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs({ blendFunction: BlendFunction.NORMAL }) });
|
|
445
691
|
extend({ ColorAverageEffect });
|
|
446
692
|
}
|
|
447
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
448
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
693
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorAverage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
694
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpColorAverage, isStandalone: true, selector: "ngtp-color-average", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
449
695
|
<ngt-color-average-effect *args="[options().blendFunction]">
|
|
450
696
|
<ng-content />
|
|
451
697
|
</ngt-color-average-effect>
|
|
452
698
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
453
699
|
}
|
|
454
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
700
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorAverage, decorators: [{
|
|
455
701
|
type: Component,
|
|
456
702
|
args: [{
|
|
457
703
|
selector: 'ngtp-color-average',
|
|
@@ -464,23 +710,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
464
710
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
465
711
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
466
712
|
}]
|
|
467
|
-
}], ctorParameters: () => [] });
|
|
713
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
468
714
|
|
|
715
|
+
/**
|
|
716
|
+
* Angular component that applies a color depth reduction effect to the scene.
|
|
717
|
+
*
|
|
718
|
+
* This effect reduces the number of colors in the scene, creating a posterized
|
|
719
|
+
* or retro look similar to older display hardware with limited color palettes.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```html
|
|
723
|
+
* <ngtp-effect-composer>
|
|
724
|
+
* <ngtp-color-depth [options]="{ bits: 4 }" />
|
|
725
|
+
* </ngtp-effect-composer>
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
469
728
|
class NgtpColorDepth {
|
|
470
729
|
constructor() {
|
|
471
|
-
|
|
730
|
+
/**
|
|
731
|
+
* Configuration options for the color depth effect.
|
|
732
|
+
* @see ColorDepthEffectOptions
|
|
733
|
+
*/
|
|
734
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
735
|
+
/** Reference to the host NgtpEffect directive */
|
|
472
736
|
this.effect = inject(NgtpEffect, { host: true });
|
|
473
737
|
extend({ ColorDepthEffect });
|
|
474
738
|
}
|
|
475
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
476
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
739
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorDepth, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
740
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpColorDepth, isStandalone: true, selector: "ngtp-color-depth", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
477
741
|
<ngt-color-depth-effect *args="[options()]" [camera]="effect.camera()">
|
|
478
742
|
<ngtp-effect-blend-mode />
|
|
479
743
|
<ng-content />
|
|
480
744
|
</ngt-color-depth-effect>
|
|
481
745
|
`, 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 }); }
|
|
482
746
|
}
|
|
483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorDepth, decorators: [{
|
|
484
748
|
type: Component,
|
|
485
749
|
args: [{
|
|
486
750
|
selector: 'ngtp-color-depth',
|
|
@@ -495,23 +759,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
495
759
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
496
760
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
497
761
|
}]
|
|
498
|
-
}], ctorParameters: () => [] });
|
|
762
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
499
763
|
|
|
764
|
+
/**
|
|
765
|
+
* Angular component that visualizes the scene's depth buffer.
|
|
766
|
+
*
|
|
767
|
+
* This effect renders the depth information of the scene, which can be useful
|
|
768
|
+
* for debugging or creating stylized depth-based visualizations.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```html
|
|
772
|
+
* <ngtp-effect-composer>
|
|
773
|
+
* <ngtp-depth [options]="{ inverted: true }" />
|
|
774
|
+
* </ngtp-effect-composer>
|
|
775
|
+
* ```
|
|
776
|
+
*/
|
|
500
777
|
class NgtpDepth {
|
|
501
778
|
constructor() {
|
|
502
|
-
|
|
779
|
+
/**
|
|
780
|
+
* Configuration options for the depth effect.
|
|
781
|
+
* @see DepthEffectOptions
|
|
782
|
+
*/
|
|
783
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
784
|
+
/** Reference to the host NgtpEffect directive */
|
|
503
785
|
this.effect = inject(NgtpEffect, { host: true });
|
|
504
786
|
extend({ DepthEffect });
|
|
505
787
|
}
|
|
506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
507
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
788
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepth, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
789
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpDepth, isStandalone: true, selector: "ngtp-depth", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
508
790
|
<ngt-depth-effect *args="[options()]" [camera]="effect.camera()">
|
|
509
791
|
<ngtp-effect-blend-mode />
|
|
510
792
|
<ng-content />
|
|
511
793
|
</ngt-depth-effect>
|
|
512
794
|
`, 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 }); }
|
|
513
795
|
}
|
|
514
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
796
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepth, decorators: [{
|
|
515
797
|
type: Component,
|
|
516
798
|
args: [{
|
|
517
799
|
selector: 'ngtp-depth',
|
|
@@ -526,12 +808,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
526
808
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
527
809
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
528
810
|
}]
|
|
529
|
-
}], ctorParameters: () => [] });
|
|
811
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
530
812
|
|
|
813
|
+
/**
|
|
814
|
+
* Angular component that applies a depth of field effect to the scene.
|
|
815
|
+
*
|
|
816
|
+
* This effect simulates the focus behavior of real camera lenses, blurring
|
|
817
|
+
* objects that are outside the focal range. Can be configured for autofocus
|
|
818
|
+
* by providing a target position.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```html
|
|
822
|
+
* <ngtp-effect-composer>
|
|
823
|
+
* <ngtp-depth-of-field [options]="{ focusDistance: 0, focalLength: 0.02, bokehScale: 2 }" />
|
|
824
|
+
* </ngtp-effect-composer>
|
|
825
|
+
* ```
|
|
826
|
+
*
|
|
827
|
+
* @example
|
|
828
|
+
* ```html
|
|
829
|
+
* <!-- With autofocus target -->
|
|
830
|
+
* <ngtp-effect-composer>
|
|
831
|
+
* <ngtp-depth-of-field [options]="{ target: [0, 0, 5], bokehScale: 3 }" />
|
|
832
|
+
* </ngtp-effect-composer>
|
|
833
|
+
* ```
|
|
834
|
+
*/
|
|
531
835
|
class NgtpDepthOfField {
|
|
532
836
|
constructor() {
|
|
533
|
-
|
|
837
|
+
/**
|
|
838
|
+
* Configuration options for the depth of field effect.
|
|
839
|
+
* @see DOFOptions
|
|
840
|
+
*/
|
|
841
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
534
842
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
843
|
+
/**
|
|
844
|
+
* Creates the DepthOfFieldEffect instance with the configured options.
|
|
845
|
+
* Enables autofocus if a target is provided and applies depth texture settings.
|
|
846
|
+
*/
|
|
535
847
|
this.effect = computed(() => {
|
|
536
848
|
const [camera, options] = [this.effectComposer.camera(), this.options()];
|
|
537
849
|
const autoFocus = options.target != null;
|
|
@@ -547,18 +859,18 @@ class NgtpDepthOfField {
|
|
|
547
859
|
const maskPass = effect['maskPass'];
|
|
548
860
|
maskPass.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA;
|
|
549
861
|
return effect;
|
|
550
|
-
});
|
|
862
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
551
863
|
effect((onCleanup) => {
|
|
552
864
|
const depthOfFieldEffect = this.effect();
|
|
553
865
|
onCleanup(() => depthOfFieldEffect.dispose());
|
|
554
866
|
});
|
|
555
867
|
}
|
|
556
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
557
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
868
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepthOfField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
869
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpDepthOfField, isStandalone: true, selector: "ngtp-depth-of-field", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
558
870
|
<ngt-primitive *args="[effect()]" />
|
|
559
871
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
560
872
|
}
|
|
561
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
873
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepthOfField, decorators: [{
|
|
562
874
|
type: Component,
|
|
563
875
|
args: [{
|
|
564
876
|
selector: 'ngtp-depth-of-field',
|
|
@@ -569,23 +881,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
569
881
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
570
882
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
571
883
|
}]
|
|
572
|
-
}], ctorParameters: () => [] });
|
|
884
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
573
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Angular component that applies a dot screen effect to the scene.
|
|
888
|
+
*
|
|
889
|
+
* This effect overlays a pattern of dots on the scene, creating a halftone
|
|
890
|
+
* or comic book style appearance.
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```html
|
|
894
|
+
* <ngtp-effect-composer>
|
|
895
|
+
* <ngtp-dot-screen [options]="{ scale: 1.5, angle: Math.PI * 0.25 }" />
|
|
896
|
+
* </ngtp-effect-composer>
|
|
897
|
+
* ```
|
|
898
|
+
*/
|
|
574
899
|
class NgtpDotScreen {
|
|
575
900
|
constructor() {
|
|
576
|
-
|
|
901
|
+
/**
|
|
902
|
+
* Configuration options for the dot screen effect.
|
|
903
|
+
* @see DotScreenEffectOptions
|
|
904
|
+
*/
|
|
905
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
906
|
+
/** Reference to the host NgtpEffect directive */
|
|
577
907
|
this.effect = inject(NgtpEffect, { host: true });
|
|
578
908
|
extend({ DotScreenEffect });
|
|
579
909
|
}
|
|
580
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
581
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
910
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDotScreen, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
911
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpDotScreen, isStandalone: true, selector: "ngtp-dot-screen", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
582
912
|
<ngt-dot-screen-effect *args="[options()]" [camera]="effect.camera()">
|
|
583
913
|
<ngtp-effect-blend-mode />
|
|
584
914
|
<ng-content />
|
|
585
915
|
</ngt-dot-screen-effect>
|
|
586
916
|
`, 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 }); }
|
|
587
917
|
}
|
|
588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDotScreen, decorators: [{
|
|
589
919
|
type: Component,
|
|
590
920
|
args: [{
|
|
591
921
|
selector: 'ngtp-dot-screen',
|
|
@@ -600,23 +930,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
600
930
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
601
931
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
602
932
|
}]
|
|
603
|
-
}], ctorParameters: () => [] });
|
|
933
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
604
934
|
|
|
935
|
+
/**
|
|
936
|
+
* Angular component that applies Fast Approximate Anti-Aliasing (FXAA) to the scene.
|
|
937
|
+
*
|
|
938
|
+
* FXAA is a fast, single-pass anti-aliasing technique that smooths jagged edges
|
|
939
|
+
* in the rendered image. It's less demanding than multisampling but may blur
|
|
940
|
+
* some fine details.
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* ```html
|
|
944
|
+
* <ngtp-effect-composer [options]="{ multisampling: 0 }">
|
|
945
|
+
* <ngtp-fxaa />
|
|
946
|
+
* </ngtp-effect-composer>
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
605
949
|
class NgtpFXAA {
|
|
606
950
|
constructor() {
|
|
607
|
-
|
|
951
|
+
/**
|
|
952
|
+
* Configuration options for the FXAA effect.
|
|
953
|
+
* @see FXAAEffectOptions
|
|
954
|
+
*/
|
|
955
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
956
|
+
/** Reference to the host NgtpEffect directive */
|
|
608
957
|
this.effect = inject(NgtpEffect, { host: true });
|
|
609
958
|
extend({ FXAAEffect });
|
|
610
959
|
}
|
|
611
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
612
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
960
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpFXAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
961
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpFXAA, isStandalone: true, selector: "ngtp-fxaa", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
613
962
|
<ngt-fXAA-effect *args="[options()]" [camera]="effect.camera()">
|
|
614
963
|
<ngtp-effect-blend-mode />
|
|
615
964
|
<ng-content />
|
|
616
965
|
</ngt-fXAA-effect>
|
|
617
966
|
`, 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 }); }
|
|
618
967
|
}
|
|
619
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
968
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpFXAA, decorators: [{
|
|
620
969
|
type: Component,
|
|
621
970
|
args: [{
|
|
622
971
|
selector: 'ngtp-fxaa',
|
|
@@ -631,11 +980,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
631
980
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
632
981
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
633
982
|
}]
|
|
634
|
-
}], ctorParameters: () => [] });
|
|
983
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
635
984
|
|
|
985
|
+
/**
|
|
986
|
+
* Angular component that applies a glitch effect to the scene.
|
|
987
|
+
*
|
|
988
|
+
* This effect simulates digital glitches with customizable timing, strength,
|
|
989
|
+
* and chromatic aberration. Can be toggled on/off and configured for different
|
|
990
|
+
* glitch modes.
|
|
991
|
+
*
|
|
992
|
+
* @example
|
|
993
|
+
* ```html
|
|
994
|
+
* <ngtp-effect-composer>
|
|
995
|
+
* <ngtp-glitch [options]="{ delay: [1.5, 3.5], duration: [0.6, 1.0] }" />
|
|
996
|
+
* </ngtp-effect-composer>
|
|
997
|
+
* ```
|
|
998
|
+
*
|
|
999
|
+
* @example
|
|
1000
|
+
* ```html
|
|
1001
|
+
* <!-- Constant glitch mode -->
|
|
1002
|
+
* <ngtp-effect-composer>
|
|
1003
|
+
* <ngtp-glitch [options]="{ mode: GlitchMode.CONSTANT_MILD, active: true }" />
|
|
1004
|
+
* </ngtp-effect-composer>
|
|
1005
|
+
* ```
|
|
1006
|
+
*/
|
|
636
1007
|
class NgtpGlitch {
|
|
637
1008
|
constructor() {
|
|
638
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Configuration options for the glitch effect.
|
|
1011
|
+
* @default { active: true }
|
|
1012
|
+
* @see GlitchOptions
|
|
1013
|
+
*/
|
|
1014
|
+
this.options = input({ active: true }, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs({ active: true }) });
|
|
639
1015
|
this.active = pick(this.options, 'active');
|
|
640
1016
|
this.mode = pick(this.options, 'mode');
|
|
641
1017
|
this.ratio = pick(this.options, 'ratio');
|
|
@@ -648,6 +1024,10 @@ class NgtpGlitch {
|
|
|
648
1024
|
this.chromaticAberrationOffset = vector2(this.options, 'chromaticAberrationOffset');
|
|
649
1025
|
this.strength = vector2(this.options, 'strength');
|
|
650
1026
|
this.store = injectStore();
|
|
1027
|
+
/**
|
|
1028
|
+
* The underlying GlitchEffect instance.
|
|
1029
|
+
* Created with the configured options and vector2 parameters.
|
|
1030
|
+
*/
|
|
651
1031
|
this.effect = computed(() => new GlitchEffect({
|
|
652
1032
|
ratio: this.ratio(),
|
|
653
1033
|
dtSize: this.dtSize(),
|
|
@@ -658,7 +1038,7 @@ class NgtpGlitch {
|
|
|
658
1038
|
duration: this.duration(),
|
|
659
1039
|
chromaticAberrationOffset: this.chromaticAberrationOffset(),
|
|
660
1040
|
strength: this.strength(),
|
|
661
|
-
}));
|
|
1041
|
+
}), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
662
1042
|
effect(() => {
|
|
663
1043
|
const [glitchEffect, invalidate, mode, active] = [
|
|
664
1044
|
this.effect(),
|
|
@@ -674,12 +1054,12 @@ class NgtpGlitch {
|
|
|
674
1054
|
onCleanup(() => effect.dispose());
|
|
675
1055
|
});
|
|
676
1056
|
}
|
|
677
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
678
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1057
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGlitch, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1058
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpGlitch, isStandalone: true, selector: "ngtp-glitch", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
679
1059
|
<ngt-primitive *args="[effect()]" />
|
|
680
1060
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
681
1061
|
}
|
|
682
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGlitch, decorators: [{
|
|
683
1063
|
type: Component,
|
|
684
1064
|
args: [{
|
|
685
1065
|
selector: 'ngtp-glitch',
|
|
@@ -690,24 +1070,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
690
1070
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
691
1071
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
692
1072
|
}]
|
|
693
|
-
}], ctorParameters: () => [] });
|
|
1073
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
694
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* Angular component that applies a god rays (volumetric lighting) effect to the scene.
|
|
1077
|
+
*
|
|
1078
|
+
* This effect creates light shafts emanating from a light source, simulating
|
|
1079
|
+
* the way light scatters through atmospheric particles. Requires a sun/light
|
|
1080
|
+
* source mesh to generate the rays from.
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```html
|
|
1084
|
+
* <ngt-mesh #sun [position]="[0, 5, -10]">
|
|
1085
|
+
* <ngt-sphere-geometry />
|
|
1086
|
+
* <ngt-mesh-basic-material color="yellow" />
|
|
1087
|
+
* </ngt-mesh>
|
|
1088
|
+
*
|
|
1089
|
+
* <ngtp-effect-composer>
|
|
1090
|
+
* <ngtp-god-rays [options]="{ sun: sunRef, density: 0.96 }" />
|
|
1091
|
+
* </ngtp-effect-composer>
|
|
1092
|
+
* ```
|
|
1093
|
+
*/
|
|
695
1094
|
class NgtpGodRays {
|
|
696
1095
|
constructor() {
|
|
697
|
-
|
|
1096
|
+
/**
|
|
1097
|
+
* Configuration options for the god rays effect.
|
|
1098
|
+
* Must include a `sun` property with the light source reference.
|
|
1099
|
+
* @see GodRaysOptions
|
|
1100
|
+
*/
|
|
1101
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
698
1102
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
699
1103
|
this.effectOptions = omit(this.options, ['sun']);
|
|
700
1104
|
this.sun = pick(this.options, 'sun');
|
|
1105
|
+
/**
|
|
1106
|
+
* Resolves the sun reference to the actual Three.js object.
|
|
1107
|
+
* Handles both direct references and function references.
|
|
1108
|
+
*/
|
|
701
1109
|
this.sunElement = computed(() => {
|
|
702
1110
|
const sun = this.sun();
|
|
703
1111
|
if (typeof sun === 'function')
|
|
704
1112
|
return resolveRef(sun());
|
|
705
1113
|
return resolveRef(sun);
|
|
706
|
-
});
|
|
1114
|
+
}, ...(ngDevMode ? [{ debugName: "sunElement" }] : []));
|
|
1115
|
+
/**
|
|
1116
|
+
* The underlying GodRaysEffect instance.
|
|
1117
|
+
* Created with the camera, sun element, and configured options.
|
|
1118
|
+
*/
|
|
707
1119
|
this.effect = computed(() => {
|
|
708
1120
|
const [camera, sunElement, options] = [this.effectComposer.camera(), this.sunElement(), this.effectOptions()];
|
|
709
1121
|
return new GodRaysEffect(camera, sunElement, options);
|
|
710
|
-
});
|
|
1122
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
711
1123
|
effect(() => {
|
|
712
1124
|
const sunElement = this.sunElement();
|
|
713
1125
|
if (!sunElement)
|
|
@@ -720,12 +1132,12 @@ class NgtpGodRays {
|
|
|
720
1132
|
onCleanup(() => effect.dispose());
|
|
721
1133
|
});
|
|
722
1134
|
}
|
|
723
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
724
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1135
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGodRays, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1136
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpGodRays, isStandalone: true, selector: "ngtp-god-rays", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
725
1137
|
<ngt-primitive *args="[effect()]" />
|
|
726
1138
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
727
1139
|
}
|
|
728
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGodRays, decorators: [{
|
|
729
1141
|
type: Component,
|
|
730
1142
|
args: [{
|
|
731
1143
|
selector: 'ngtp-god-rays',
|
|
@@ -736,14 +1148,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
736
1148
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
737
1149
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
738
1150
|
}]
|
|
739
|
-
}], ctorParameters: () => [] });
|
|
1151
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
740
1152
|
|
|
1153
|
+
/**
|
|
1154
|
+
* Angular component that applies a grid overlay effect to the scene.
|
|
1155
|
+
*
|
|
1156
|
+
* This effect overlays a grid pattern on the rendered scene, which can be
|
|
1157
|
+
* useful for technical visualization or stylized effects.
|
|
1158
|
+
*
|
|
1159
|
+
* @example
|
|
1160
|
+
* ```html
|
|
1161
|
+
* <ngtp-effect-composer>
|
|
1162
|
+
* <ngtp-grid [options]="{ scale: 1.5, lineWidth: 0.5 }" />
|
|
1163
|
+
* </ngtp-effect-composer>
|
|
1164
|
+
* ```
|
|
1165
|
+
*/
|
|
741
1166
|
class NgtpGrid {
|
|
742
1167
|
constructor() {
|
|
743
|
-
|
|
1168
|
+
/**
|
|
1169
|
+
* Configuration options for the grid effect.
|
|
1170
|
+
* @see GridOptions
|
|
1171
|
+
*/
|
|
1172
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
744
1173
|
this.effectOptions = omit(this.options, ['size']);
|
|
745
1174
|
this.size = pick(this.options, 'size');
|
|
746
|
-
|
|
1175
|
+
/** The underlying GridEffect instance */
|
|
1176
|
+
this.effect = computed(() => new GridEffect(this.effectOptions()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
747
1177
|
effect(() => {
|
|
748
1178
|
const [size, effect] = [this.size(), this.effect()];
|
|
749
1179
|
if (size) {
|
|
@@ -755,12 +1185,12 @@ class NgtpGrid {
|
|
|
755
1185
|
onCleanup(() => effect.dispose());
|
|
756
1186
|
});
|
|
757
1187
|
}
|
|
758
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
759
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1188
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1189
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpGrid, isStandalone: true, selector: "ngtp-grid", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
760
1190
|
<ngt-primitive *args="[effect()]" />
|
|
761
1191
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
762
1192
|
}
|
|
763
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGrid, decorators: [{
|
|
764
1194
|
type: Component,
|
|
765
1195
|
args: [{
|
|
766
1196
|
selector: 'ngtp-grid',
|
|
@@ -771,23 +1201,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
771
1201
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
772
1202
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
773
1203
|
}]
|
|
774
|
-
}], ctorParameters: () => [] });
|
|
1204
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
775
1205
|
|
|
1206
|
+
/**
|
|
1207
|
+
* Angular component that applies hue and saturation adjustments to the scene.
|
|
1208
|
+
*
|
|
1209
|
+
* This effect allows you to shift the hue and adjust the saturation of the
|
|
1210
|
+
* rendered scene as a postprocessing step.
|
|
1211
|
+
*
|
|
1212
|
+
* @example
|
|
1213
|
+
* ```html
|
|
1214
|
+
* <ngtp-effect-composer>
|
|
1215
|
+
* <ngtp-hue-saturation [options]="{ hue: 0.5, saturation: 0.2 }" />
|
|
1216
|
+
* </ngtp-effect-composer>
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|
|
776
1219
|
class NgtpHueSaturation {
|
|
777
1220
|
constructor() {
|
|
778
|
-
|
|
1221
|
+
/**
|
|
1222
|
+
* Configuration options for the hue/saturation effect.
|
|
1223
|
+
* @see HueSaturationEffectOptions
|
|
1224
|
+
*/
|
|
1225
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1226
|
+
/** Reference to the host NgtpEffect directive */
|
|
779
1227
|
this.effect = inject(NgtpEffect, { host: true });
|
|
780
1228
|
extend({ HueSaturationEffect });
|
|
781
1229
|
}
|
|
782
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
783
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1230
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpHueSaturation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1231
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpHueSaturation, isStandalone: true, selector: "ngtp-hue-saturation", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
784
1232
|
<ngt-hue-saturation-effect *args="[options()]" [camera]="effect.camera()">
|
|
785
1233
|
<ngtp-effect-blend-mode />
|
|
786
1234
|
<ng-content />
|
|
787
1235
|
</ngt-hue-saturation-effect>
|
|
788
1236
|
`, 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 }); }
|
|
789
1237
|
}
|
|
790
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpHueSaturation, decorators: [{
|
|
791
1239
|
type: Component,
|
|
792
1240
|
args: [{
|
|
793
1241
|
selector: 'ngtp-hue-saturation',
|
|
@@ -802,10 +1250,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
802
1250
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
803
1251
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
804
1252
|
}]
|
|
805
|
-
}], ctorParameters: () => [] });
|
|
1253
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
806
1254
|
|
|
807
|
-
|
|
808
|
-
|
|
1255
|
+
/**
|
|
1256
|
+
* Lens Flare Effect
|
|
1257
|
+
* Created by Anderson Mancini 2023
|
|
1258
|
+
* React Three Fiber Ultimate LensFlare - Ported to Angular Three
|
|
1259
|
+
*/
|
|
1260
|
+
/**
|
|
1261
|
+
* Shader configuration for the lens flare effect.
|
|
1262
|
+
* Contains the GLSL fragment shader code.
|
|
1263
|
+
*/
|
|
809
1264
|
const LensFlareShader = {
|
|
810
1265
|
fragmentShader: /* language=glsl glsl */ `
|
|
811
1266
|
|
|
@@ -853,7 +1308,46 @@ const LensFlareShader = {
|
|
|
853
1308
|
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);}
|
|
854
1309
|
`,
|
|
855
1310
|
};
|
|
1311
|
+
/**
|
|
1312
|
+
* A postprocessing effect that simulates camera lens flares.
|
|
1313
|
+
*
|
|
1314
|
+
* Creates realistic lens flare effects including glare, ghosts, star bursts,
|
|
1315
|
+
* and anamorphic flares. Can be animated and positioned dynamically.
|
|
1316
|
+
*
|
|
1317
|
+
* @example
|
|
1318
|
+
* ```typescript
|
|
1319
|
+
* const effect = new LensFlareEffect({
|
|
1320
|
+
* glareSize: 0.3,
|
|
1321
|
+
* starPoints: 8,
|
|
1322
|
+
* animated: true
|
|
1323
|
+
* });
|
|
1324
|
+
* ```
|
|
1325
|
+
*/
|
|
856
1326
|
class LensFlareEffect extends Effect {
|
|
1327
|
+
/**
|
|
1328
|
+
* Creates a new LensFlareEffect instance.
|
|
1329
|
+
*
|
|
1330
|
+
* @param options - Configuration options for the lens flare
|
|
1331
|
+
* @param options.blendFunction - How to blend with the scene
|
|
1332
|
+
* @param options.enabled - Whether the effect is enabled
|
|
1333
|
+
* @param options.glareSize - Size of the glare
|
|
1334
|
+
* @param options.lensPosition - Position of the lens on screen
|
|
1335
|
+
* @param options.iResolution - Resolution of the effect
|
|
1336
|
+
* @param options.starPoints - Number of points in the star pattern
|
|
1337
|
+
* @param options.flareSize - Size of individual flares
|
|
1338
|
+
* @param options.flareSpeed - Animation speed of flares
|
|
1339
|
+
* @param options.flareShape - Shape parameter for flares
|
|
1340
|
+
* @param options.animated - Whether to animate the effect
|
|
1341
|
+
* @param options.anamorphic - Enable anamorphic lens simulation
|
|
1342
|
+
* @param options.colorGain - Color tint for the effect
|
|
1343
|
+
* @param options.lensDirtTexture - Texture for lens dirt overlay
|
|
1344
|
+
* @param options.haloScale - Scale of the halo effect
|
|
1345
|
+
* @param options.secondaryGhosts - Enable secondary ghost images
|
|
1346
|
+
* @param options.aditionalStreaks - Enable additional streak effects
|
|
1347
|
+
* @param options.ghostScale - Scale of ghost images
|
|
1348
|
+
* @param options.opacity - Opacity of the effect
|
|
1349
|
+
* @param options.starBurst - Enable star burst effect
|
|
1350
|
+
*/
|
|
857
1351
|
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 THREE.Color(20, 20, 20), lensDirtTexture = null, haloScale = 0.5, secondaryGhosts = true, aditionalStreaks = true, ghostScale = 0.0, opacity = 1.0, starBurst = false, } = {}) {
|
|
858
1352
|
super('LensFlareEffect', LensFlareShader.fragmentShader, {
|
|
859
1353
|
blendFunction,
|
|
@@ -880,6 +1374,13 @@ class LensFlareEffect extends Effect {
|
|
|
880
1374
|
]),
|
|
881
1375
|
});
|
|
882
1376
|
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Updates the effect's time uniform for animation.
|
|
1379
|
+
*
|
|
1380
|
+
* @param _renderer - The WebGL renderer (unused)
|
|
1381
|
+
* @param _inputBuffer - The input render target (unused)
|
|
1382
|
+
* @param deltaTime - Time elapsed since last frame
|
|
1383
|
+
*/
|
|
883
1384
|
update(_renderer, _inputBuffer, deltaTime) {
|
|
884
1385
|
const iTime = this.uniforms.get('iTime');
|
|
885
1386
|
if (iTime) {
|
|
@@ -892,16 +1393,45 @@ const defaultOptions$3 = {
|
|
|
892
1393
|
followMouse: false,
|
|
893
1394
|
smoothTime: 0.7,
|
|
894
1395
|
};
|
|
1396
|
+
/**
|
|
1397
|
+
* Angular component that applies a lens flare effect to the scene.
|
|
1398
|
+
*
|
|
1399
|
+
* This effect simulates realistic camera lens flares with support for
|
|
1400
|
+
* dynamic positioning, mouse following, and occlusion detection.
|
|
1401
|
+
* The flare automatically fades when occluded by scene objects.
|
|
1402
|
+
*
|
|
1403
|
+
* @example
|
|
1404
|
+
* ```html
|
|
1405
|
+
* <ngtp-effect-composer>
|
|
1406
|
+
* <ngtp-lens-flare [options]="{ position: [10, 5, -20], glareSize: 0.3 }" />
|
|
1407
|
+
* </ngtp-effect-composer>
|
|
1408
|
+
* ```
|
|
1409
|
+
*
|
|
1410
|
+
* @example
|
|
1411
|
+
* ```html
|
|
1412
|
+
* <!-- Mouse-following flare -->
|
|
1413
|
+
* <ngtp-effect-composer>
|
|
1414
|
+
* <ngtp-lens-flare [options]="{ followMouse: true, smoothTime: 0.5 }" />
|
|
1415
|
+
* </ngtp-effect-composer>
|
|
1416
|
+
* ```
|
|
1417
|
+
*/
|
|
895
1418
|
class NgtpLensFlare {
|
|
896
1419
|
constructor() {
|
|
897
|
-
|
|
1420
|
+
/**
|
|
1421
|
+
* Configuration options for the lens flare effect.
|
|
1422
|
+
* @see LensFlareOptions
|
|
1423
|
+
*/
|
|
1424
|
+
this.options = input(defaultOptions$3, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$3) });
|
|
898
1425
|
this.store = injectStore();
|
|
899
1426
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
900
1427
|
this.effectOptions = omit(this.options, ['position', 'followMouse', 'smoothTime']);
|
|
901
1428
|
this.position = vector3(this.options, 'position');
|
|
1429
|
+
/** Cached vector for projecting 3D position to screen space */
|
|
902
1430
|
this.projectedPosition = new THREE.Vector3();
|
|
1431
|
+
/** Cached vector for 2D mouse/raycaster coordinates */
|
|
903
1432
|
this.mouse2d = new THREE.Vector2();
|
|
904
|
-
|
|
1433
|
+
/** The underlying LensFlareEffect instance */
|
|
1434
|
+
this.effect = computed(() => new LensFlareEffect(this.effectOptions()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
905
1435
|
effect(() => {
|
|
906
1436
|
const [lensFlareEffect, width, height] = [
|
|
907
1437
|
this.effect(),
|
|
@@ -918,7 +1448,7 @@ class NgtpLensFlare {
|
|
|
918
1448
|
const effect = this.effect();
|
|
919
1449
|
onCleanup(() => effect.dispose());
|
|
920
1450
|
});
|
|
921
|
-
|
|
1451
|
+
beforeRender(({ delta }) => {
|
|
922
1452
|
const [effect] = [this.effect()];
|
|
923
1453
|
if (!effect)
|
|
924
1454
|
return;
|
|
@@ -975,12 +1505,12 @@ class NgtpLensFlare {
|
|
|
975
1505
|
easing.damp(uOpacity, 'value', target, smoothTime, delta);
|
|
976
1506
|
});
|
|
977
1507
|
}
|
|
978
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
979
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1508
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLensFlare, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1509
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpLensFlare, isStandalone: true, selector: "ngtp-lens-flare", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
980
1510
|
<ngt-primitive *args="[effect()]" [parameters]="{ dispose: null }" />
|
|
981
1511
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
982
1512
|
}
|
|
983
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLensFlare, decorators: [{
|
|
984
1514
|
type: Component,
|
|
985
1515
|
args: [{
|
|
986
1516
|
selector: 'ngtp-lens-flare',
|
|
@@ -991,18 +1521,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
991
1521
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
992
1522
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
993
1523
|
}]
|
|
994
|
-
}], ctorParameters: () => [] });
|
|
1524
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
995
1525
|
|
|
1526
|
+
/**
|
|
1527
|
+
* Angular component that applies a LUT (Look-Up Table) color grading effect.
|
|
1528
|
+
*
|
|
1529
|
+
* LUTs are used for color grading in film and photography. This effect applies
|
|
1530
|
+
* a 3D LUT texture to transform the colors of the rendered scene.
|
|
1531
|
+
*
|
|
1532
|
+
* @example
|
|
1533
|
+
* ```typescript
|
|
1534
|
+
* // In component
|
|
1535
|
+
* lutTexture = injectLoader(() => LUTCubeLoader, () => 'path/to/lut.cube');
|
|
1536
|
+
* ```
|
|
1537
|
+
*
|
|
1538
|
+
* ```html
|
|
1539
|
+
* <ngtp-effect-composer>
|
|
1540
|
+
* <ngtp-lut [options]="{ lut: lutTexture() }" />
|
|
1541
|
+
* </ngtp-effect-composer>
|
|
1542
|
+
* ```
|
|
1543
|
+
*/
|
|
996
1544
|
class NgtpLUT {
|
|
997
1545
|
constructor() {
|
|
998
|
-
|
|
1546
|
+
/**
|
|
1547
|
+
* Configuration options for the LUT effect.
|
|
1548
|
+
* Must include a `lut` texture.
|
|
1549
|
+
* @see LUTOptions
|
|
1550
|
+
*/
|
|
1551
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
999
1552
|
this.lut = pick(this.options, 'lut');
|
|
1000
1553
|
this.tetrahedralInterpolation = pick(this.options, 'tetrahedralInterpolation');
|
|
1001
1554
|
this.store = injectStore();
|
|
1555
|
+
/** The underlying LUT3DEffect instance */
|
|
1002
1556
|
this.effect = computed(() => {
|
|
1003
1557
|
const { lut, ...options } = this.options();
|
|
1004
1558
|
return new LUT3DEffect(lut, options);
|
|
1005
|
-
});
|
|
1559
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1006
1560
|
effect(() => {
|
|
1007
1561
|
const [effect, lut, tetrahedralInterpolation, invalidate] = [
|
|
1008
1562
|
this.effect(),
|
|
@@ -1021,12 +1575,12 @@ class NgtpLUT {
|
|
|
1021
1575
|
onCleanup(() => effect.dispose());
|
|
1022
1576
|
});
|
|
1023
1577
|
}
|
|
1024
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1025
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1578
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLUT, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1579
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpLUT, isStandalone: true, selector: "ngtp-lut", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1026
1580
|
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
1027
1581
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1028
1582
|
}
|
|
1029
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLUT, decorators: [{
|
|
1030
1584
|
type: Component,
|
|
1031
1585
|
args: [{
|
|
1032
1586
|
selector: 'ngtp-lut',
|
|
@@ -1037,23 +1591,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1037
1591
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1038
1592
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1039
1593
|
}]
|
|
1040
|
-
}], ctorParameters: () => [] });
|
|
1594
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1041
1595
|
|
|
1596
|
+
/**
|
|
1597
|
+
* Angular component that applies a noise/grain effect to the scene.
|
|
1598
|
+
*
|
|
1599
|
+
* This effect adds film grain or noise to the rendered image, which can
|
|
1600
|
+
* add a cinematic quality or help hide banding in gradients.
|
|
1601
|
+
*
|
|
1602
|
+
* @example
|
|
1603
|
+
* ```html
|
|
1604
|
+
* <ngtp-effect-composer>
|
|
1605
|
+
* <ngtp-noise [options]="{ premultiply: true }" />
|
|
1606
|
+
* </ngtp-effect-composer>
|
|
1607
|
+
* ```
|
|
1608
|
+
*/
|
|
1042
1609
|
class NgtpNoise {
|
|
1043
1610
|
constructor() {
|
|
1044
|
-
|
|
1611
|
+
/**
|
|
1612
|
+
* Configuration options for the noise effect.
|
|
1613
|
+
* @see NoiseEffectOptions
|
|
1614
|
+
*/
|
|
1615
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1616
|
+
/** Reference to the host NgtpEffect directive */
|
|
1045
1617
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1046
1618
|
extend({ NoiseEffect });
|
|
1047
1619
|
}
|
|
1048
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1049
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1620
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpNoise, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1621
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpNoise, isStandalone: true, selector: "ngtp-noise", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.COLOR_DODGE })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1050
1622
|
<ngt-noise-effect *args="[options()]" [camera]="effect.camera()">
|
|
1051
1623
|
<ngtp-effect-blend-mode />
|
|
1052
1624
|
<ng-content />
|
|
1053
1625
|
</ngt-noise-effect>
|
|
1054
1626
|
`, 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 }); }
|
|
1055
1627
|
}
|
|
1056
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpNoise, decorators: [{
|
|
1057
1629
|
type: Component,
|
|
1058
1630
|
args: [{
|
|
1059
1631
|
selector: 'ngtp-noise',
|
|
@@ -1069,15 +1641,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1069
1641
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1070
1642
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.COLOR_DODGE })],
|
|
1071
1643
|
}]
|
|
1072
|
-
}], ctorParameters: () => [] });
|
|
1644
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1073
1645
|
|
|
1074
1646
|
const defaultOptions$2 = {
|
|
1075
1647
|
selectionLayer: 10,
|
|
1076
1648
|
};
|
|
1649
|
+
/**
|
|
1650
|
+
* Angular component that applies an outline effect to selected objects.
|
|
1651
|
+
*
|
|
1652
|
+
* This effect draws an outline around specified objects in the scene.
|
|
1653
|
+
* Can be used with NgtSelectionApi for declarative selection or with
|
|
1654
|
+
* manual selection via the options input.
|
|
1655
|
+
*
|
|
1656
|
+
* @example
|
|
1657
|
+
* ```html
|
|
1658
|
+
* <!-- With NgtSelectionApi (recommended) -->
|
|
1659
|
+
* <ngt-group [select]="hovered()" (pointerenter)="hovered.set(true)">
|
|
1660
|
+
* <ngt-mesh>...</ngt-mesh>
|
|
1661
|
+
* </ngt-group>
|
|
1662
|
+
*
|
|
1663
|
+
* <ngtp-effect-composer>
|
|
1664
|
+
* <ngtp-outline [options]="{ edgeStrength: 2.5, blur: true }" />
|
|
1665
|
+
* </ngtp-effect-composer>
|
|
1666
|
+
* ```
|
|
1667
|
+
*
|
|
1668
|
+
* @example
|
|
1669
|
+
* ```html
|
|
1670
|
+
* <!-- With manual selection -->
|
|
1671
|
+
* <ngtp-effect-composer>
|
|
1672
|
+
* <ngtp-outline [options]="{ selection: [meshRef.nativeElement], edgeStrength: 5 }" />
|
|
1673
|
+
* </ngtp-effect-composer>
|
|
1674
|
+
* ```
|
|
1675
|
+
*/
|
|
1077
1676
|
class NgtpOutline {
|
|
1078
1677
|
constructor() {
|
|
1079
|
-
|
|
1080
|
-
|
|
1678
|
+
/**
|
|
1679
|
+
* Configuration options for the outline effect.
|
|
1680
|
+
* @see NgtpOutlineOptions
|
|
1681
|
+
*/
|
|
1682
|
+
this.options = input(defaultOptions$2, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$2) });
|
|
1683
|
+
this.selectionApi = inject(NgtSelectionApi, { optional: true });
|
|
1081
1684
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
1082
1685
|
this.store = injectStore();
|
|
1083
1686
|
this.selection = pick(this.options, 'selection');
|
|
@@ -1106,6 +1709,10 @@ class NgtpOutline {
|
|
|
1106
1709
|
'blur',
|
|
1107
1710
|
'xRay',
|
|
1108
1711
|
]);
|
|
1712
|
+
/**
|
|
1713
|
+
* The underlying OutlineEffect instance.
|
|
1714
|
+
* Created with the scene, camera, and configured options.
|
|
1715
|
+
*/
|
|
1109
1716
|
this.effect = computed(() => {
|
|
1110
1717
|
const [scene, camera, blendFunction, patternTexture, edgeStrength, pulseSpeed, visibleEdgeColor, hiddenEdgeColor, width, height, kernelSize, blur, xRay, restOptions,] = [
|
|
1111
1718
|
this.effectComposer.scene(),
|
|
@@ -1137,19 +1744,23 @@ class NgtpOutline {
|
|
|
1137
1744
|
xRay,
|
|
1138
1745
|
...restOptions,
|
|
1139
1746
|
});
|
|
1140
|
-
});
|
|
1747
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1141
1748
|
effect((onCleanup) => {
|
|
1142
1749
|
const effect = this.effect();
|
|
1143
1750
|
onCleanup(() => effect.dispose());
|
|
1144
1751
|
});
|
|
1145
1752
|
effect(() => {
|
|
1146
|
-
const [effect, invalidate, selectionLayer] = [
|
|
1753
|
+
const [effect, invalidate, selectionLayer] = [
|
|
1754
|
+
this.effect(),
|
|
1755
|
+
this.store.invalidate(),
|
|
1756
|
+
this.selectionLayer(),
|
|
1757
|
+
];
|
|
1147
1758
|
effect.selectionLayer = selectionLayer;
|
|
1148
1759
|
invalidate();
|
|
1149
1760
|
});
|
|
1150
1761
|
effect((onCleanup) => {
|
|
1151
1762
|
// NOTE: we run this effect if declarative NgtSelection is not enabled
|
|
1152
|
-
if (!this.
|
|
1763
|
+
if (!this.selectionApi) {
|
|
1153
1764
|
// NOTE: if NgtSelection is not used and selection is not provided, we throw
|
|
1154
1765
|
if (this.selection() === undefined) {
|
|
1155
1766
|
throw new Error('[NGT PostProcessing]: ngtp-outline requires selection input or use NgtSelection');
|
|
@@ -1161,15 +1772,23 @@ class NgtpOutline {
|
|
|
1161
1772
|
return;
|
|
1162
1773
|
}
|
|
1163
1774
|
// NOTE: we run this effect if declarative NgtSelection is enabled
|
|
1164
|
-
const selectionEnabled = this.
|
|
1775
|
+
const selectionEnabled = this.selectionApi.enabled();
|
|
1165
1776
|
if (!selectionEnabled)
|
|
1166
1777
|
return;
|
|
1167
|
-
const cleanup = this.handleSelectionChangeEffect(this.
|
|
1778
|
+
const cleanup = this.handleSelectionChangeEffect(this.selectionApi.selected, this.effect, this.store.invalidate);
|
|
1168
1779
|
onCleanup(() => {
|
|
1169
1780
|
cleanup?.();
|
|
1170
1781
|
});
|
|
1171
1782
|
});
|
|
1172
1783
|
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Handles changes to the selection and updates the outline effect.
|
|
1786
|
+
*
|
|
1787
|
+
* @param selected - Function returning the currently selected objects
|
|
1788
|
+
* @param _effect - Function returning the OutlineEffect instance
|
|
1789
|
+
* @param _invalidate - Function returning the invalidate callback
|
|
1790
|
+
* @returns Cleanup function to clear the selection
|
|
1791
|
+
*/
|
|
1173
1792
|
handleSelectionChangeEffect(selected, _effect, _invalidate) {
|
|
1174
1793
|
const selection = selected();
|
|
1175
1794
|
if (!selection || selection.length === 0)
|
|
@@ -1191,12 +1810,12 @@ class NgtpOutline {
|
|
|
1191
1810
|
invalidate();
|
|
1192
1811
|
};
|
|
1193
1812
|
}
|
|
1194
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1195
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1813
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpOutline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1814
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpOutline, isStandalone: true, selector: "ngtp-outline", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1196
1815
|
<ngt-primitive *args="[effect()]" />
|
|
1197
1816
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1198
1817
|
}
|
|
1199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpOutline, decorators: [{
|
|
1200
1819
|
type: Component,
|
|
1201
1820
|
args: [{
|
|
1202
1821
|
selector: 'ngtp-outline',
|
|
@@ -1207,24 +1826,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1207
1826
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1208
1827
|
imports: [NgtArgs],
|
|
1209
1828
|
}]
|
|
1210
|
-
}], ctorParameters: () => [] });
|
|
1829
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1211
1830
|
|
|
1831
|
+
/**
|
|
1832
|
+
* Angular component that applies a pixelation effect to the scene.
|
|
1833
|
+
*
|
|
1834
|
+
* This effect reduces the resolution of the rendered image to create
|
|
1835
|
+
* a retro, 8-bit style appearance.
|
|
1836
|
+
*
|
|
1837
|
+
* @example
|
|
1838
|
+
* ```html
|
|
1839
|
+
* <ngtp-effect-composer>
|
|
1840
|
+
* <ngtp-pixelation [options]="{ granularity: 10 }" />
|
|
1841
|
+
* </ngtp-effect-composer>
|
|
1842
|
+
* ```
|
|
1843
|
+
*/
|
|
1212
1844
|
class NgtpPixelation {
|
|
1213
1845
|
constructor() {
|
|
1214
|
-
|
|
1846
|
+
/**
|
|
1847
|
+
* Configuration options for the pixelation effect.
|
|
1848
|
+
* @default { granularity: 5 }
|
|
1849
|
+
* @see PixelationOptions
|
|
1850
|
+
*/
|
|
1851
|
+
this.options = input({ granularity: 5 }, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs({ granularity: 5 }) });
|
|
1215
1852
|
this.granularity = pick(this.options, 'granularity');
|
|
1216
|
-
|
|
1853
|
+
/** The underlying PixelationEffect instance */
|
|
1854
|
+
this.effect = computed(() => new PixelationEffect(this.granularity()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1217
1855
|
effect((onCleanup) => {
|
|
1218
1856
|
const effect = this.effect();
|
|
1219
1857
|
onCleanup(() => effect.dispose());
|
|
1220
1858
|
});
|
|
1221
1859
|
}
|
|
1222
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1223
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1860
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpPixelation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1861
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpPixelation, isStandalone: true, selector: "ngtp-pixelation", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1224
1862
|
<ngt-primitive *args="[effect()]" />
|
|
1225
1863
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1226
1864
|
}
|
|
1227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpPixelation, decorators: [{
|
|
1228
1866
|
type: Component,
|
|
1229
1867
|
args: [{
|
|
1230
1868
|
selector: 'ngtp-pixelation',
|
|
@@ -1235,26 +1873,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1235
1873
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1236
1874
|
imports: [NgtArgs],
|
|
1237
1875
|
}]
|
|
1238
|
-
}], ctorParameters: () => [] });
|
|
1876
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1239
1877
|
|
|
1240
1878
|
const defaultOptions$1 = {
|
|
1241
1879
|
density: 1.25,
|
|
1242
1880
|
};
|
|
1881
|
+
/**
|
|
1882
|
+
* Angular component that applies a scanline effect to the scene.
|
|
1883
|
+
*
|
|
1884
|
+
* This effect overlays horizontal scanlines on the image, simulating
|
|
1885
|
+
* the appearance of old CRT monitors or television screens.
|
|
1886
|
+
*
|
|
1887
|
+
* @example
|
|
1888
|
+
* ```html
|
|
1889
|
+
* <ngtp-effect-composer>
|
|
1890
|
+
* <ngtp-scanline [options]="{ density: 2.0 }" />
|
|
1891
|
+
* </ngtp-effect-composer>
|
|
1892
|
+
* ```
|
|
1893
|
+
*/
|
|
1243
1894
|
class NgtpScanline {
|
|
1244
1895
|
constructor() {
|
|
1245
|
-
|
|
1896
|
+
/**
|
|
1897
|
+
* Configuration options for the scanline effect.
|
|
1898
|
+
* @default { density: 1.25 }
|
|
1899
|
+
* @see ScanlineEffectOptions
|
|
1900
|
+
*/
|
|
1901
|
+
this.options = input(defaultOptions$1, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$1) });
|
|
1902
|
+
/** Reference to the host NgtpEffect directive */
|
|
1246
1903
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1247
1904
|
extend({ ScanlineEffect });
|
|
1248
1905
|
}
|
|
1249
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1250
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1906
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpScanline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1907
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpScanline, isStandalone: true, selector: "ngtp-scanline", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.OVERLAY })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1251
1908
|
<ngt-scanline-effect *args="[options()]" [camera]="effect.camera()">
|
|
1252
1909
|
<ngtp-effect-blend-mode />
|
|
1253
1910
|
<ng-content />
|
|
1254
1911
|
</ngt-scanline-effect>
|
|
1255
1912
|
`, 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 }); }
|
|
1256
1913
|
}
|
|
1257
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1914
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpScanline, decorators: [{
|
|
1258
1915
|
type: Component,
|
|
1259
1916
|
args: [{
|
|
1260
1917
|
selector: 'ngtp-scanline',
|
|
@@ -1270,20 +1927,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1270
1927
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1271
1928
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.OVERLAY })],
|
|
1272
1929
|
}]
|
|
1273
|
-
}], ctorParameters: () => [] });
|
|
1930
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1274
1931
|
|
|
1275
|
-
// const addLight = (light: Object3D, effect: SelectiveBloomEffect) => light.layers.enable(effect.selection.layer)
|
|
1276
|
-
// const removeLight = (light: Object3D, effect: SelectiveBloomEffect) => light.layers.disable(effect.selection.layer)
|
|
1277
1932
|
const defaultOptions = {
|
|
1278
1933
|
selectionLayer: 10,
|
|
1279
1934
|
inverted: false,
|
|
1280
1935
|
ignoreBackground: false,
|
|
1281
1936
|
};
|
|
1937
|
+
/**
|
|
1938
|
+
* Angular component that applies bloom only to selected objects.
|
|
1939
|
+
*
|
|
1940
|
+
* Unlike the standard bloom effect, selective bloom allows you to specify
|
|
1941
|
+
* which objects should glow. Requires light sources to be provided for
|
|
1942
|
+
* proper rendering.
|
|
1943
|
+
*
|
|
1944
|
+
* Can be used with NgtSelectionApi for declarative selection or with
|
|
1945
|
+
* manual selection via the selection input.
|
|
1946
|
+
*
|
|
1947
|
+
* @example
|
|
1948
|
+
* ```html
|
|
1949
|
+
* <ngtp-effect-composer>
|
|
1950
|
+
* <ngtp-selective-bloom
|
|
1951
|
+
* [lights]="[ambientLightRef, pointLightRef]"
|
|
1952
|
+
* [selection]="[glowingMeshRef]"
|
|
1953
|
+
* [options]="{ intensity: 2, luminanceThreshold: 0 }"
|
|
1954
|
+
* />
|
|
1955
|
+
* </ngtp-effect-composer>
|
|
1956
|
+
* ```
|
|
1957
|
+
*/
|
|
1282
1958
|
class NgtpSelectiveBloom {
|
|
1283
1959
|
constructor() {
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1960
|
+
/**
|
|
1961
|
+
* Light sources that should be included in the bloom calculation.
|
|
1962
|
+
* Required for proper selective bloom rendering.
|
|
1963
|
+
*/
|
|
1964
|
+
this.lights = input.required(...(ngDevMode ? [{ debugName: "lights" }] : []));
|
|
1965
|
+
/**
|
|
1966
|
+
* Objects to apply bloom to.
|
|
1967
|
+
* Can be a single object, array of objects, or ElementRefs.
|
|
1968
|
+
* Not needed if using NgtSelectionApi.
|
|
1969
|
+
* @default []
|
|
1970
|
+
*/
|
|
1971
|
+
this.selection = input([], ...(ngDevMode ? [{ debugName: "selection" }] : []));
|
|
1972
|
+
/**
|
|
1973
|
+
* Configuration options for the selective bloom effect.
|
|
1974
|
+
* @see SelectiveBloomOptions
|
|
1975
|
+
*/
|
|
1976
|
+
this.options = input(defaultOptions, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions) });
|
|
1287
1977
|
this.blendFunction = pick(this.options, 'blendFunction');
|
|
1288
1978
|
this.luminanceThreshold = pick(this.options, 'luminanceThreshold');
|
|
1289
1979
|
this.luminanceSmoothing = pick(this.options, 'luminanceSmoothing');
|
|
@@ -1302,20 +1992,24 @@ class NgtpSelectiveBloom {
|
|
|
1302
1992
|
this.selectionLayer = pick(this.options, 'selectionLayer');
|
|
1303
1993
|
this.store = injectStore();
|
|
1304
1994
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
1305
|
-
this.
|
|
1306
|
-
this.resolvedLights = computed(() => this.lights().map((light) => resolveRef(light)));
|
|
1995
|
+
this.selectionApi = inject(NgtSelectionApi, { optional: true });
|
|
1996
|
+
this.resolvedLights = computed(() => this.lights().map((light) => resolveRef(light)), ...(ngDevMode ? [{ debugName: "resolvedLights" }] : []));
|
|
1307
1997
|
this.resolvedSelected = computed(() => {
|
|
1308
1998
|
const selection = this.selection();
|
|
1309
1999
|
if (!selection)
|
|
1310
2000
|
return [];
|
|
1311
2001
|
const array = Array.isArray(selection) ? selection : [selection];
|
|
1312
2002
|
return array.map((selected) => resolveRef(selected));
|
|
1313
|
-
});
|
|
2003
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedSelected" }] : []));
|
|
1314
2004
|
this.resolvedNgtSelected = computed(() => {
|
|
1315
|
-
if (!this.
|
|
2005
|
+
if (!this.selectionApi || !this.selectionApi.enabled)
|
|
1316
2006
|
return [];
|
|
1317
|
-
return this.
|
|
1318
|
-
});
|
|
2007
|
+
return this.selectionApi.selected().map((selected) => resolveRef(selected));
|
|
2008
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedNgtSelected" }] : []));
|
|
2009
|
+
/**
|
|
2010
|
+
* The underlying SelectiveBloomEffect instance.
|
|
2011
|
+
* Created with the scene, camera, and configured options.
|
|
2012
|
+
*/
|
|
1319
2013
|
this.effect = computed(() => {
|
|
1320
2014
|
const effect = new SelectiveBloomEffect(this.effectComposer.scene(), this.effectComposer.camera(), {
|
|
1321
2015
|
blendFunction: this.blendFunction() || BlendFunction.ADD,
|
|
@@ -1335,10 +2029,10 @@ class NgtpSelectiveBloom {
|
|
|
1335
2029
|
effect.inverted = this.inverted();
|
|
1336
2030
|
effect.ignoreBackground = this.ignoreBackground();
|
|
1337
2031
|
return effect;
|
|
1338
|
-
});
|
|
2032
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1339
2033
|
effect((onCleanup) => {
|
|
1340
2034
|
// skip input selection altogether if NgtSelection is used
|
|
1341
|
-
if (this.
|
|
2035
|
+
if (this.selectionApi)
|
|
1342
2036
|
return;
|
|
1343
2037
|
const selection = this.resolvedSelected();
|
|
1344
2038
|
if (!selection.length)
|
|
@@ -1352,7 +2046,11 @@ class NgtpSelectiveBloom {
|
|
|
1352
2046
|
});
|
|
1353
2047
|
});
|
|
1354
2048
|
effect(() => {
|
|
1355
|
-
const [selectionLayer, invalidate, effect] = [
|
|
2049
|
+
const [selectionLayer, invalidate, effect] = [
|
|
2050
|
+
this.selectionLayer(),
|
|
2051
|
+
this.store.invalidate(),
|
|
2052
|
+
this.effect(),
|
|
2053
|
+
];
|
|
1356
2054
|
effect.selection.layer = selectionLayer;
|
|
1357
2055
|
invalidate();
|
|
1358
2056
|
});
|
|
@@ -1381,18 +2079,30 @@ class NgtpSelectiveBloom {
|
|
|
1381
2079
|
});
|
|
1382
2080
|
});
|
|
1383
2081
|
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Enables the selection layer on a light source.
|
|
2084
|
+
*
|
|
2085
|
+
* @param effect - The SelectiveBloomEffect instance
|
|
2086
|
+
* @param light - The light to enable on the selection layer
|
|
2087
|
+
*/
|
|
1384
2088
|
addLight(effect, light) {
|
|
1385
2089
|
light.layers.enable(effect.selection.layer);
|
|
1386
2090
|
}
|
|
2091
|
+
/**
|
|
2092
|
+
* Disables the selection layer on a light source.
|
|
2093
|
+
*
|
|
2094
|
+
* @param effect - The SelectiveBloomEffect instance
|
|
2095
|
+
* @param light - The light to disable from the selection layer
|
|
2096
|
+
*/
|
|
1387
2097
|
removeLight(effect, light) {
|
|
1388
2098
|
light.layers.disable(effect.selection.layer);
|
|
1389
2099
|
}
|
|
1390
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1391
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSelectiveBloom, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2101
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpSelectiveBloom, isStandalone: true, selector: "ngtp-selective-bloom", inputs: { lights: { classPropertyName: "lights", publicName: "lights", isSignal: true, isRequired: true, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1392
2102
|
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
1393
2103
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1394
2104
|
}
|
|
1395
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSelectiveBloom, decorators: [{
|
|
1396
2106
|
type: Component,
|
|
1397
2107
|
args: [{
|
|
1398
2108
|
selector: 'ngtp-selective-bloom',
|
|
@@ -1403,23 +2113,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1403
2113
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1404
2114
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1405
2115
|
}]
|
|
1406
|
-
}], ctorParameters: () => [] });
|
|
2116
|
+
}], ctorParameters: () => [], propDecorators: { lights: [{ type: i0.Input, args: [{ isSignal: true, alias: "lights", required: true }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1407
2117
|
|
|
2118
|
+
/**
|
|
2119
|
+
* Angular component that applies a sepia tone effect to the scene.
|
|
2120
|
+
*
|
|
2121
|
+
* This effect gives the rendered image a warm, brownish tint similar to
|
|
2122
|
+
* old photographs, creating a vintage or nostalgic appearance.
|
|
2123
|
+
*
|
|
2124
|
+
* @example
|
|
2125
|
+
* ```html
|
|
2126
|
+
* <ngtp-effect-composer>
|
|
2127
|
+
* <ngtp-sepia [options]="{ intensity: 0.5 }" />
|
|
2128
|
+
* </ngtp-effect-composer>
|
|
2129
|
+
* ```
|
|
2130
|
+
*/
|
|
1408
2131
|
class NgtpSepia {
|
|
1409
2132
|
constructor() {
|
|
1410
|
-
|
|
2133
|
+
/**
|
|
2134
|
+
* Configuration options for the sepia effect.
|
|
2135
|
+
* @see SepiaEffectOptions
|
|
2136
|
+
*/
|
|
2137
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2138
|
+
/** Reference to the host NgtpEffect directive */
|
|
1411
2139
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1412
2140
|
extend({ SepiaEffect });
|
|
1413
2141
|
}
|
|
1414
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1415
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2142
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSepia, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2143
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpSepia, isStandalone: true, selector: "ngtp-sepia", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1416
2144
|
<ngt-sepia-effect *args="[options()]" [camera]="effect.camera()">
|
|
1417
2145
|
<ngtp-effect-blend-mode />
|
|
1418
2146
|
<ng-content />
|
|
1419
2147
|
</ngt-sepia-effect>
|
|
1420
2148
|
`, 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 }); }
|
|
1421
2149
|
}
|
|
1422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSepia, decorators: [{
|
|
1423
2151
|
type: Component,
|
|
1424
2152
|
args: [{
|
|
1425
2153
|
selector: 'ngtp-sepia',
|
|
@@ -1434,23 +2162,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1434
2162
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1435
2163
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1436
2164
|
}]
|
|
1437
|
-
}], ctorParameters: () => [] });
|
|
2165
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1438
2166
|
|
|
2167
|
+
/**
|
|
2168
|
+
* Angular component that applies a shock wave distortion effect.
|
|
2169
|
+
*
|
|
2170
|
+
* This effect creates an expanding ring distortion that simulates a
|
|
2171
|
+
* shock wave or explosion ripple emanating from a point in the scene.
|
|
2172
|
+
*
|
|
2173
|
+
* @example
|
|
2174
|
+
* ```html
|
|
2175
|
+
* <ngtp-effect-composer>
|
|
2176
|
+
* <ngtp-shock-wave
|
|
2177
|
+
* [options]="{ speed: 2, maxRadius: 1, waveSize: 0.2, amplitude: 0.05 }"
|
|
2178
|
+
* />
|
|
2179
|
+
* </ngtp-effect-composer>
|
|
2180
|
+
* ```
|
|
2181
|
+
*/
|
|
1439
2182
|
class NgtpShockWave {
|
|
1440
2183
|
constructor() {
|
|
1441
|
-
|
|
2184
|
+
/**
|
|
2185
|
+
* Configuration options for the shock wave effect.
|
|
2186
|
+
* @see ShockWaveEffectOptions
|
|
2187
|
+
*/
|
|
2188
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2189
|
+
/** Reference to the host NgtpEffect directive */
|
|
1442
2190
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1443
2191
|
extend({ ShockWaveEffect });
|
|
1444
2192
|
}
|
|
1445
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1446
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2193
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpShockWave, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2194
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpShockWave, isStandalone: true, selector: "ngtp-shock-wave", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1447
2195
|
<ngt-shock-wave-effect *args="[options()]" [camera]="effect.camera()">
|
|
1448
2196
|
<ngtp-effect-blend-mode />
|
|
1449
2197
|
<ng-content />
|
|
1450
2198
|
</ngt-shock-wave-effect>
|
|
1451
2199
|
`, 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 }); }
|
|
1452
2200
|
}
|
|
1453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpShockWave, decorators: [{
|
|
1454
2202
|
type: Component,
|
|
1455
2203
|
args: [{
|
|
1456
2204
|
selector: 'ngtp-shock-wave',
|
|
@@ -1465,23 +2213,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1465
2213
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1466
2214
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1467
2215
|
}]
|
|
1468
|
-
}], ctorParameters: () => [] });
|
|
2216
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1469
2217
|
|
|
2218
|
+
/**
|
|
2219
|
+
* Angular component that applies Subpixel Morphological Anti-Aliasing (SMAA).
|
|
2220
|
+
*
|
|
2221
|
+
* SMAA is a high-quality, efficient anti-aliasing technique that provides
|
|
2222
|
+
* better results than FXAA while being less demanding than multisampling.
|
|
2223
|
+
* It's particularly effective at smoothing edges while preserving sharpness.
|
|
2224
|
+
*
|
|
2225
|
+
* @example
|
|
2226
|
+
* ```html
|
|
2227
|
+
* <ngtp-effect-composer [options]="{ multisampling: 0 }">
|
|
2228
|
+
* <ngtp-smaa />
|
|
2229
|
+
* </ngtp-effect-composer>
|
|
2230
|
+
* ```
|
|
2231
|
+
*
|
|
2232
|
+
* @example
|
|
2233
|
+
* ```html
|
|
2234
|
+
* <!-- With preset -->
|
|
2235
|
+
* <ngtp-effect-composer>
|
|
2236
|
+
* <ngtp-smaa [options]="{ preset: SMAAPreset.ULTRA }" />
|
|
2237
|
+
* </ngtp-effect-composer>
|
|
2238
|
+
* ```
|
|
2239
|
+
*/
|
|
1470
2240
|
class NgtpSMAA {
|
|
1471
2241
|
constructor() {
|
|
1472
|
-
|
|
2242
|
+
/**
|
|
2243
|
+
* Configuration options for the SMAA effect.
|
|
2244
|
+
* @see SMAAEffectOptions
|
|
2245
|
+
*/
|
|
2246
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2247
|
+
/** Reference to the host NgtpEffect directive */
|
|
1473
2248
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1474
2249
|
extend({ SMAAEffect });
|
|
1475
2250
|
}
|
|
1476
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1477
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2251
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSMAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2252
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpSMAA, isStandalone: true, selector: "ngtp-smaa", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1478
2253
|
<ngt-sMAA-effect *args="[options()]" [camera]="effect.camera()">
|
|
1479
2254
|
<ngtp-effect-blend-mode />
|
|
1480
2255
|
<ng-content />
|
|
1481
2256
|
</ngt-sMAA-effect>
|
|
1482
2257
|
`, 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 }); }
|
|
1483
2258
|
}
|
|
1484
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSMAA, decorators: [{
|
|
1485
2260
|
type: Component,
|
|
1486
2261
|
args: [{
|
|
1487
2262
|
selector: 'ngtp-smaa',
|
|
@@ -1496,23 +2271,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1496
2271
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1497
2272
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1498
2273
|
}]
|
|
1499
|
-
}], ctorParameters: () => [] });
|
|
2274
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1500
2275
|
|
|
2276
|
+
/**
|
|
2277
|
+
* Angular component that applies a tilt-shift blur effect.
|
|
2278
|
+
*
|
|
2279
|
+
* This effect simulates the shallow depth of field look from tilt-shift
|
|
2280
|
+
* photography, creating a "miniature" or "diorama" appearance where only
|
|
2281
|
+
* a horizontal band of the image is in focus.
|
|
2282
|
+
*
|
|
2283
|
+
* Uses the postprocessing library's built-in TiltShiftEffect.
|
|
2284
|
+
*
|
|
2285
|
+
* @example
|
|
2286
|
+
* ```html
|
|
2287
|
+
* <ngtp-effect-composer>
|
|
2288
|
+
* <ngtp-tilt-shift [options]="{ blur: 0.5, offset: 0.5 }" />
|
|
2289
|
+
* </ngtp-effect-composer>
|
|
2290
|
+
* ```
|
|
2291
|
+
*
|
|
2292
|
+
* @see NgtpTiltShift2 for an alternative implementation with different parameters
|
|
2293
|
+
*/
|
|
1501
2294
|
class NgtpTiltShift {
|
|
1502
2295
|
constructor() {
|
|
1503
|
-
|
|
2296
|
+
/**
|
|
2297
|
+
* Configuration options for the tilt-shift effect.
|
|
2298
|
+
* @see TiltShiftEffectOptions
|
|
2299
|
+
*/
|
|
2300
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2301
|
+
/** Reference to the host NgtpEffect directive */
|
|
1504
2302
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1505
2303
|
extend({ TiltShiftEffect });
|
|
1506
2304
|
}
|
|
1507
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1508
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2305
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2306
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpTiltShift, isStandalone: true, selector: "ngtp-tilt-shift", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1509
2307
|
<ngt-tilt-shift-effect *args="[options()]" [camera]="effect.camera()">
|
|
1510
2308
|
<ngtp-effect-blend-mode />
|
|
1511
2309
|
<ng-content />
|
|
1512
2310
|
</ngt-tilt-shift-effect>
|
|
1513
2311
|
`, 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 }); }
|
|
1514
2312
|
}
|
|
1515
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift, decorators: [{
|
|
1516
2314
|
type: Component,
|
|
1517
2315
|
args: [{
|
|
1518
2316
|
selector: 'ngtp-tilt-shift',
|
|
@@ -1528,8 +2326,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1528
2326
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1529
2327
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
|
|
1530
2328
|
}]
|
|
1531
|
-
}], ctorParameters: () => [] });
|
|
2329
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1532
2330
|
|
|
2331
|
+
/**
|
|
2332
|
+
* Custom tilt-shift shader based on Evan Wallace's implementation.
|
|
2333
|
+
* Provides line-based focus control with customizable blur parameters.
|
|
2334
|
+
*/
|
|
1533
2335
|
const TiltShiftShader = {
|
|
1534
2336
|
fragmentShader: /* language=glsl glsl */ `
|
|
1535
2337
|
|
|
@@ -1589,7 +2391,35 @@ const TiltShiftShader = {
|
|
|
1589
2391
|
}
|
|
1590
2392
|
`,
|
|
1591
2393
|
};
|
|
2394
|
+
/**
|
|
2395
|
+
* A custom tilt-shift effect with line-based focus control.
|
|
2396
|
+
*
|
|
2397
|
+
* This effect provides a different approach to tilt-shift compared to
|
|
2398
|
+
* the standard TiltShiftEffect, allowing you to define a focus line
|
|
2399
|
+
* between two screen-space points.
|
|
2400
|
+
*
|
|
2401
|
+
* @example
|
|
2402
|
+
* ```typescript
|
|
2403
|
+
* const effect = new TiltShift2Effect({
|
|
2404
|
+
* blur: 0.2,
|
|
2405
|
+
* start: [0.5, 0.3],
|
|
2406
|
+
* end: [0.5, 0.7]
|
|
2407
|
+
* });
|
|
2408
|
+
* ```
|
|
2409
|
+
*/
|
|
1592
2410
|
class TiltShift2Effect extends Effect {
|
|
2411
|
+
/**
|
|
2412
|
+
* Creates a new TiltShift2Effect instance.
|
|
2413
|
+
*
|
|
2414
|
+
* @param options - Configuration options
|
|
2415
|
+
* @param options.blendFunction - How to blend with the scene
|
|
2416
|
+
* @param options.blur - Blur intensity [0, 1], can exceed 1 for more blur
|
|
2417
|
+
* @param options.taper - Taper of the focus area [0, 1]
|
|
2418
|
+
* @param options.start - Start point of focus line in screen space [x, y]
|
|
2419
|
+
* @param options.end - End point of focus line in screen space [x, y]
|
|
2420
|
+
* @param options.samples - Number of blur samples
|
|
2421
|
+
* @param options.direction - Direction of the blur
|
|
2422
|
+
*/
|
|
1593
2423
|
constructor({ blendFunction = BlendFunction.NORMAL, blur = 0.15, // [0, 1], can go beyond 1 for extra
|
|
1594
2424
|
taper = 0.5, // [0, 1], can go beyond 1 for extra
|
|
1595
2425
|
start = [0.5, 0.0], // [0,1] percentage x,y of screenspace
|
|
@@ -1612,20 +2442,41 @@ class TiltShift2Effect extends Effect {
|
|
|
1612
2442
|
}
|
|
1613
2443
|
}
|
|
1614
2444
|
extend({ TiltShift2Effect });
|
|
2445
|
+
/**
|
|
2446
|
+
* Angular component that applies an alternative tilt-shift effect.
|
|
2447
|
+
*
|
|
2448
|
+
* This effect uses a line-based focus system where you define start and
|
|
2449
|
+
* end points in screen space. The area between these points stays in focus
|
|
2450
|
+
* while the rest of the image is blurred.
|
|
2451
|
+
*
|
|
2452
|
+
* @example
|
|
2453
|
+
* ```html
|
|
2454
|
+
* <ngtp-effect-composer>
|
|
2455
|
+
* <ngtp-tilt-shift2 [options]="{ blur: 0.2, start: [0.5, 0.3], end: [0.5, 0.7] }" />
|
|
2456
|
+
* </ngtp-effect-composer>
|
|
2457
|
+
* ```
|
|
2458
|
+
*
|
|
2459
|
+
* @see NgtpTiltShift for the standard tilt-shift implementation
|
|
2460
|
+
*/
|
|
1615
2461
|
class NgtpTiltShift2 {
|
|
1616
2462
|
constructor() {
|
|
1617
|
-
|
|
2463
|
+
/**
|
|
2464
|
+
* Configuration options for the tilt-shift effect.
|
|
2465
|
+
* @see TiltShift2EffectOptions
|
|
2466
|
+
*/
|
|
2467
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2468
|
+
/** Reference to the host NgtpEffect directive */
|
|
1618
2469
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1619
2470
|
}
|
|
1620
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1621
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2471
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift2, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2472
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpTiltShift2, isStandalone: true, selector: "ngtp-tilt-shift2", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1622
2473
|
<ngt-tilt-shift2-effect *args="[options()]" [camera]="effect.camera()">
|
|
1623
2474
|
<ngtp-effect-blend-mode />
|
|
1624
2475
|
<ng-content />
|
|
1625
2476
|
</ngt-tilt-shift2-effect>
|
|
1626
2477
|
`, 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 }); }
|
|
1627
2478
|
}
|
|
1628
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift2, decorators: [{
|
|
1629
2480
|
type: Component,
|
|
1630
2481
|
args: [{
|
|
1631
2482
|
selector: 'ngtp-tilt-shift2',
|
|
@@ -1641,23 +2492,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1641
2492
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1642
2493
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
|
|
1643
2494
|
}]
|
|
1644
|
-
}] });
|
|
2495
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1645
2496
|
|
|
2497
|
+
/**
|
|
2498
|
+
* Angular component that applies tone mapping to the scene.
|
|
2499
|
+
*
|
|
2500
|
+
* Tone mapping converts HDR (High Dynamic Range) values to LDR (Low Dynamic
|
|
2501
|
+
* Range) for display. Various tone mapping modes are available including
|
|
2502
|
+
* Reinhard, ACES Filmic, and custom linear options.
|
|
2503
|
+
*
|
|
2504
|
+
* Note: The effect composer disables Three.js's built-in tone mapping,
|
|
2505
|
+
* so this effect should be used if tone mapping is desired.
|
|
2506
|
+
*
|
|
2507
|
+
* @example
|
|
2508
|
+
* ```html
|
|
2509
|
+
* <ngtp-effect-composer>
|
|
2510
|
+
* <ngtp-tone-mapping [options]="{ mode: ToneMappingMode.ACES_FILMIC }" />
|
|
2511
|
+
* </ngtp-effect-composer>
|
|
2512
|
+
* ```
|
|
2513
|
+
*/
|
|
1646
2514
|
class NgtpToneMapping {
|
|
1647
2515
|
constructor() {
|
|
1648
|
-
|
|
2516
|
+
/**
|
|
2517
|
+
* Configuration options for the tone mapping effect.
|
|
2518
|
+
* @see ToneMappingEffectOptions
|
|
2519
|
+
*/
|
|
2520
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2521
|
+
/** Reference to the host NgtpEffect directive */
|
|
1649
2522
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1650
2523
|
extend({ ToneMappingEffect });
|
|
1651
2524
|
}
|
|
1652
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1653
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2525
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpToneMapping, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2526
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpToneMapping, isStandalone: true, selector: "ngtp-tone-mapping", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1654
2527
|
<ngt-tone-mapping-effect *args="[options()]" [camera]="effect.camera()">
|
|
1655
2528
|
<ngtp-effect-blend-mode />
|
|
1656
2529
|
<ng-content />
|
|
1657
2530
|
</ngt-tone-mapping-effect>
|
|
1658
2531
|
`, 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 }); }
|
|
1659
2532
|
}
|
|
1660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2533
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpToneMapping, decorators: [{
|
|
1661
2534
|
type: Component,
|
|
1662
2535
|
args: [{
|
|
1663
2536
|
selector: 'ngtp-tone-mapping',
|
|
@@ -1672,23 +2545,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1672
2545
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1673
2546
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1674
2547
|
}]
|
|
1675
|
-
}], ctorParameters: () => [] });
|
|
2548
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1676
2549
|
|
|
2550
|
+
/**
|
|
2551
|
+
* Angular component that applies a vignette effect to the scene.
|
|
2552
|
+
*
|
|
2553
|
+
* This effect darkens the corners and edges of the image, drawing the
|
|
2554
|
+
* viewer's attention to the center. It's a common cinematic technique
|
|
2555
|
+
* for creating focus and atmosphere.
|
|
2556
|
+
*
|
|
2557
|
+
* @example
|
|
2558
|
+
* ```html
|
|
2559
|
+
* <ngtp-effect-composer>
|
|
2560
|
+
* <ngtp-vignette [options]="{ darkness: 0.5, offset: 0.3 }" />
|
|
2561
|
+
* </ngtp-effect-composer>
|
|
2562
|
+
* ```
|
|
2563
|
+
*/
|
|
1677
2564
|
class NgtpVignette {
|
|
1678
2565
|
constructor() {
|
|
1679
|
-
|
|
2566
|
+
/**
|
|
2567
|
+
* Configuration options for the vignette effect.
|
|
2568
|
+
* @see VignetteEffectOptions
|
|
2569
|
+
*/
|
|
2570
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2571
|
+
/** Reference to the host NgtpEffect directive */
|
|
1680
2572
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1681
2573
|
extend({ VignetteEffect });
|
|
1682
2574
|
}
|
|
1683
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1684
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2575
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpVignette, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2576
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpVignette, isStandalone: true, selector: "ngtp-vignette", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1685
2577
|
<ngt-vignette-effect *args="[options()]" [camera]="effect.camera()">
|
|
1686
2578
|
<ngtp-effect-blend-mode />
|
|
1687
2579
|
<ng-content />
|
|
1688
2580
|
</ngt-vignette-effect>
|
|
1689
2581
|
`, 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 }); }
|
|
1690
2582
|
}
|
|
1691
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpVignette, decorators: [{
|
|
1692
2584
|
type: Component,
|
|
1693
2585
|
args: [{
|
|
1694
2586
|
selector: 'ngtp-vignette',
|
|
@@ -1703,8 +2595,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1703
2595
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1704
2596
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1705
2597
|
}]
|
|
1706
|
-
}], ctorParameters: () => [] });
|
|
2598
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1707
2599
|
|
|
2600
|
+
/**
|
|
2601
|
+
* Shader configuration for the water distortion effect.
|
|
2602
|
+
* Creates a rippling, underwater-like distortion.
|
|
2603
|
+
*/
|
|
1708
2604
|
const WaterShader = {
|
|
1709
2605
|
fragmentShader: /* language=glsl glsl */ `
|
|
1710
2606
|
uniform float factor;
|
|
@@ -1720,7 +2616,25 @@ const WaterShader = {
|
|
|
1720
2616
|
outputColor = rgba;
|
|
1721
2617
|
}`,
|
|
1722
2618
|
};
|
|
2619
|
+
/**
|
|
2620
|
+
* A postprocessing effect that simulates an underwater/water distortion.
|
|
2621
|
+
*
|
|
2622
|
+
* Creates animated rippling distortion that makes the scene appear as if
|
|
2623
|
+
* viewed through water or a heat haze.
|
|
2624
|
+
*
|
|
2625
|
+
* @example
|
|
2626
|
+
* ```typescript
|
|
2627
|
+
* const effect = new WaterEffect({ factor: 0.5 });
|
|
2628
|
+
* ```
|
|
2629
|
+
*/
|
|
1723
2630
|
class WaterEffect extends Effect {
|
|
2631
|
+
/**
|
|
2632
|
+
* Creates a new WaterEffect instance.
|
|
2633
|
+
*
|
|
2634
|
+
* @param options - Configuration options
|
|
2635
|
+
* @param options.blendFunction - How to blend with the scene
|
|
2636
|
+
* @param options.factor - Intensity of the water effect (0 = no effect)
|
|
2637
|
+
*/
|
|
1724
2638
|
constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
|
|
1725
2639
|
super('WaterEffect', WaterShader.fragmentShader, {
|
|
1726
2640
|
blendFunction,
|
|
@@ -1729,21 +2643,39 @@ class WaterEffect extends Effect {
|
|
|
1729
2643
|
});
|
|
1730
2644
|
}
|
|
1731
2645
|
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Angular component that applies a water/ripple distortion effect.
|
|
2648
|
+
*
|
|
2649
|
+
* This effect creates an animated underwater-like distortion that can
|
|
2650
|
+
* simulate viewing through water, heat haze, or a dream-like state.
|
|
2651
|
+
*
|
|
2652
|
+
* @example
|
|
2653
|
+
* ```html
|
|
2654
|
+
* <ngtp-effect-composer>
|
|
2655
|
+
* <ngtp-water [options]="{ factor: 0.5 }" />
|
|
2656
|
+
* </ngtp-effect-composer>
|
|
2657
|
+
* ```
|
|
2658
|
+
*/
|
|
1732
2659
|
class NgtpWater {
|
|
1733
2660
|
constructor() {
|
|
1734
|
-
|
|
2661
|
+
/**
|
|
2662
|
+
* Configuration options for the water effect.
|
|
2663
|
+
* @see WaterEffectOptions
|
|
2664
|
+
*/
|
|
2665
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2666
|
+
/** Reference to the host NgtpEffect directive */
|
|
1735
2667
|
this.effect = inject(NgtpEffect, { host: true });
|
|
1736
2668
|
extend({ WaterEffect });
|
|
1737
2669
|
}
|
|
1738
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1739
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2670
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpWater, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2671
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NgtpWater, isStandalone: true, selector: "ngtp-water", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1740
2672
|
<ngt-water-effect *args="[options()]" [camera]="effect.camera()">
|
|
1741
2673
|
<ngtp-effect-blend-mode />
|
|
1742
2674
|
<ng-content />
|
|
1743
2675
|
</ngt-water-effect>
|
|
1744
2676
|
`, 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 }); }
|
|
1745
2677
|
}
|
|
1746
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2678
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpWater, decorators: [{
|
|
1747
2679
|
type: Component,
|
|
1748
2680
|
args: [{
|
|
1749
2681
|
selector: 'ngtp-water',
|
|
@@ -1759,7 +2691,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1759
2691
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1760
2692
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
|
|
1761
2693
|
}]
|
|
1762
|
-
}], ctorParameters: () => [] });
|
|
2694
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1763
2695
|
|
|
1764
2696
|
/**
|
|
1765
2697
|
* Generated bundle index. Do not edit.
|