angular-three-postprocessing 4.0.0-next.12 → 4.0.0-next.121
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 +1225 -274
- 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 +1887 -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,28 +498,59 @@ 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
|
-
|
|
351
|
-
|
|
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 */
|
|
536
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
537
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
352
538
|
extend({ BloomEffect });
|
|
353
539
|
}
|
|
354
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
355
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
356
|
-
<ngt-bloom-effect *args="[options()]" [camera]="
|
|
540
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBloom, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
541
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 })], viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
542
|
+
<ngt-bloom-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
357
543
|
<ngtp-effect-blend-mode />
|
|
358
544
|
<ng-content />
|
|
359
545
|
</ngt-bloom-effect>
|
|
360
546
|
`, 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
547
|
}
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBloom, decorators: [{
|
|
363
549
|
type: Component,
|
|
364
550
|
args: [{
|
|
365
551
|
selector: 'ngtp-bloom',
|
|
366
552
|
template: `
|
|
367
|
-
<ngt-bloom-effect *args="[options()]" [camera]="
|
|
553
|
+
<ngt-bloom-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
368
554
|
<ngtp-effect-blend-mode />
|
|
369
555
|
<ng-content />
|
|
370
556
|
</ngt-bloom-effect>
|
|
@@ -375,28 +561,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
375
561
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
376
562
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
|
|
377
563
|
}]
|
|
378
|
-
}], ctorParameters: () => [] });
|
|
564
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
379
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Angular component that applies brightness and contrast adjustments to the scene.
|
|
568
|
+
*
|
|
569
|
+
* This effect allows you to modify the overall brightness and contrast of the
|
|
570
|
+
* rendered scene as a postprocessing step.
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```html
|
|
574
|
+
* <ngtp-effect-composer>
|
|
575
|
+
* <ngtp-brightness-contrast [options]="{ brightness: 0.1, contrast: 0.2 }" />
|
|
576
|
+
* </ngtp-effect-composer>
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
380
579
|
class NgtpBrightnessContrast {
|
|
381
580
|
constructor() {
|
|
382
|
-
|
|
383
|
-
|
|
581
|
+
/**
|
|
582
|
+
* Configuration options for the brightness/contrast effect.
|
|
583
|
+
* @see BrightnessEffectOptions
|
|
584
|
+
*/
|
|
585
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
586
|
+
/** Reference to the host NgtpEffect directive */
|
|
587
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
588
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
384
589
|
extend({ BrightnessContrastEffect });
|
|
385
590
|
}
|
|
386
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
387
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
388
|
-
<ngt-brightness-contrast-effect *args="[options()]" [camera]="
|
|
591
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBrightnessContrast, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
592
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
593
|
+
<ngt-brightness-contrast-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
389
594
|
<ngtp-effect-blend-mode />
|
|
390
595
|
<ng-content />
|
|
391
596
|
</ngt-brightness-contrast-effect>
|
|
392
597
|
`, 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
598
|
}
|
|
394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
599
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpBrightnessContrast, decorators: [{
|
|
395
600
|
type: Component,
|
|
396
601
|
args: [{
|
|
397
602
|
selector: 'ngtp-brightness-contrast',
|
|
398
603
|
template: `
|
|
399
|
-
<ngt-brightness-contrast-effect *args="[options()]" [camera]="
|
|
604
|
+
<ngt-brightness-contrast-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
400
605
|
<ngtp-effect-blend-mode />
|
|
401
606
|
<ng-content />
|
|
402
607
|
</ngt-brightness-contrast-effect>
|
|
@@ -406,28 +611,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
406
611
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
407
612
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
408
613
|
}]
|
|
409
|
-
}], ctorParameters: () => [] });
|
|
614
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
410
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Angular component that applies a chromatic aberration effect to the scene.
|
|
618
|
+
*
|
|
619
|
+
* Chromatic aberration simulates the color fringing that occurs in real camera lenses
|
|
620
|
+
* when different wavelengths of light are focused at different distances.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* ```html
|
|
624
|
+
* <ngtp-effect-composer>
|
|
625
|
+
* <ngtp-chromatic-aberration [options]="{ offset: [0.002, 0.002] }" />
|
|
626
|
+
* </ngtp-effect-composer>
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
411
629
|
class NgtpChromaticAberration {
|
|
412
630
|
constructor() {
|
|
413
|
-
|
|
414
|
-
|
|
631
|
+
/**
|
|
632
|
+
* Configuration options for the chromatic aberration effect.
|
|
633
|
+
* @see ChromaticAberrationEffectOptions
|
|
634
|
+
*/
|
|
635
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
636
|
+
/** Reference to the host NgtpEffect directive */
|
|
637
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
638
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
415
639
|
extend({ ChromaticAberrationEffect });
|
|
416
640
|
}
|
|
417
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
418
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
419
|
-
<ngt-chromatic-aberration-effect *args="[options()]" [camera]="
|
|
641
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpChromaticAberration, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
642
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
643
|
+
<ngt-chromatic-aberration-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
420
644
|
<ngtp-effect-blend-mode />
|
|
421
645
|
<ng-content />
|
|
422
646
|
</ngt-chromatic-aberration-effect>
|
|
423
647
|
`, 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
648
|
}
|
|
425
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
649
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpChromaticAberration, decorators: [{
|
|
426
650
|
type: Component,
|
|
427
651
|
args: [{
|
|
428
652
|
selector: 'ngtp-chromatic-aberration',
|
|
429
653
|
template: `
|
|
430
|
-
<ngt-chromatic-aberration-effect *args="[options()]" [camera]="
|
|
654
|
+
<ngt-chromatic-aberration-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
431
655
|
<ngtp-effect-blend-mode />
|
|
432
656
|
<ng-content />
|
|
433
657
|
</ngt-chromatic-aberration-effect>
|
|
@@ -437,26 +661,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
437
661
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
438
662
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
439
663
|
}]
|
|
440
|
-
}], ctorParameters: () => [] });
|
|
664
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
441
665
|
|
|
666
|
+
/**
|
|
667
|
+
* Angular component that applies a color averaging effect to the scene.
|
|
668
|
+
*
|
|
669
|
+
* This effect converts the scene to grayscale by averaging the color channels,
|
|
670
|
+
* which can create a desaturated or monochrome look.
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* ```html
|
|
674
|
+
* <ngtp-effect-composer>
|
|
675
|
+
* <ngtp-color-average />
|
|
676
|
+
* </ngtp-effect-composer>
|
|
677
|
+
* ```
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* ```html
|
|
681
|
+
* <!-- With custom blend function -->
|
|
682
|
+
* <ngtp-effect-composer>
|
|
683
|
+
* <ngtp-color-average [options]="{ blendFunction: BlendFunction.MULTIPLY }" />
|
|
684
|
+
* </ngtp-effect-composer>
|
|
685
|
+
* ```
|
|
686
|
+
*/
|
|
442
687
|
class NgtpColorAverage {
|
|
443
688
|
constructor() {
|
|
444
|
-
|
|
689
|
+
/**
|
|
690
|
+
* Configuration options for the color average effect.
|
|
691
|
+
* @default { blendFunction: BlendFunction.NORMAL }
|
|
692
|
+
*/
|
|
693
|
+
this.options = input({ blendFunction: BlendFunction.NORMAL }, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs({ blendFunction: BlendFunction.NORMAL }) });
|
|
694
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
445
695
|
extend({ ColorAverageEffect });
|
|
446
696
|
}
|
|
447
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
448
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
449
|
-
<ngt-color-average-effect *args="[options().blendFunction]">
|
|
697
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorAverage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
698
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
699
|
+
<ngt-color-average-effect #effect *args="[options().blendFunction]">
|
|
450
700
|
<ng-content />
|
|
451
701
|
</ngt-color-average-effect>
|
|
452
702
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
453
703
|
}
|
|
454
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
704
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorAverage, decorators: [{
|
|
455
705
|
type: Component,
|
|
456
706
|
args: [{
|
|
457
707
|
selector: 'ngtp-color-average',
|
|
458
708
|
template: `
|
|
459
|
-
<ngt-color-average-effect *args="[options().blendFunction]">
|
|
709
|
+
<ngt-color-average-effect #effect *args="[options().blendFunction]">
|
|
460
710
|
<ng-content />
|
|
461
711
|
</ngt-color-average-effect>
|
|
462
712
|
`,
|
|
@@ -464,28 +714,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
464
714
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
465
715
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
466
716
|
}]
|
|
467
|
-
}], ctorParameters: () => [] });
|
|
717
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
468
718
|
|
|
719
|
+
/**
|
|
720
|
+
* Angular component that applies a color depth reduction effect to the scene.
|
|
721
|
+
*
|
|
722
|
+
* This effect reduces the number of colors in the scene, creating a posterized
|
|
723
|
+
* or retro look similar to older display hardware with limited color palettes.
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```html
|
|
727
|
+
* <ngtp-effect-composer>
|
|
728
|
+
* <ngtp-color-depth [options]="{ bits: 4 }" />
|
|
729
|
+
* </ngtp-effect-composer>
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
469
732
|
class NgtpColorDepth {
|
|
470
733
|
constructor() {
|
|
471
|
-
|
|
472
|
-
|
|
734
|
+
/**
|
|
735
|
+
* Configuration options for the color depth effect.
|
|
736
|
+
* @see ColorDepthEffectOptions
|
|
737
|
+
*/
|
|
738
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
739
|
+
/** Reference to the host NgtpEffect directive */
|
|
740
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
741
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
473
742
|
extend({ ColorDepthEffect });
|
|
474
743
|
}
|
|
475
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
476
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
477
|
-
<ngt-color-depth-effect *args="[options()]" [camera]="
|
|
744
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorDepth, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
745
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
746
|
+
<ngt-color-depth-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
478
747
|
<ngtp-effect-blend-mode />
|
|
479
748
|
<ng-content />
|
|
480
749
|
</ngt-color-depth-effect>
|
|
481
750
|
`, 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
751
|
}
|
|
483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
752
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpColorDepth, decorators: [{
|
|
484
753
|
type: Component,
|
|
485
754
|
args: [{
|
|
486
755
|
selector: 'ngtp-color-depth',
|
|
487
756
|
template: `
|
|
488
|
-
<ngt-color-depth-effect *args="[options()]" [camera]="
|
|
757
|
+
<ngt-color-depth-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
489
758
|
<ngtp-effect-blend-mode />
|
|
490
759
|
<ng-content />
|
|
491
760
|
</ngt-color-depth-effect>
|
|
@@ -495,28 +764,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
495
764
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
496
765
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
497
766
|
}]
|
|
498
|
-
}], ctorParameters: () => [] });
|
|
767
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
499
768
|
|
|
769
|
+
/**
|
|
770
|
+
* Angular component that visualizes the scene's depth buffer.
|
|
771
|
+
*
|
|
772
|
+
* This effect renders the depth information of the scene, which can be useful
|
|
773
|
+
* for debugging or creating stylized depth-based visualizations.
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```html
|
|
777
|
+
* <ngtp-effect-composer>
|
|
778
|
+
* <ngtp-depth [options]="{ inverted: true }" />
|
|
779
|
+
* </ngtp-effect-composer>
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
500
782
|
class NgtpDepth {
|
|
501
783
|
constructor() {
|
|
502
|
-
|
|
503
|
-
|
|
784
|
+
/**
|
|
785
|
+
* Configuration options for the depth effect.
|
|
786
|
+
* @see DepthEffectOptions
|
|
787
|
+
*/
|
|
788
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
789
|
+
/** Reference to the host NgtpEffect directive */
|
|
790
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
791
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
504
792
|
extend({ DepthEffect });
|
|
505
793
|
}
|
|
506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
507
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
508
|
-
<ngt-depth-effect *args="[options()]" [camera]="
|
|
794
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepth, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
795
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: NgtpDepth, isStandalone: true, selector: "ngtp-depth", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
796
|
+
<ngt-depth-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
509
797
|
<ngtp-effect-blend-mode />
|
|
510
798
|
<ng-content />
|
|
511
799
|
</ngt-depth-effect>
|
|
512
800
|
`, 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
801
|
}
|
|
514
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
802
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepth, decorators: [{
|
|
515
803
|
type: Component,
|
|
516
804
|
args: [{
|
|
517
805
|
selector: 'ngtp-depth',
|
|
518
806
|
template: `
|
|
519
|
-
<ngt-depth-effect *args="[options()]" [camera]="
|
|
807
|
+
<ngt-depth-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
520
808
|
<ngtp-effect-blend-mode />
|
|
521
809
|
<ng-content />
|
|
522
810
|
</ngt-depth-effect>
|
|
@@ -526,12 +814,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
526
814
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
527
815
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
528
816
|
}]
|
|
529
|
-
}], ctorParameters: () => [] });
|
|
817
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
530
818
|
|
|
819
|
+
/**
|
|
820
|
+
* Angular component that applies a depth of field effect to the scene.
|
|
821
|
+
*
|
|
822
|
+
* This effect simulates the focus behavior of real camera lenses, blurring
|
|
823
|
+
* objects that are outside the focal range. Can be configured for autofocus
|
|
824
|
+
* by providing a target position.
|
|
825
|
+
*
|
|
826
|
+
* @example
|
|
827
|
+
* ```html
|
|
828
|
+
* <ngtp-effect-composer>
|
|
829
|
+
* <ngtp-depth-of-field [options]="{ focusDistance: 0, focalLength: 0.02, bokehScale: 2 }" />
|
|
830
|
+
* </ngtp-effect-composer>
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* ```html
|
|
835
|
+
* <!-- With autofocus target -->
|
|
836
|
+
* <ngtp-effect-composer>
|
|
837
|
+
* <ngtp-depth-of-field [options]="{ target: [0, 0, 5], bokehScale: 3 }" />
|
|
838
|
+
* </ngtp-effect-composer>
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
531
841
|
class NgtpDepthOfField {
|
|
532
842
|
constructor() {
|
|
533
|
-
|
|
843
|
+
/**
|
|
844
|
+
* Configuration options for the depth of field effect.
|
|
845
|
+
* @see DOFOptions
|
|
846
|
+
*/
|
|
847
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
534
848
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
849
|
+
/**
|
|
850
|
+
* Creates the DepthOfFieldEffect instance with the configured options.
|
|
851
|
+
* Enables autofocus if a target is provided and applies depth texture settings.
|
|
852
|
+
*/
|
|
535
853
|
this.effect = computed(() => {
|
|
536
854
|
const [camera, options] = [this.effectComposer.camera(), this.options()];
|
|
537
855
|
const autoFocus = options.target != null;
|
|
@@ -547,18 +865,18 @@ class NgtpDepthOfField {
|
|
|
547
865
|
const maskPass = effect['maskPass'];
|
|
548
866
|
maskPass.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA;
|
|
549
867
|
return effect;
|
|
550
|
-
});
|
|
868
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
551
869
|
effect((onCleanup) => {
|
|
552
870
|
const depthOfFieldEffect = this.effect();
|
|
553
871
|
onCleanup(() => depthOfFieldEffect.dispose());
|
|
554
872
|
});
|
|
555
873
|
}
|
|
556
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
557
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
874
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepthOfField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
875
|
+
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
876
|
<ngt-primitive *args="[effect()]" />
|
|
559
877
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
560
878
|
}
|
|
561
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
879
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDepthOfField, decorators: [{
|
|
562
880
|
type: Component,
|
|
563
881
|
args: [{
|
|
564
882
|
selector: 'ngtp-depth-of-field',
|
|
@@ -569,28 +887,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
569
887
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
570
888
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
571
889
|
}]
|
|
572
|
-
}], ctorParameters: () => [] });
|
|
890
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
573
891
|
|
|
892
|
+
/**
|
|
893
|
+
* Angular component that applies a dot screen effect to the scene.
|
|
894
|
+
*
|
|
895
|
+
* This effect overlays a pattern of dots on the scene, creating a halftone
|
|
896
|
+
* or comic book style appearance.
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```html
|
|
900
|
+
* <ngtp-effect-composer>
|
|
901
|
+
* <ngtp-dot-screen [options]="{ scale: 1.5, angle: Math.PI * 0.25 }" />
|
|
902
|
+
* </ngtp-effect-composer>
|
|
903
|
+
* ```
|
|
904
|
+
*/
|
|
574
905
|
class NgtpDotScreen {
|
|
575
906
|
constructor() {
|
|
576
|
-
|
|
577
|
-
|
|
907
|
+
/**
|
|
908
|
+
* Configuration options for the dot screen effect.
|
|
909
|
+
* @see DotScreenEffectOptions
|
|
910
|
+
*/
|
|
911
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
912
|
+
/** Reference to the host NgtpEffect directive */
|
|
913
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
914
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
578
915
|
extend({ DotScreenEffect });
|
|
579
916
|
}
|
|
580
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
581
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
582
|
-
<ngt-dot-screen-effect *args="[options()]" [camera]="
|
|
917
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDotScreen, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
918
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
919
|
+
<ngt-dot-screen-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
583
920
|
<ngtp-effect-blend-mode />
|
|
584
921
|
<ng-content />
|
|
585
922
|
</ngt-dot-screen-effect>
|
|
586
923
|
`, 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
924
|
}
|
|
588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
925
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpDotScreen, decorators: [{
|
|
589
926
|
type: Component,
|
|
590
927
|
args: [{
|
|
591
928
|
selector: 'ngtp-dot-screen',
|
|
592
929
|
template: `
|
|
593
|
-
<ngt-dot-screen-effect *args="[options()]" [camera]="
|
|
930
|
+
<ngt-dot-screen-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
594
931
|
<ngtp-effect-blend-mode />
|
|
595
932
|
<ng-content />
|
|
596
933
|
</ngt-dot-screen-effect>
|
|
@@ -600,28 +937,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
600
937
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
601
938
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
602
939
|
}]
|
|
603
|
-
}], ctorParameters: () => [] });
|
|
940
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
604
941
|
|
|
942
|
+
/**
|
|
943
|
+
* Angular component that applies Fast Approximate Anti-Aliasing (FXAA) to the scene.
|
|
944
|
+
*
|
|
945
|
+
* FXAA is a fast, single-pass anti-aliasing technique that smooths jagged edges
|
|
946
|
+
* in the rendered image. It's less demanding than multisampling but may blur
|
|
947
|
+
* some fine details.
|
|
948
|
+
*
|
|
949
|
+
* @example
|
|
950
|
+
* ```html
|
|
951
|
+
* <ngtp-effect-composer [options]="{ multisampling: 0 }">
|
|
952
|
+
* <ngtp-fxaa />
|
|
953
|
+
* </ngtp-effect-composer>
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
605
956
|
class NgtpFXAA {
|
|
606
957
|
constructor() {
|
|
607
|
-
|
|
608
|
-
|
|
958
|
+
/**
|
|
959
|
+
* Configuration options for the FXAA effect.
|
|
960
|
+
* @see FXAAEffectOptions
|
|
961
|
+
*/
|
|
962
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
963
|
+
/** Reference to the host NgtpEffect directive */
|
|
964
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
965
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
609
966
|
extend({ FXAAEffect });
|
|
610
967
|
}
|
|
611
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
612
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
613
|
-
<ngt-fXAA-effect *args="[options()]" [camera]="
|
|
968
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpFXAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
969
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: NgtpFXAA, isStandalone: true, selector: "ngtp-fxaa", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
970
|
+
<ngt-fXAA-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
614
971
|
<ngtp-effect-blend-mode />
|
|
615
972
|
<ng-content />
|
|
616
973
|
</ngt-fXAA-effect>
|
|
617
974
|
`, 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
975
|
}
|
|
619
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
976
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpFXAA, decorators: [{
|
|
620
977
|
type: Component,
|
|
621
978
|
args: [{
|
|
622
979
|
selector: 'ngtp-fxaa',
|
|
623
980
|
template: `
|
|
624
|
-
<ngt-fXAA-effect *args="[options()]" [camera]="
|
|
981
|
+
<ngt-fXAA-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
625
982
|
<ngtp-effect-blend-mode />
|
|
626
983
|
<ng-content />
|
|
627
984
|
</ngt-fXAA-effect>
|
|
@@ -631,11 +988,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
631
988
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
632
989
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
633
990
|
}]
|
|
634
|
-
}], ctorParameters: () => [] });
|
|
991
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
635
992
|
|
|
993
|
+
/**
|
|
994
|
+
* Angular component that applies a glitch effect to the scene.
|
|
995
|
+
*
|
|
996
|
+
* This effect simulates digital glitches with customizable timing, strength,
|
|
997
|
+
* and chromatic aberration. Can be toggled on/off and configured for different
|
|
998
|
+
* glitch modes.
|
|
999
|
+
*
|
|
1000
|
+
* @example
|
|
1001
|
+
* ```html
|
|
1002
|
+
* <ngtp-effect-composer>
|
|
1003
|
+
* <ngtp-glitch [options]="{ delay: [1.5, 3.5], duration: [0.6, 1.0] }" />
|
|
1004
|
+
* </ngtp-effect-composer>
|
|
1005
|
+
* ```
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```html
|
|
1009
|
+
* <!-- Constant glitch mode -->
|
|
1010
|
+
* <ngtp-effect-composer>
|
|
1011
|
+
* <ngtp-glitch [options]="{ mode: GlitchMode.CONSTANT_MILD, active: true }" />
|
|
1012
|
+
* </ngtp-effect-composer>
|
|
1013
|
+
* ```
|
|
1014
|
+
*/
|
|
636
1015
|
class NgtpGlitch {
|
|
637
1016
|
constructor() {
|
|
638
|
-
|
|
1017
|
+
/**
|
|
1018
|
+
* Configuration options for the glitch effect.
|
|
1019
|
+
* @default { active: true }
|
|
1020
|
+
* @see GlitchOptions
|
|
1021
|
+
*/
|
|
1022
|
+
this.options = input({ active: true }, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs({ active: true }) });
|
|
639
1023
|
this.active = pick(this.options, 'active');
|
|
640
1024
|
this.mode = pick(this.options, 'mode');
|
|
641
1025
|
this.ratio = pick(this.options, 'ratio');
|
|
@@ -648,6 +1032,10 @@ class NgtpGlitch {
|
|
|
648
1032
|
this.chromaticAberrationOffset = vector2(this.options, 'chromaticAberrationOffset');
|
|
649
1033
|
this.strength = vector2(this.options, 'strength');
|
|
650
1034
|
this.store = injectStore();
|
|
1035
|
+
/**
|
|
1036
|
+
* The underlying GlitchEffect instance.
|
|
1037
|
+
* Created with the configured options and vector2 parameters.
|
|
1038
|
+
*/
|
|
651
1039
|
this.effect = computed(() => new GlitchEffect({
|
|
652
1040
|
ratio: this.ratio(),
|
|
653
1041
|
dtSize: this.dtSize(),
|
|
@@ -658,7 +1046,7 @@ class NgtpGlitch {
|
|
|
658
1046
|
duration: this.duration(),
|
|
659
1047
|
chromaticAberrationOffset: this.chromaticAberrationOffset(),
|
|
660
1048
|
strength: this.strength(),
|
|
661
|
-
}));
|
|
1049
|
+
}), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
662
1050
|
effect(() => {
|
|
663
1051
|
const [glitchEffect, invalidate, mode, active] = [
|
|
664
1052
|
this.effect(),
|
|
@@ -674,12 +1062,12 @@ class NgtpGlitch {
|
|
|
674
1062
|
onCleanup(() => effect.dispose());
|
|
675
1063
|
});
|
|
676
1064
|
}
|
|
677
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
678
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1065
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGlitch, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1066
|
+
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
1067
|
<ngt-primitive *args="[effect()]" />
|
|
680
1068
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
681
1069
|
}
|
|
682
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGlitch, decorators: [{
|
|
683
1071
|
type: Component,
|
|
684
1072
|
args: [{
|
|
685
1073
|
selector: 'ngtp-glitch',
|
|
@@ -690,24 +1078,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
690
1078
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
691
1079
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
692
1080
|
}]
|
|
693
|
-
}], ctorParameters: () => [] });
|
|
1081
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
694
1082
|
|
|
1083
|
+
/**
|
|
1084
|
+
* Angular component that applies a god rays (volumetric lighting) effect to the scene.
|
|
1085
|
+
*
|
|
1086
|
+
* This effect creates light shafts emanating from a light source, simulating
|
|
1087
|
+
* the way light scatters through atmospheric particles. Requires a sun/light
|
|
1088
|
+
* source mesh to generate the rays from.
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* ```html
|
|
1092
|
+
* <ngt-mesh #sun [position]="[0, 5, -10]">
|
|
1093
|
+
* <ngt-sphere-geometry />
|
|
1094
|
+
* <ngt-mesh-basic-material color="yellow" />
|
|
1095
|
+
* </ngt-mesh>
|
|
1096
|
+
*
|
|
1097
|
+
* <ngtp-effect-composer>
|
|
1098
|
+
* <ngtp-god-rays [options]="{ sun: sunRef, density: 0.96 }" />
|
|
1099
|
+
* </ngtp-effect-composer>
|
|
1100
|
+
* ```
|
|
1101
|
+
*/
|
|
695
1102
|
class NgtpGodRays {
|
|
696
1103
|
constructor() {
|
|
697
|
-
|
|
1104
|
+
/**
|
|
1105
|
+
* Configuration options for the god rays effect.
|
|
1106
|
+
* Must include a `sun` property with the light source reference.
|
|
1107
|
+
* @see GodRaysOptions
|
|
1108
|
+
*/
|
|
1109
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
698
1110
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
699
1111
|
this.effectOptions = omit(this.options, ['sun']);
|
|
700
1112
|
this.sun = pick(this.options, 'sun');
|
|
1113
|
+
/**
|
|
1114
|
+
* Resolves the sun reference to the actual Three.js object.
|
|
1115
|
+
* Handles both direct references and function references.
|
|
1116
|
+
*/
|
|
701
1117
|
this.sunElement = computed(() => {
|
|
702
1118
|
const sun = this.sun();
|
|
703
1119
|
if (typeof sun === 'function')
|
|
704
1120
|
return resolveRef(sun());
|
|
705
1121
|
return resolveRef(sun);
|
|
706
|
-
});
|
|
1122
|
+
}, ...(ngDevMode ? [{ debugName: "sunElement" }] : []));
|
|
1123
|
+
/**
|
|
1124
|
+
* The underlying GodRaysEffect instance.
|
|
1125
|
+
* Created with the camera, sun element, and configured options.
|
|
1126
|
+
*/
|
|
707
1127
|
this.effect = computed(() => {
|
|
708
1128
|
const [camera, sunElement, options] = [this.effectComposer.camera(), this.sunElement(), this.effectOptions()];
|
|
709
1129
|
return new GodRaysEffect(camera, sunElement, options);
|
|
710
|
-
});
|
|
1130
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
711
1131
|
effect(() => {
|
|
712
1132
|
const sunElement = this.sunElement();
|
|
713
1133
|
if (!sunElement)
|
|
@@ -720,12 +1140,12 @@ class NgtpGodRays {
|
|
|
720
1140
|
onCleanup(() => effect.dispose());
|
|
721
1141
|
});
|
|
722
1142
|
}
|
|
723
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
724
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGodRays, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1144
|
+
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
1145
|
<ngt-primitive *args="[effect()]" />
|
|
726
1146
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
727
1147
|
}
|
|
728
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGodRays, decorators: [{
|
|
729
1149
|
type: Component,
|
|
730
1150
|
args: [{
|
|
731
1151
|
selector: 'ngtp-god-rays',
|
|
@@ -736,14 +1156,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
736
1156
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
737
1157
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
738
1158
|
}]
|
|
739
|
-
}], ctorParameters: () => [] });
|
|
1159
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
740
1160
|
|
|
1161
|
+
/**
|
|
1162
|
+
* Angular component that applies a grid overlay effect to the scene.
|
|
1163
|
+
*
|
|
1164
|
+
* This effect overlays a grid pattern on the rendered scene, which can be
|
|
1165
|
+
* useful for technical visualization or stylized effects.
|
|
1166
|
+
*
|
|
1167
|
+
* @example
|
|
1168
|
+
* ```html
|
|
1169
|
+
* <ngtp-effect-composer>
|
|
1170
|
+
* <ngtp-grid [options]="{ scale: 1.5, lineWidth: 0.5 }" />
|
|
1171
|
+
* </ngtp-effect-composer>
|
|
1172
|
+
* ```
|
|
1173
|
+
*/
|
|
741
1174
|
class NgtpGrid {
|
|
742
1175
|
constructor() {
|
|
743
|
-
|
|
1176
|
+
/**
|
|
1177
|
+
* Configuration options for the grid effect.
|
|
1178
|
+
* @see GridOptions
|
|
1179
|
+
*/
|
|
1180
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
744
1181
|
this.effectOptions = omit(this.options, ['size']);
|
|
745
1182
|
this.size = pick(this.options, 'size');
|
|
746
|
-
|
|
1183
|
+
/** The underlying GridEffect instance */
|
|
1184
|
+
this.effect = computed(() => new GridEffect(this.effectOptions()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
747
1185
|
effect(() => {
|
|
748
1186
|
const [size, effect] = [this.size(), this.effect()];
|
|
749
1187
|
if (size) {
|
|
@@ -755,12 +1193,12 @@ class NgtpGrid {
|
|
|
755
1193
|
onCleanup(() => effect.dispose());
|
|
756
1194
|
});
|
|
757
1195
|
}
|
|
758
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
759
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1196
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1197
|
+
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
1198
|
<ngt-primitive *args="[effect()]" />
|
|
761
1199
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
762
1200
|
}
|
|
763
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpGrid, decorators: [{
|
|
764
1202
|
type: Component,
|
|
765
1203
|
args: [{
|
|
766
1204
|
selector: 'ngtp-grid',
|
|
@@ -771,28 +1209,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
771
1209
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
772
1210
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
773
1211
|
}]
|
|
774
|
-
}], ctorParameters: () => [] });
|
|
1212
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
775
1213
|
|
|
1214
|
+
/**
|
|
1215
|
+
* Angular component that applies hue and saturation adjustments to the scene.
|
|
1216
|
+
*
|
|
1217
|
+
* This effect allows you to shift the hue and adjust the saturation of the
|
|
1218
|
+
* rendered scene as a postprocessing step.
|
|
1219
|
+
*
|
|
1220
|
+
* @example
|
|
1221
|
+
* ```html
|
|
1222
|
+
* <ngtp-effect-composer>
|
|
1223
|
+
* <ngtp-hue-saturation [options]="{ hue: 0.5, saturation: 0.2 }" />
|
|
1224
|
+
* </ngtp-effect-composer>
|
|
1225
|
+
* ```
|
|
1226
|
+
*/
|
|
776
1227
|
class NgtpHueSaturation {
|
|
777
1228
|
constructor() {
|
|
778
|
-
|
|
779
|
-
|
|
1229
|
+
/**
|
|
1230
|
+
* Configuration options for the hue/saturation effect.
|
|
1231
|
+
* @see HueSaturationEffectOptions
|
|
1232
|
+
*/
|
|
1233
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1234
|
+
/** Reference to the host NgtpEffect directive */
|
|
1235
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
1236
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
780
1237
|
extend({ HueSaturationEffect });
|
|
781
1238
|
}
|
|
782
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
783
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
784
|
-
<ngt-hue-saturation-effect *args="[options()]" [camera]="
|
|
1239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpHueSaturation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1240
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1241
|
+
<ngt-hue-saturation-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
785
1242
|
<ngtp-effect-blend-mode />
|
|
786
1243
|
<ng-content />
|
|
787
1244
|
</ngt-hue-saturation-effect>
|
|
788
1245
|
`, 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
1246
|
}
|
|
790
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpHueSaturation, decorators: [{
|
|
791
1248
|
type: Component,
|
|
792
1249
|
args: [{
|
|
793
1250
|
selector: 'ngtp-hue-saturation',
|
|
794
1251
|
template: `
|
|
795
|
-
<ngt-hue-saturation-effect *args="[options()]" [camera]="
|
|
1252
|
+
<ngt-hue-saturation-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
796
1253
|
<ngtp-effect-blend-mode />
|
|
797
1254
|
<ng-content />
|
|
798
1255
|
</ngt-hue-saturation-effect>
|
|
@@ -802,10 +1259,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
802
1259
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
803
1260
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
804
1261
|
}]
|
|
805
|
-
}], ctorParameters: () => [] });
|
|
1262
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
806
1263
|
|
|
807
|
-
|
|
808
|
-
|
|
1264
|
+
/**
|
|
1265
|
+
* Lens Flare Effect
|
|
1266
|
+
* Created by Anderson Mancini 2023
|
|
1267
|
+
* React Three Fiber Ultimate LensFlare - Ported to Angular Three
|
|
1268
|
+
*/
|
|
1269
|
+
/**
|
|
1270
|
+
* Shader configuration for the lens flare effect.
|
|
1271
|
+
* Contains the GLSL fragment shader code.
|
|
1272
|
+
*/
|
|
809
1273
|
const LensFlareShader = {
|
|
810
1274
|
fragmentShader: /* language=glsl glsl */ `
|
|
811
1275
|
|
|
@@ -853,7 +1317,46 @@ const LensFlareShader = {
|
|
|
853
1317
|
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
1318
|
`,
|
|
855
1319
|
};
|
|
1320
|
+
/**
|
|
1321
|
+
* A postprocessing effect that simulates camera lens flares.
|
|
1322
|
+
*
|
|
1323
|
+
* Creates realistic lens flare effects including glare, ghosts, star bursts,
|
|
1324
|
+
* and anamorphic flares. Can be animated and positioned dynamically.
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* const effect = new LensFlareEffect({
|
|
1329
|
+
* glareSize: 0.3,
|
|
1330
|
+
* starPoints: 8,
|
|
1331
|
+
* animated: true
|
|
1332
|
+
* });
|
|
1333
|
+
* ```
|
|
1334
|
+
*/
|
|
856
1335
|
class LensFlareEffect extends Effect {
|
|
1336
|
+
/**
|
|
1337
|
+
* Creates a new LensFlareEffect instance.
|
|
1338
|
+
*
|
|
1339
|
+
* @param options - Configuration options for the lens flare
|
|
1340
|
+
* @param options.blendFunction - How to blend with the scene
|
|
1341
|
+
* @param options.enabled - Whether the effect is enabled
|
|
1342
|
+
* @param options.glareSize - Size of the glare
|
|
1343
|
+
* @param options.lensPosition - Position of the lens on screen
|
|
1344
|
+
* @param options.iResolution - Resolution of the effect
|
|
1345
|
+
* @param options.starPoints - Number of points in the star pattern
|
|
1346
|
+
* @param options.flareSize - Size of individual flares
|
|
1347
|
+
* @param options.flareSpeed - Animation speed of flares
|
|
1348
|
+
* @param options.flareShape - Shape parameter for flares
|
|
1349
|
+
* @param options.animated - Whether to animate the effect
|
|
1350
|
+
* @param options.anamorphic - Enable anamorphic lens simulation
|
|
1351
|
+
* @param options.colorGain - Color tint for the effect
|
|
1352
|
+
* @param options.lensDirtTexture - Texture for lens dirt overlay
|
|
1353
|
+
* @param options.haloScale - Scale of the halo effect
|
|
1354
|
+
* @param options.secondaryGhosts - Enable secondary ghost images
|
|
1355
|
+
* @param options.aditionalStreaks - Enable additional streak effects
|
|
1356
|
+
* @param options.ghostScale - Scale of ghost images
|
|
1357
|
+
* @param options.opacity - Opacity of the effect
|
|
1358
|
+
* @param options.starBurst - Enable star burst effect
|
|
1359
|
+
*/
|
|
857
1360
|
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
1361
|
super('LensFlareEffect', LensFlareShader.fragmentShader, {
|
|
859
1362
|
blendFunction,
|
|
@@ -880,6 +1383,13 @@ class LensFlareEffect extends Effect {
|
|
|
880
1383
|
]),
|
|
881
1384
|
});
|
|
882
1385
|
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Updates the effect's time uniform for animation.
|
|
1388
|
+
*
|
|
1389
|
+
* @param _renderer - The WebGL renderer (unused)
|
|
1390
|
+
* @param _inputBuffer - The input render target (unused)
|
|
1391
|
+
* @param deltaTime - Time elapsed since last frame
|
|
1392
|
+
*/
|
|
883
1393
|
update(_renderer, _inputBuffer, deltaTime) {
|
|
884
1394
|
const iTime = this.uniforms.get('iTime');
|
|
885
1395
|
if (iTime) {
|
|
@@ -892,16 +1402,45 @@ const defaultOptions$3 = {
|
|
|
892
1402
|
followMouse: false,
|
|
893
1403
|
smoothTime: 0.7,
|
|
894
1404
|
};
|
|
1405
|
+
/**
|
|
1406
|
+
* Angular component that applies a lens flare effect to the scene.
|
|
1407
|
+
*
|
|
1408
|
+
* This effect simulates realistic camera lens flares with support for
|
|
1409
|
+
* dynamic positioning, mouse following, and occlusion detection.
|
|
1410
|
+
* The flare automatically fades when occluded by scene objects.
|
|
1411
|
+
*
|
|
1412
|
+
* @example
|
|
1413
|
+
* ```html
|
|
1414
|
+
* <ngtp-effect-composer>
|
|
1415
|
+
* <ngtp-lens-flare [options]="{ position: [10, 5, -20], glareSize: 0.3 }" />
|
|
1416
|
+
* </ngtp-effect-composer>
|
|
1417
|
+
* ```
|
|
1418
|
+
*
|
|
1419
|
+
* @example
|
|
1420
|
+
* ```html
|
|
1421
|
+
* <!-- Mouse-following flare -->
|
|
1422
|
+
* <ngtp-effect-composer>
|
|
1423
|
+
* <ngtp-lens-flare [options]="{ followMouse: true, smoothTime: 0.5 }" />
|
|
1424
|
+
* </ngtp-effect-composer>
|
|
1425
|
+
* ```
|
|
1426
|
+
*/
|
|
895
1427
|
class NgtpLensFlare {
|
|
896
1428
|
constructor() {
|
|
897
|
-
|
|
1429
|
+
/**
|
|
1430
|
+
* Configuration options for the lens flare effect.
|
|
1431
|
+
* @see LensFlareOptions
|
|
1432
|
+
*/
|
|
1433
|
+
this.options = input(defaultOptions$3, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$3) });
|
|
898
1434
|
this.store = injectStore();
|
|
899
1435
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
900
1436
|
this.effectOptions = omit(this.options, ['position', 'followMouse', 'smoothTime']);
|
|
901
1437
|
this.position = vector3(this.options, 'position');
|
|
1438
|
+
/** Cached vector for projecting 3D position to screen space */
|
|
902
1439
|
this.projectedPosition = new THREE.Vector3();
|
|
1440
|
+
/** Cached vector for 2D mouse/raycaster coordinates */
|
|
903
1441
|
this.mouse2d = new THREE.Vector2();
|
|
904
|
-
|
|
1442
|
+
/** The underlying LensFlareEffect instance */
|
|
1443
|
+
this.effect = computed(() => new LensFlareEffect(this.effectOptions()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
905
1444
|
effect(() => {
|
|
906
1445
|
const [lensFlareEffect, width, height] = [
|
|
907
1446
|
this.effect(),
|
|
@@ -918,7 +1457,7 @@ class NgtpLensFlare {
|
|
|
918
1457
|
const effect = this.effect();
|
|
919
1458
|
onCleanup(() => effect.dispose());
|
|
920
1459
|
});
|
|
921
|
-
|
|
1460
|
+
beforeRender(({ delta }) => {
|
|
922
1461
|
const [effect] = [this.effect()];
|
|
923
1462
|
if (!effect)
|
|
924
1463
|
return;
|
|
@@ -975,12 +1514,12 @@ class NgtpLensFlare {
|
|
|
975
1514
|
easing.damp(uOpacity, 'value', target, smoothTime, delta);
|
|
976
1515
|
});
|
|
977
1516
|
}
|
|
978
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
979
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1517
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLensFlare, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1518
|
+
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
1519
|
<ngt-primitive *args="[effect()]" [parameters]="{ dispose: null }" />
|
|
981
1520
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
982
1521
|
}
|
|
983
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLensFlare, decorators: [{
|
|
984
1523
|
type: Component,
|
|
985
1524
|
args: [{
|
|
986
1525
|
selector: 'ngtp-lens-flare',
|
|
@@ -991,18 +1530,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
991
1530
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
992
1531
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
993
1532
|
}]
|
|
994
|
-
}], ctorParameters: () => [] });
|
|
1533
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
995
1534
|
|
|
1535
|
+
/**
|
|
1536
|
+
* Angular component that applies a LUT (Look-Up Table) color grading effect.
|
|
1537
|
+
*
|
|
1538
|
+
* LUTs are used for color grading in film and photography. This effect applies
|
|
1539
|
+
* a 3D LUT texture to transform the colors of the rendered scene.
|
|
1540
|
+
*
|
|
1541
|
+
* @example
|
|
1542
|
+
* ```typescript
|
|
1543
|
+
* // In component
|
|
1544
|
+
* lutTexture = injectLoader(() => LUTCubeLoader, () => 'path/to/lut.cube');
|
|
1545
|
+
* ```
|
|
1546
|
+
*
|
|
1547
|
+
* ```html
|
|
1548
|
+
* <ngtp-effect-composer>
|
|
1549
|
+
* <ngtp-lut [options]="{ lut: lutTexture() }" />
|
|
1550
|
+
* </ngtp-effect-composer>
|
|
1551
|
+
* ```
|
|
1552
|
+
*/
|
|
996
1553
|
class NgtpLUT {
|
|
997
1554
|
constructor() {
|
|
998
|
-
|
|
1555
|
+
/**
|
|
1556
|
+
* Configuration options for the LUT effect.
|
|
1557
|
+
* Must include a `lut` texture.
|
|
1558
|
+
* @see LUTOptions
|
|
1559
|
+
*/
|
|
1560
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
999
1561
|
this.lut = pick(this.options, 'lut');
|
|
1000
1562
|
this.tetrahedralInterpolation = pick(this.options, 'tetrahedralInterpolation');
|
|
1001
1563
|
this.store = injectStore();
|
|
1564
|
+
/** The underlying LUT3DEffect instance */
|
|
1002
1565
|
this.effect = computed(() => {
|
|
1003
1566
|
const { lut, ...options } = this.options();
|
|
1004
1567
|
return new LUT3DEffect(lut, options);
|
|
1005
|
-
});
|
|
1568
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1006
1569
|
effect(() => {
|
|
1007
1570
|
const [effect, lut, tetrahedralInterpolation, invalidate] = [
|
|
1008
1571
|
this.effect(),
|
|
@@ -1021,12 +1584,12 @@ class NgtpLUT {
|
|
|
1021
1584
|
onCleanup(() => effect.dispose());
|
|
1022
1585
|
});
|
|
1023
1586
|
}
|
|
1024
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1025
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1587
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLUT, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1588
|
+
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
1589
|
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
1027
1590
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1028
1591
|
}
|
|
1029
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpLUT, decorators: [{
|
|
1030
1593
|
type: Component,
|
|
1031
1594
|
args: [{
|
|
1032
1595
|
selector: 'ngtp-lut',
|
|
@@ -1037,28 +1600,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1037
1600
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1038
1601
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1039
1602
|
}]
|
|
1040
|
-
}], ctorParameters: () => [] });
|
|
1603
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1041
1604
|
|
|
1605
|
+
/**
|
|
1606
|
+
* Angular component that applies a noise/grain effect to the scene.
|
|
1607
|
+
*
|
|
1608
|
+
* This effect adds film grain or noise to the rendered image, which can
|
|
1609
|
+
* add a cinematic quality or help hide banding in gradients.
|
|
1610
|
+
*
|
|
1611
|
+
* @example
|
|
1612
|
+
* ```html
|
|
1613
|
+
* <ngtp-effect-composer>
|
|
1614
|
+
* <ngtp-noise [options]="{ premultiply: true }" />
|
|
1615
|
+
* </ngtp-effect-composer>
|
|
1616
|
+
* ```
|
|
1617
|
+
*/
|
|
1042
1618
|
class NgtpNoise {
|
|
1043
1619
|
constructor() {
|
|
1044
|
-
|
|
1045
|
-
|
|
1620
|
+
/**
|
|
1621
|
+
* Configuration options for the noise effect.
|
|
1622
|
+
* @see NoiseEffectOptions
|
|
1623
|
+
*/
|
|
1624
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
1625
|
+
/** Reference to the host NgtpEffect directive */
|
|
1626
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
1627
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1046
1628
|
extend({ NoiseEffect });
|
|
1047
1629
|
}
|
|
1048
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1049
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1050
|
-
<ngt-noise-effect *args="[options()]" [camera]="
|
|
1630
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpNoise, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1631
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 })], viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1632
|
+
<ngt-noise-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1051
1633
|
<ngtp-effect-blend-mode />
|
|
1052
1634
|
<ng-content />
|
|
1053
1635
|
</ngt-noise-effect>
|
|
1054
1636
|
`, 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
1637
|
}
|
|
1056
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpNoise, decorators: [{
|
|
1057
1639
|
type: Component,
|
|
1058
1640
|
args: [{
|
|
1059
1641
|
selector: 'ngtp-noise',
|
|
1060
1642
|
template: `
|
|
1061
|
-
<ngt-noise-effect *args="[options()]" [camera]="
|
|
1643
|
+
<ngt-noise-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1062
1644
|
<ngtp-effect-blend-mode />
|
|
1063
1645
|
<ng-content />
|
|
1064
1646
|
</ngt-noise-effect>
|
|
@@ -1069,15 +1651,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1069
1651
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1070
1652
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.COLOR_DODGE })],
|
|
1071
1653
|
}]
|
|
1072
|
-
}], ctorParameters: () => [] });
|
|
1654
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1073
1655
|
|
|
1074
1656
|
const defaultOptions$2 = {
|
|
1075
1657
|
selectionLayer: 10,
|
|
1076
1658
|
};
|
|
1659
|
+
/**
|
|
1660
|
+
* Angular component that applies an outline effect to selected objects.
|
|
1661
|
+
*
|
|
1662
|
+
* This effect draws an outline around specified objects in the scene.
|
|
1663
|
+
* Can be used with NgtSelectionApi for declarative selection or with
|
|
1664
|
+
* manual selection via the options input.
|
|
1665
|
+
*
|
|
1666
|
+
* @example
|
|
1667
|
+
* ```html
|
|
1668
|
+
* <!-- With NgtSelectionApi (recommended) -->
|
|
1669
|
+
* <ngt-group [select]="hovered()" (pointerenter)="hovered.set(true)">
|
|
1670
|
+
* <ngt-mesh>...</ngt-mesh>
|
|
1671
|
+
* </ngt-group>
|
|
1672
|
+
*
|
|
1673
|
+
* <ngtp-effect-composer>
|
|
1674
|
+
* <ngtp-outline [options]="{ edgeStrength: 2.5, blur: true }" />
|
|
1675
|
+
* </ngtp-effect-composer>
|
|
1676
|
+
* ```
|
|
1677
|
+
*
|
|
1678
|
+
* @example
|
|
1679
|
+
* ```html
|
|
1680
|
+
* <!-- With manual selection -->
|
|
1681
|
+
* <ngtp-effect-composer>
|
|
1682
|
+
* <ngtp-outline [options]="{ selection: [meshRef.nativeElement], edgeStrength: 5 }" />
|
|
1683
|
+
* </ngtp-effect-composer>
|
|
1684
|
+
* ```
|
|
1685
|
+
*/
|
|
1077
1686
|
class NgtpOutline {
|
|
1078
1687
|
constructor() {
|
|
1079
|
-
|
|
1080
|
-
|
|
1688
|
+
/**
|
|
1689
|
+
* Configuration options for the outline effect.
|
|
1690
|
+
* @see NgtpOutlineOptions
|
|
1691
|
+
*/
|
|
1692
|
+
this.options = input(defaultOptions$2, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$2) });
|
|
1693
|
+
this.selectionApi = inject(NgtSelectionApi, { optional: true });
|
|
1081
1694
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
1082
1695
|
this.store = injectStore();
|
|
1083
1696
|
this.selection = pick(this.options, 'selection');
|
|
@@ -1106,6 +1719,10 @@ class NgtpOutline {
|
|
|
1106
1719
|
'blur',
|
|
1107
1720
|
'xRay',
|
|
1108
1721
|
]);
|
|
1722
|
+
/**
|
|
1723
|
+
* The underlying OutlineEffect instance.
|
|
1724
|
+
* Created with the scene, camera, and configured options.
|
|
1725
|
+
*/
|
|
1109
1726
|
this.effect = computed(() => {
|
|
1110
1727
|
const [scene, camera, blendFunction, patternTexture, edgeStrength, pulseSpeed, visibleEdgeColor, hiddenEdgeColor, width, height, kernelSize, blur, xRay, restOptions,] = [
|
|
1111
1728
|
this.effectComposer.scene(),
|
|
@@ -1137,19 +1754,23 @@ class NgtpOutline {
|
|
|
1137
1754
|
xRay,
|
|
1138
1755
|
...restOptions,
|
|
1139
1756
|
});
|
|
1140
|
-
});
|
|
1757
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1141
1758
|
effect((onCleanup) => {
|
|
1142
1759
|
const effect = this.effect();
|
|
1143
1760
|
onCleanup(() => effect.dispose());
|
|
1144
1761
|
});
|
|
1145
1762
|
effect(() => {
|
|
1146
|
-
const [effect, invalidate, selectionLayer] = [
|
|
1763
|
+
const [effect, invalidate, selectionLayer] = [
|
|
1764
|
+
this.effect(),
|
|
1765
|
+
this.store.invalidate(),
|
|
1766
|
+
this.selectionLayer(),
|
|
1767
|
+
];
|
|
1147
1768
|
effect.selectionLayer = selectionLayer;
|
|
1148
1769
|
invalidate();
|
|
1149
1770
|
});
|
|
1150
1771
|
effect((onCleanup) => {
|
|
1151
1772
|
// NOTE: we run this effect if declarative NgtSelection is not enabled
|
|
1152
|
-
if (!this.
|
|
1773
|
+
if (!this.selectionApi) {
|
|
1153
1774
|
// NOTE: if NgtSelection is not used and selection is not provided, we throw
|
|
1154
1775
|
if (this.selection() === undefined) {
|
|
1155
1776
|
throw new Error('[NGT PostProcessing]: ngtp-outline requires selection input or use NgtSelection');
|
|
@@ -1161,15 +1782,23 @@ class NgtpOutline {
|
|
|
1161
1782
|
return;
|
|
1162
1783
|
}
|
|
1163
1784
|
// NOTE: we run this effect if declarative NgtSelection is enabled
|
|
1164
|
-
const selectionEnabled = this.
|
|
1785
|
+
const selectionEnabled = this.selectionApi.enabled();
|
|
1165
1786
|
if (!selectionEnabled)
|
|
1166
1787
|
return;
|
|
1167
|
-
const cleanup = this.handleSelectionChangeEffect(this.
|
|
1788
|
+
const cleanup = this.handleSelectionChangeEffect(this.selectionApi.selected, this.effect, this.store.invalidate);
|
|
1168
1789
|
onCleanup(() => {
|
|
1169
1790
|
cleanup?.();
|
|
1170
1791
|
});
|
|
1171
1792
|
});
|
|
1172
1793
|
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Handles changes to the selection and updates the outline effect.
|
|
1796
|
+
*
|
|
1797
|
+
* @param selected - Function returning the currently selected objects
|
|
1798
|
+
* @param _effect - Function returning the OutlineEffect instance
|
|
1799
|
+
* @param _invalidate - Function returning the invalidate callback
|
|
1800
|
+
* @returns Cleanup function to clear the selection
|
|
1801
|
+
*/
|
|
1173
1802
|
handleSelectionChangeEffect(selected, _effect, _invalidate) {
|
|
1174
1803
|
const selection = selected();
|
|
1175
1804
|
if (!selection || selection.length === 0)
|
|
@@ -1191,12 +1820,12 @@ class NgtpOutline {
|
|
|
1191
1820
|
invalidate();
|
|
1192
1821
|
};
|
|
1193
1822
|
}
|
|
1194
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1195
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1823
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpOutline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1824
|
+
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
1825
|
<ngt-primitive *args="[effect()]" />
|
|
1197
1826
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1198
1827
|
}
|
|
1199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1828
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpOutline, decorators: [{
|
|
1200
1829
|
type: Component,
|
|
1201
1830
|
args: [{
|
|
1202
1831
|
selector: 'ngtp-outline',
|
|
@@ -1207,24 +1836,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1207
1836
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1208
1837
|
imports: [NgtArgs],
|
|
1209
1838
|
}]
|
|
1210
|
-
}], ctorParameters: () => [] });
|
|
1839
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1211
1840
|
|
|
1841
|
+
/**
|
|
1842
|
+
* Angular component that applies a pixelation effect to the scene.
|
|
1843
|
+
*
|
|
1844
|
+
* This effect reduces the resolution of the rendered image to create
|
|
1845
|
+
* a retro, 8-bit style appearance.
|
|
1846
|
+
*
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```html
|
|
1849
|
+
* <ngtp-effect-composer>
|
|
1850
|
+
* <ngtp-pixelation [options]="{ granularity: 10 }" />
|
|
1851
|
+
* </ngtp-effect-composer>
|
|
1852
|
+
* ```
|
|
1853
|
+
*/
|
|
1212
1854
|
class NgtpPixelation {
|
|
1213
1855
|
constructor() {
|
|
1214
|
-
|
|
1856
|
+
/**
|
|
1857
|
+
* Configuration options for the pixelation effect.
|
|
1858
|
+
* @default { granularity: 5 }
|
|
1859
|
+
* @see PixelationOptions
|
|
1860
|
+
*/
|
|
1861
|
+
this.options = input({ granularity: 5 }, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs({ granularity: 5 }) });
|
|
1215
1862
|
this.granularity = pick(this.options, 'granularity');
|
|
1216
|
-
|
|
1863
|
+
/** The underlying PixelationEffect instance */
|
|
1864
|
+
this.effect = computed(() => new PixelationEffect(this.granularity()), ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1217
1865
|
effect((onCleanup) => {
|
|
1218
1866
|
const effect = this.effect();
|
|
1219
1867
|
onCleanup(() => effect.dispose());
|
|
1220
1868
|
});
|
|
1221
1869
|
}
|
|
1222
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1223
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1870
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpPixelation, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1871
|
+
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
1872
|
<ngt-primitive *args="[effect()]" />
|
|
1225
1873
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1226
1874
|
}
|
|
1227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1875
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpPixelation, decorators: [{
|
|
1228
1876
|
type: Component,
|
|
1229
1877
|
args: [{
|
|
1230
1878
|
selector: 'ngtp-pixelation',
|
|
@@ -1235,31 +1883,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1235
1883
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1236
1884
|
imports: [NgtArgs],
|
|
1237
1885
|
}]
|
|
1238
|
-
}], ctorParameters: () => [] });
|
|
1886
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1239
1887
|
|
|
1240
1888
|
const defaultOptions$1 = {
|
|
1241
1889
|
density: 1.25,
|
|
1242
1890
|
};
|
|
1891
|
+
/**
|
|
1892
|
+
* Angular component that applies a scanline effect to the scene.
|
|
1893
|
+
*
|
|
1894
|
+
* This effect overlays horizontal scanlines on the image, simulating
|
|
1895
|
+
* the appearance of old CRT monitors or television screens.
|
|
1896
|
+
*
|
|
1897
|
+
* @example
|
|
1898
|
+
* ```html
|
|
1899
|
+
* <ngtp-effect-composer>
|
|
1900
|
+
* <ngtp-scanline [options]="{ density: 2.0 }" />
|
|
1901
|
+
* </ngtp-effect-composer>
|
|
1902
|
+
* ```
|
|
1903
|
+
*/
|
|
1243
1904
|
class NgtpScanline {
|
|
1244
1905
|
constructor() {
|
|
1245
|
-
|
|
1246
|
-
|
|
1906
|
+
/**
|
|
1907
|
+
* Configuration options for the scanline effect.
|
|
1908
|
+
* @default { density: 1.25 }
|
|
1909
|
+
* @see ScanlineEffectOptions
|
|
1910
|
+
*/
|
|
1911
|
+
this.options = input(defaultOptions$1, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions$1) });
|
|
1912
|
+
/** Reference to the host NgtpEffect directive */
|
|
1913
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
1914
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1247
1915
|
extend({ ScanlineEffect });
|
|
1248
1916
|
}
|
|
1249
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1250
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1251
|
-
<ngt-scanline-effect *args="[options()]" [camera]="
|
|
1917
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpScanline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1918
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 })], viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
1919
|
+
<ngt-scanline-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1252
1920
|
<ngtp-effect-blend-mode />
|
|
1253
1921
|
<ng-content />
|
|
1254
1922
|
</ngt-scanline-effect>
|
|
1255
1923
|
`, 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
1924
|
}
|
|
1257
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1925
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpScanline, decorators: [{
|
|
1258
1926
|
type: Component,
|
|
1259
1927
|
args: [{
|
|
1260
1928
|
selector: 'ngtp-scanline',
|
|
1261
1929
|
template: `
|
|
1262
|
-
<ngt-scanline-effect *args="[options()]" [camera]="
|
|
1930
|
+
<ngt-scanline-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1263
1931
|
<ngtp-effect-blend-mode />
|
|
1264
1932
|
<ng-content />
|
|
1265
1933
|
</ngt-scanline-effect>
|
|
@@ -1270,20 +1938,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1270
1938
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1271
1939
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.OVERLAY })],
|
|
1272
1940
|
}]
|
|
1273
|
-
}], ctorParameters: () => [] });
|
|
1941
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1274
1942
|
|
|
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
1943
|
const defaultOptions = {
|
|
1278
1944
|
selectionLayer: 10,
|
|
1279
1945
|
inverted: false,
|
|
1280
1946
|
ignoreBackground: false,
|
|
1281
1947
|
};
|
|
1948
|
+
/**
|
|
1949
|
+
* Angular component that applies bloom only to selected objects.
|
|
1950
|
+
*
|
|
1951
|
+
* Unlike the standard bloom effect, selective bloom allows you to specify
|
|
1952
|
+
* which objects should glow. Requires light sources to be provided for
|
|
1953
|
+
* proper rendering.
|
|
1954
|
+
*
|
|
1955
|
+
* Can be used with NgtSelectionApi for declarative selection or with
|
|
1956
|
+
* manual selection via the selection input.
|
|
1957
|
+
*
|
|
1958
|
+
* @example
|
|
1959
|
+
* ```html
|
|
1960
|
+
* <ngtp-effect-composer>
|
|
1961
|
+
* <ngtp-selective-bloom
|
|
1962
|
+
* [lights]="[ambientLightRef, pointLightRef]"
|
|
1963
|
+
* [selection]="[glowingMeshRef]"
|
|
1964
|
+
* [options]="{ intensity: 2, luminanceThreshold: 0 }"
|
|
1965
|
+
* />
|
|
1966
|
+
* </ngtp-effect-composer>
|
|
1967
|
+
* ```
|
|
1968
|
+
*/
|
|
1282
1969
|
class NgtpSelectiveBloom {
|
|
1283
1970
|
constructor() {
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1971
|
+
/**
|
|
1972
|
+
* Light sources that should be included in the bloom calculation.
|
|
1973
|
+
* Required for proper selective bloom rendering.
|
|
1974
|
+
*/
|
|
1975
|
+
this.lights = input.required(...(ngDevMode ? [{ debugName: "lights" }] : []));
|
|
1976
|
+
/**
|
|
1977
|
+
* Objects to apply bloom to.
|
|
1978
|
+
* Can be a single object, array of objects, or ElementRefs.
|
|
1979
|
+
* Not needed if using NgtSelectionApi.
|
|
1980
|
+
* @default []
|
|
1981
|
+
*/
|
|
1982
|
+
this.selection = input([], ...(ngDevMode ? [{ debugName: "selection" }] : []));
|
|
1983
|
+
/**
|
|
1984
|
+
* Configuration options for the selective bloom effect.
|
|
1985
|
+
* @see SelectiveBloomOptions
|
|
1986
|
+
*/
|
|
1987
|
+
this.options = input(defaultOptions, { ...(ngDevMode ? { debugName: "options" } : {}), transform: mergeInputs(defaultOptions) });
|
|
1287
1988
|
this.blendFunction = pick(this.options, 'blendFunction');
|
|
1288
1989
|
this.luminanceThreshold = pick(this.options, 'luminanceThreshold');
|
|
1289
1990
|
this.luminanceSmoothing = pick(this.options, 'luminanceSmoothing');
|
|
@@ -1302,20 +2003,24 @@ class NgtpSelectiveBloom {
|
|
|
1302
2003
|
this.selectionLayer = pick(this.options, 'selectionLayer');
|
|
1303
2004
|
this.store = injectStore();
|
|
1304
2005
|
this.effectComposer = inject(NgtpEffectComposer);
|
|
1305
|
-
this.
|
|
1306
|
-
this.resolvedLights = computed(() => this.lights().map((light) => resolveRef(light)));
|
|
2006
|
+
this.selectionApi = inject(NgtSelectionApi, { optional: true });
|
|
2007
|
+
this.resolvedLights = computed(() => this.lights().map((light) => resolveRef(light)), ...(ngDevMode ? [{ debugName: "resolvedLights" }] : []));
|
|
1307
2008
|
this.resolvedSelected = computed(() => {
|
|
1308
2009
|
const selection = this.selection();
|
|
1309
2010
|
if (!selection)
|
|
1310
2011
|
return [];
|
|
1311
2012
|
const array = Array.isArray(selection) ? selection : [selection];
|
|
1312
2013
|
return array.map((selected) => resolveRef(selected));
|
|
1313
|
-
});
|
|
2014
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedSelected" }] : []));
|
|
1314
2015
|
this.resolvedNgtSelected = computed(() => {
|
|
1315
|
-
if (!this.
|
|
2016
|
+
if (!this.selectionApi || !this.selectionApi.enabled)
|
|
1316
2017
|
return [];
|
|
1317
|
-
return this.
|
|
1318
|
-
});
|
|
2018
|
+
return this.selectionApi.selected().map((selected) => resolveRef(selected));
|
|
2019
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedNgtSelected" }] : []));
|
|
2020
|
+
/**
|
|
2021
|
+
* The underlying SelectiveBloomEffect instance.
|
|
2022
|
+
* Created with the scene, camera, and configured options.
|
|
2023
|
+
*/
|
|
1319
2024
|
this.effect = computed(() => {
|
|
1320
2025
|
const effect = new SelectiveBloomEffect(this.effectComposer.scene(), this.effectComposer.camera(), {
|
|
1321
2026
|
blendFunction: this.blendFunction() || BlendFunction.ADD,
|
|
@@ -1335,10 +2040,10 @@ class NgtpSelectiveBloom {
|
|
|
1335
2040
|
effect.inverted = this.inverted();
|
|
1336
2041
|
effect.ignoreBackground = this.ignoreBackground();
|
|
1337
2042
|
return effect;
|
|
1338
|
-
});
|
|
2043
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
1339
2044
|
effect((onCleanup) => {
|
|
1340
2045
|
// skip input selection altogether if NgtSelection is used
|
|
1341
|
-
if (this.
|
|
2046
|
+
if (this.selectionApi)
|
|
1342
2047
|
return;
|
|
1343
2048
|
const selection = this.resolvedSelected();
|
|
1344
2049
|
if (!selection.length)
|
|
@@ -1352,7 +2057,11 @@ class NgtpSelectiveBloom {
|
|
|
1352
2057
|
});
|
|
1353
2058
|
});
|
|
1354
2059
|
effect(() => {
|
|
1355
|
-
const [selectionLayer, invalidate, effect] = [
|
|
2060
|
+
const [selectionLayer, invalidate, effect] = [
|
|
2061
|
+
this.selectionLayer(),
|
|
2062
|
+
this.store.invalidate(),
|
|
2063
|
+
this.effect(),
|
|
2064
|
+
];
|
|
1356
2065
|
effect.selection.layer = selectionLayer;
|
|
1357
2066
|
invalidate();
|
|
1358
2067
|
});
|
|
@@ -1381,18 +2090,30 @@ class NgtpSelectiveBloom {
|
|
|
1381
2090
|
});
|
|
1382
2091
|
});
|
|
1383
2092
|
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Enables the selection layer on a light source.
|
|
2095
|
+
*
|
|
2096
|
+
* @param effect - The SelectiveBloomEffect instance
|
|
2097
|
+
* @param light - The light to enable on the selection layer
|
|
2098
|
+
*/
|
|
1384
2099
|
addLight(effect, light) {
|
|
1385
2100
|
light.layers.enable(effect.selection.layer);
|
|
1386
2101
|
}
|
|
2102
|
+
/**
|
|
2103
|
+
* Disables the selection layer on a light source.
|
|
2104
|
+
*
|
|
2105
|
+
* @param effect - The SelectiveBloomEffect instance
|
|
2106
|
+
* @param light - The light to disable from the selection layer
|
|
2107
|
+
*/
|
|
1387
2108
|
removeLight(effect, light) {
|
|
1388
2109
|
light.layers.disable(effect.selection.layer);
|
|
1389
2110
|
}
|
|
1390
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1391
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2111
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSelectiveBloom, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2112
|
+
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
2113
|
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
1393
2114
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1394
2115
|
}
|
|
1395
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSelectiveBloom, decorators: [{
|
|
1396
2117
|
type: Component,
|
|
1397
2118
|
args: [{
|
|
1398
2119
|
selector: 'ngtp-selective-bloom',
|
|
@@ -1403,28 +2124,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1403
2124
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1404
2125
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1405
2126
|
}]
|
|
1406
|
-
}], ctorParameters: () => [] });
|
|
2127
|
+
}], 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
2128
|
|
|
2129
|
+
/**
|
|
2130
|
+
* Angular component that applies a sepia tone effect to the scene.
|
|
2131
|
+
*
|
|
2132
|
+
* This effect gives the rendered image a warm, brownish tint similar to
|
|
2133
|
+
* old photographs, creating a vintage or nostalgic appearance.
|
|
2134
|
+
*
|
|
2135
|
+
* @example
|
|
2136
|
+
* ```html
|
|
2137
|
+
* <ngtp-effect-composer>
|
|
2138
|
+
* <ngtp-sepia [options]="{ intensity: 0.5 }" />
|
|
2139
|
+
* </ngtp-effect-composer>
|
|
2140
|
+
* ```
|
|
2141
|
+
*/
|
|
1408
2142
|
class NgtpSepia {
|
|
1409
2143
|
constructor() {
|
|
1410
|
-
|
|
1411
|
-
|
|
2144
|
+
/**
|
|
2145
|
+
* Configuration options for the sepia effect.
|
|
2146
|
+
* @see SepiaEffectOptions
|
|
2147
|
+
*/
|
|
2148
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2149
|
+
/** Reference to the host NgtpEffect directive */
|
|
2150
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2151
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1412
2152
|
extend({ SepiaEffect });
|
|
1413
2153
|
}
|
|
1414
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1415
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1416
|
-
<ngt-sepia-effect *args="[options()]" [camera]="
|
|
2154
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSepia, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2155
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: NgtpSepia, isStandalone: true, selector: "ngtp-sepia", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2156
|
+
<ngt-sepia-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1417
2157
|
<ngtp-effect-blend-mode />
|
|
1418
2158
|
<ng-content />
|
|
1419
2159
|
</ngt-sepia-effect>
|
|
1420
2160
|
`, 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
2161
|
}
|
|
1422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSepia, decorators: [{
|
|
1423
2163
|
type: Component,
|
|
1424
2164
|
args: [{
|
|
1425
2165
|
selector: 'ngtp-sepia',
|
|
1426
2166
|
template: `
|
|
1427
|
-
<ngt-sepia-effect *args="[options()]" [camera]="
|
|
2167
|
+
<ngt-sepia-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1428
2168
|
<ngtp-effect-blend-mode />
|
|
1429
2169
|
<ng-content />
|
|
1430
2170
|
</ngt-sepia-effect>
|
|
@@ -1434,28 +2174,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1434
2174
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1435
2175
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1436
2176
|
}]
|
|
1437
|
-
}], ctorParameters: () => [] });
|
|
2177
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1438
2178
|
|
|
2179
|
+
/**
|
|
2180
|
+
* Angular component that applies a shock wave distortion effect.
|
|
2181
|
+
*
|
|
2182
|
+
* This effect creates an expanding ring distortion that simulates a
|
|
2183
|
+
* shock wave or explosion ripple emanating from a point in the scene.
|
|
2184
|
+
*
|
|
2185
|
+
* @example
|
|
2186
|
+
* ```html
|
|
2187
|
+
* <ngtp-effect-composer>
|
|
2188
|
+
* <ngtp-shock-wave
|
|
2189
|
+
* [options]="{ speed: 2, maxRadius: 1, waveSize: 0.2, amplitude: 0.05 }"
|
|
2190
|
+
* />
|
|
2191
|
+
* </ngtp-effect-composer>
|
|
2192
|
+
* ```
|
|
2193
|
+
*/
|
|
1439
2194
|
class NgtpShockWave {
|
|
1440
2195
|
constructor() {
|
|
1441
|
-
|
|
1442
|
-
|
|
2196
|
+
/**
|
|
2197
|
+
* Configuration options for the shock wave effect.
|
|
2198
|
+
* @see ShockWaveEffectOptions
|
|
2199
|
+
*/
|
|
2200
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2201
|
+
/** Reference to the host NgtpEffect directive */
|
|
2202
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2203
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1443
2204
|
extend({ ShockWaveEffect });
|
|
1444
2205
|
}
|
|
1445
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1446
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1447
|
-
<ngt-shock-wave-effect *args="[options()]" [camera]="
|
|
2206
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpShockWave, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2207
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2208
|
+
<ngt-shock-wave-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1448
2209
|
<ngtp-effect-blend-mode />
|
|
1449
2210
|
<ng-content />
|
|
1450
2211
|
</ngt-shock-wave-effect>
|
|
1451
2212
|
`, 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
2213
|
}
|
|
1453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpShockWave, decorators: [{
|
|
1454
2215
|
type: Component,
|
|
1455
2216
|
args: [{
|
|
1456
2217
|
selector: 'ngtp-shock-wave',
|
|
1457
2218
|
template: `
|
|
1458
|
-
<ngt-shock-wave-effect *args="[options()]" [camera]="
|
|
2219
|
+
<ngt-shock-wave-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1459
2220
|
<ngtp-effect-blend-mode />
|
|
1460
2221
|
<ng-content />
|
|
1461
2222
|
</ngt-shock-wave-effect>
|
|
@@ -1465,28 +2226,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1465
2226
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1466
2227
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1467
2228
|
}]
|
|
1468
|
-
}], ctorParameters: () => [] });
|
|
2229
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1469
2230
|
|
|
2231
|
+
/**
|
|
2232
|
+
* Angular component that applies Subpixel Morphological Anti-Aliasing (SMAA).
|
|
2233
|
+
*
|
|
2234
|
+
* SMAA is a high-quality, efficient anti-aliasing technique that provides
|
|
2235
|
+
* better results than FXAA while being less demanding than multisampling.
|
|
2236
|
+
* It's particularly effective at smoothing edges while preserving sharpness.
|
|
2237
|
+
*
|
|
2238
|
+
* @example
|
|
2239
|
+
* ```html
|
|
2240
|
+
* <ngtp-effect-composer [options]="{ multisampling: 0 }">
|
|
2241
|
+
* <ngtp-smaa />
|
|
2242
|
+
* </ngtp-effect-composer>
|
|
2243
|
+
* ```
|
|
2244
|
+
*
|
|
2245
|
+
* @example
|
|
2246
|
+
* ```html
|
|
2247
|
+
* <!-- With preset -->
|
|
2248
|
+
* <ngtp-effect-composer>
|
|
2249
|
+
* <ngtp-smaa [options]="{ preset: SMAAPreset.ULTRA }" />
|
|
2250
|
+
* </ngtp-effect-composer>
|
|
2251
|
+
* ```
|
|
2252
|
+
*/
|
|
1470
2253
|
class NgtpSMAA {
|
|
1471
2254
|
constructor() {
|
|
1472
|
-
|
|
1473
|
-
|
|
2255
|
+
/**
|
|
2256
|
+
* Configuration options for the SMAA effect.
|
|
2257
|
+
* @see SMAAEffectOptions
|
|
2258
|
+
*/
|
|
2259
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2260
|
+
/** Reference to the host NgtpEffect directive */
|
|
2261
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2262
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1474
2263
|
extend({ SMAAEffect });
|
|
1475
2264
|
}
|
|
1476
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1477
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1478
|
-
<ngt-sMAA-effect *args="[options()]" [camera]="
|
|
2265
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSMAA, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2266
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: NgtpSMAA, isStandalone: true, selector: "ngtp-smaa", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2267
|
+
<ngt-sMAA-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1479
2268
|
<ngtp-effect-blend-mode />
|
|
1480
2269
|
<ng-content />
|
|
1481
2270
|
</ngt-sMAA-effect>
|
|
1482
2271
|
`, 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
2272
|
}
|
|
1484
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpSMAA, decorators: [{
|
|
1485
2274
|
type: Component,
|
|
1486
2275
|
args: [{
|
|
1487
2276
|
selector: 'ngtp-smaa',
|
|
1488
2277
|
template: `
|
|
1489
|
-
<ngt-sMAA-effect *args="[options()]" [camera]="
|
|
2278
|
+
<ngt-sMAA-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1490
2279
|
<ngtp-effect-blend-mode />
|
|
1491
2280
|
<ng-content />
|
|
1492
2281
|
</ngt-sMAA-effect>
|
|
@@ -1496,28 +2285,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1496
2285
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1497
2286
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1498
2287
|
}]
|
|
1499
|
-
}], ctorParameters: () => [] });
|
|
2288
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1500
2289
|
|
|
2290
|
+
/**
|
|
2291
|
+
* Angular component that applies a tilt-shift blur effect.
|
|
2292
|
+
*
|
|
2293
|
+
* This effect simulates the shallow depth of field look from tilt-shift
|
|
2294
|
+
* photography, creating a "miniature" or "diorama" appearance where only
|
|
2295
|
+
* a horizontal band of the image is in focus.
|
|
2296
|
+
*
|
|
2297
|
+
* Uses the postprocessing library's built-in TiltShiftEffect.
|
|
2298
|
+
*
|
|
2299
|
+
* @example
|
|
2300
|
+
* ```html
|
|
2301
|
+
* <ngtp-effect-composer>
|
|
2302
|
+
* <ngtp-tilt-shift [options]="{ blur: 0.5, offset: 0.5 }" />
|
|
2303
|
+
* </ngtp-effect-composer>
|
|
2304
|
+
* ```
|
|
2305
|
+
*
|
|
2306
|
+
* @see NgtpTiltShift2 for an alternative implementation with different parameters
|
|
2307
|
+
*/
|
|
1501
2308
|
class NgtpTiltShift {
|
|
1502
2309
|
constructor() {
|
|
1503
|
-
|
|
1504
|
-
|
|
2310
|
+
/**
|
|
2311
|
+
* Configuration options for the tilt-shift effect.
|
|
2312
|
+
* @see TiltShiftEffectOptions
|
|
2313
|
+
*/
|
|
2314
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2315
|
+
/** Reference to the host NgtpEffect directive */
|
|
2316
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2317
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1505
2318
|
extend({ TiltShiftEffect });
|
|
1506
2319
|
}
|
|
1507
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1508
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1509
|
-
<ngt-tilt-shift-effect *args="[options()]" [camera]="
|
|
2320
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2321
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 })], viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2322
|
+
<ngt-tilt-shift-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1510
2323
|
<ngtp-effect-blend-mode />
|
|
1511
2324
|
<ng-content />
|
|
1512
2325
|
</ngt-tilt-shift-effect>
|
|
1513
2326
|
`, 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
2327
|
}
|
|
1515
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift, decorators: [{
|
|
1516
2329
|
type: Component,
|
|
1517
2330
|
args: [{
|
|
1518
2331
|
selector: 'ngtp-tilt-shift',
|
|
1519
2332
|
template: `
|
|
1520
|
-
<ngt-tilt-shift-effect *args="[options()]" [camera]="
|
|
2333
|
+
<ngt-tilt-shift-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1521
2334
|
<ngtp-effect-blend-mode />
|
|
1522
2335
|
<ng-content />
|
|
1523
2336
|
</ngt-tilt-shift-effect>
|
|
@@ -1528,8 +2341,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1528
2341
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1529
2342
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.ADD })],
|
|
1530
2343
|
}]
|
|
1531
|
-
}], ctorParameters: () => [] });
|
|
2344
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1532
2345
|
|
|
2346
|
+
/**
|
|
2347
|
+
* Custom tilt-shift shader based on Evan Wallace's implementation.
|
|
2348
|
+
* Provides line-based focus control with customizable blur parameters.
|
|
2349
|
+
*/
|
|
1533
2350
|
const TiltShiftShader = {
|
|
1534
2351
|
fragmentShader: /* language=glsl glsl */ `
|
|
1535
2352
|
|
|
@@ -1589,7 +2406,35 @@ const TiltShiftShader = {
|
|
|
1589
2406
|
}
|
|
1590
2407
|
`,
|
|
1591
2408
|
};
|
|
2409
|
+
/**
|
|
2410
|
+
* A custom tilt-shift effect with line-based focus control.
|
|
2411
|
+
*
|
|
2412
|
+
* This effect provides a different approach to tilt-shift compared to
|
|
2413
|
+
* the standard TiltShiftEffect, allowing you to define a focus line
|
|
2414
|
+
* between two screen-space points.
|
|
2415
|
+
*
|
|
2416
|
+
* @example
|
|
2417
|
+
* ```typescript
|
|
2418
|
+
* const effect = new TiltShift2Effect({
|
|
2419
|
+
* blur: 0.2,
|
|
2420
|
+
* start: [0.5, 0.3],
|
|
2421
|
+
* end: [0.5, 0.7]
|
|
2422
|
+
* });
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
1592
2425
|
class TiltShift2Effect extends Effect {
|
|
2426
|
+
/**
|
|
2427
|
+
* Creates a new TiltShift2Effect instance.
|
|
2428
|
+
*
|
|
2429
|
+
* @param options - Configuration options
|
|
2430
|
+
* @param options.blendFunction - How to blend with the scene
|
|
2431
|
+
* @param options.blur - Blur intensity [0, 1], can exceed 1 for more blur
|
|
2432
|
+
* @param options.taper - Taper of the focus area [0, 1]
|
|
2433
|
+
* @param options.start - Start point of focus line in screen space [x, y]
|
|
2434
|
+
* @param options.end - End point of focus line in screen space [x, y]
|
|
2435
|
+
* @param options.samples - Number of blur samples
|
|
2436
|
+
* @param options.direction - Direction of the blur
|
|
2437
|
+
*/
|
|
1593
2438
|
constructor({ blendFunction = BlendFunction.NORMAL, blur = 0.15, // [0, 1], can go beyond 1 for extra
|
|
1594
2439
|
taper = 0.5, // [0, 1], can go beyond 1 for extra
|
|
1595
2440
|
start = [0.5, 0.0], // [0,1] percentage x,y of screenspace
|
|
@@ -1612,25 +2457,47 @@ class TiltShift2Effect extends Effect {
|
|
|
1612
2457
|
}
|
|
1613
2458
|
}
|
|
1614
2459
|
extend({ TiltShift2Effect });
|
|
2460
|
+
/**
|
|
2461
|
+
* Angular component that applies an alternative tilt-shift effect.
|
|
2462
|
+
*
|
|
2463
|
+
* This effect uses a line-based focus system where you define start and
|
|
2464
|
+
* end points in screen space. The area between these points stays in focus
|
|
2465
|
+
* while the rest of the image is blurred.
|
|
2466
|
+
*
|
|
2467
|
+
* @example
|
|
2468
|
+
* ```html
|
|
2469
|
+
* <ngtp-effect-composer>
|
|
2470
|
+
* <ngtp-tilt-shift2 [options]="{ blur: 0.2, start: [0.5, 0.3], end: [0.5, 0.7] }" />
|
|
2471
|
+
* </ngtp-effect-composer>
|
|
2472
|
+
* ```
|
|
2473
|
+
*
|
|
2474
|
+
* @see NgtpTiltShift for the standard tilt-shift implementation
|
|
2475
|
+
*/
|
|
1615
2476
|
class NgtpTiltShift2 {
|
|
1616
2477
|
constructor() {
|
|
1617
|
-
|
|
1618
|
-
|
|
2478
|
+
/**
|
|
2479
|
+
* Configuration options for the tilt-shift effect.
|
|
2480
|
+
* @see TiltShift2EffectOptions
|
|
2481
|
+
*/
|
|
2482
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2483
|
+
/** Reference to the host NgtpEffect directive */
|
|
2484
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2485
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1619
2486
|
}
|
|
1620
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1621
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1622
|
-
<ngt-tilt-shift2-effect *args="[options()]" [camera]="
|
|
2487
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift2, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2488
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 })], viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2489
|
+
<ngt-tilt-shift2-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1623
2490
|
<ngtp-effect-blend-mode />
|
|
1624
2491
|
<ng-content />
|
|
1625
2492
|
</ngt-tilt-shift2-effect>
|
|
1626
2493
|
`, 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
2494
|
}
|
|
1628
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpTiltShift2, decorators: [{
|
|
1629
2496
|
type: Component,
|
|
1630
2497
|
args: [{
|
|
1631
2498
|
selector: 'ngtp-tilt-shift2',
|
|
1632
2499
|
template: `
|
|
1633
|
-
<ngt-tilt-shift2-effect *args="[options()]" [camera]="
|
|
2500
|
+
<ngt-tilt-shift2-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1634
2501
|
<ngtp-effect-blend-mode />
|
|
1635
2502
|
<ng-content />
|
|
1636
2503
|
</ngt-tilt-shift2-effect>
|
|
@@ -1641,28 +2508,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1641
2508
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1642
2509
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
|
|
1643
2510
|
}]
|
|
1644
|
-
}] });
|
|
2511
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1645
2512
|
|
|
2513
|
+
/**
|
|
2514
|
+
* Angular component that applies tone mapping to the scene.
|
|
2515
|
+
*
|
|
2516
|
+
* Tone mapping converts HDR (High Dynamic Range) values to LDR (Low Dynamic
|
|
2517
|
+
* Range) for display. Various tone mapping modes are available including
|
|
2518
|
+
* Reinhard, ACES Filmic, and custom linear options.
|
|
2519
|
+
*
|
|
2520
|
+
* Note: The effect composer disables Three.js's built-in tone mapping,
|
|
2521
|
+
* so this effect should be used if tone mapping is desired.
|
|
2522
|
+
*
|
|
2523
|
+
* @example
|
|
2524
|
+
* ```html
|
|
2525
|
+
* <ngtp-effect-composer>
|
|
2526
|
+
* <ngtp-tone-mapping [options]="{ mode: ToneMappingMode.ACES_FILMIC }" />
|
|
2527
|
+
* </ngtp-effect-composer>
|
|
2528
|
+
* ```
|
|
2529
|
+
*/
|
|
1646
2530
|
class NgtpToneMapping {
|
|
1647
2531
|
constructor() {
|
|
1648
|
-
|
|
1649
|
-
|
|
2532
|
+
/**
|
|
2533
|
+
* Configuration options for the tone mapping effect.
|
|
2534
|
+
* @see ToneMappingEffectOptions
|
|
2535
|
+
*/
|
|
2536
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2537
|
+
/** Reference to the host NgtpEffect directive */
|
|
2538
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2539
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1650
2540
|
extend({ ToneMappingEffect });
|
|
1651
2541
|
}
|
|
1652
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1653
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1654
|
-
<ngt-tone-mapping-effect *args="[options()]" [camera]="
|
|
2542
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpToneMapping, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2543
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2544
|
+
<ngt-tone-mapping-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1655
2545
|
<ngtp-effect-blend-mode />
|
|
1656
2546
|
<ng-content />
|
|
1657
2547
|
</ngt-tone-mapping-effect>
|
|
1658
2548
|
`, 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
2549
|
}
|
|
1660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2550
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpToneMapping, decorators: [{
|
|
1661
2551
|
type: Component,
|
|
1662
2552
|
args: [{
|
|
1663
2553
|
selector: 'ngtp-tone-mapping',
|
|
1664
2554
|
template: `
|
|
1665
|
-
<ngt-tone-mapping-effect *args="[options()]" [camera]="
|
|
2555
|
+
<ngt-tone-mapping-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1666
2556
|
<ngtp-effect-blend-mode />
|
|
1667
2557
|
<ng-content />
|
|
1668
2558
|
</ngt-tone-mapping-effect>
|
|
@@ -1672,28 +2562,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1672
2562
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1673
2563
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1674
2564
|
}]
|
|
1675
|
-
}], ctorParameters: () => [] });
|
|
2565
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1676
2566
|
|
|
2567
|
+
/**
|
|
2568
|
+
* Angular component that applies a vignette effect to the scene.
|
|
2569
|
+
*
|
|
2570
|
+
* This effect darkens the corners and edges of the image, drawing the
|
|
2571
|
+
* viewer's attention to the center. It's a common cinematic technique
|
|
2572
|
+
* for creating focus and atmosphere.
|
|
2573
|
+
*
|
|
2574
|
+
* @example
|
|
2575
|
+
* ```html
|
|
2576
|
+
* <ngtp-effect-composer>
|
|
2577
|
+
* <ngtp-vignette [options]="{ darkness: 0.5, offset: 0.3 }" />
|
|
2578
|
+
* </ngtp-effect-composer>
|
|
2579
|
+
* ```
|
|
2580
|
+
*/
|
|
1677
2581
|
class NgtpVignette {
|
|
1678
2582
|
constructor() {
|
|
1679
|
-
|
|
1680
|
-
|
|
2583
|
+
/**
|
|
2584
|
+
* Configuration options for the vignette effect.
|
|
2585
|
+
* @see VignetteEffectOptions
|
|
2586
|
+
*/
|
|
2587
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2588
|
+
/** Reference to the host NgtpEffect directive */
|
|
2589
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2590
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1681
2591
|
extend({ VignetteEffect });
|
|
1682
2592
|
}
|
|
1683
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1684
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1685
|
-
<ngt-vignette-effect *args="[options()]" [camera]="
|
|
2593
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpVignette, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2594
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: NgtpVignette, isStandalone: true, selector: "ngtp-vignette", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2595
|
+
<ngt-vignette-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1686
2596
|
<ngtp-effect-blend-mode />
|
|
1687
2597
|
<ng-content />
|
|
1688
2598
|
</ngt-vignette-effect>
|
|
1689
2599
|
`, 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
2600
|
}
|
|
1691
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2601
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpVignette, decorators: [{
|
|
1692
2602
|
type: Component,
|
|
1693
2603
|
args: [{
|
|
1694
2604
|
selector: 'ngtp-vignette',
|
|
1695
2605
|
template: `
|
|
1696
|
-
<ngt-vignette-effect *args="[options()]" [camera]="
|
|
2606
|
+
<ngt-vignette-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1697
2607
|
<ngtp-effect-blend-mode />
|
|
1698
2608
|
<ng-content />
|
|
1699
2609
|
</ngt-vignette-effect>
|
|
@@ -1703,8 +2613,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1703
2613
|
imports: [NgtArgs, NgtpEffectBlendMode],
|
|
1704
2614
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1705
2615
|
}]
|
|
1706
|
-
}], ctorParameters: () => [] });
|
|
2616
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1707
2617
|
|
|
2618
|
+
/**
|
|
2619
|
+
* Shader configuration for the water distortion effect.
|
|
2620
|
+
* Creates a rippling, underwater-like distortion.
|
|
2621
|
+
*/
|
|
1708
2622
|
const WaterShader = {
|
|
1709
2623
|
fragmentShader: /* language=glsl glsl */ `
|
|
1710
2624
|
uniform float factor;
|
|
@@ -1720,7 +2634,25 @@ const WaterShader = {
|
|
|
1720
2634
|
outputColor = rgba;
|
|
1721
2635
|
}`,
|
|
1722
2636
|
};
|
|
2637
|
+
/**
|
|
2638
|
+
* A postprocessing effect that simulates an underwater/water distortion.
|
|
2639
|
+
*
|
|
2640
|
+
* Creates animated rippling distortion that makes the scene appear as if
|
|
2641
|
+
* viewed through water or a heat haze.
|
|
2642
|
+
*
|
|
2643
|
+
* @example
|
|
2644
|
+
* ```typescript
|
|
2645
|
+
* const effect = new WaterEffect({ factor: 0.5 });
|
|
2646
|
+
* ```
|
|
2647
|
+
*/
|
|
1723
2648
|
class WaterEffect extends Effect {
|
|
2649
|
+
/**
|
|
2650
|
+
* Creates a new WaterEffect instance.
|
|
2651
|
+
*
|
|
2652
|
+
* @param options - Configuration options
|
|
2653
|
+
* @param options.blendFunction - How to blend with the scene
|
|
2654
|
+
* @param options.factor - Intensity of the water effect (0 = no effect)
|
|
2655
|
+
*/
|
|
1724
2656
|
constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
|
|
1725
2657
|
super('WaterEffect', WaterShader.fragmentShader, {
|
|
1726
2658
|
blendFunction,
|
|
@@ -1729,26 +2661,45 @@ class WaterEffect extends Effect {
|
|
|
1729
2661
|
});
|
|
1730
2662
|
}
|
|
1731
2663
|
}
|
|
2664
|
+
/**
|
|
2665
|
+
* Angular component that applies a water/ripple distortion effect.
|
|
2666
|
+
*
|
|
2667
|
+
* This effect creates an animated underwater-like distortion that can
|
|
2668
|
+
* simulate viewing through water, heat haze, or a dream-like state.
|
|
2669
|
+
*
|
|
2670
|
+
* @example
|
|
2671
|
+
* ```html
|
|
2672
|
+
* <ngtp-effect-composer>
|
|
2673
|
+
* <ngtp-water [options]="{ factor: 0.5 }" />
|
|
2674
|
+
* </ngtp-effect-composer>
|
|
2675
|
+
* ```
|
|
2676
|
+
*/
|
|
1732
2677
|
class NgtpWater {
|
|
1733
2678
|
constructor() {
|
|
1734
|
-
|
|
1735
|
-
|
|
2679
|
+
/**
|
|
2680
|
+
* Configuration options for the water effect.
|
|
2681
|
+
* @see WaterEffectOptions
|
|
2682
|
+
*/
|
|
2683
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2684
|
+
/** Reference to the host NgtpEffect directive */
|
|
2685
|
+
this.hostEffect = inject(NgtpEffect, { host: true });
|
|
2686
|
+
this.effectRef = viewChild('effect', ...(ngDevMode ? [{ debugName: "effectRef" }] : []));
|
|
1736
2687
|
extend({ WaterEffect });
|
|
1737
2688
|
}
|
|
1738
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1739
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1740
|
-
<ngt-water-effect *args="[options()]" [camera]="
|
|
2689
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpWater, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2690
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.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 })], viewQueries: [{ propertyName: "effectRef", first: true, predicate: ["effect"], descendants: true, isSignal: true }], hostDirectives: [{ directive: NgtpEffect, inputs: ["blendFunction", "blendFunction", "opacity", "opacity"] }], ngImport: i0, template: `
|
|
2691
|
+
<ngt-water-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1741
2692
|
<ngtp-effect-blend-mode />
|
|
1742
2693
|
<ng-content />
|
|
1743
2694
|
</ngt-water-effect>
|
|
1744
2695
|
`, 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
2696
|
}
|
|
1746
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgtpWater, decorators: [{
|
|
1747
2698
|
type: Component,
|
|
1748
2699
|
args: [{
|
|
1749
2700
|
selector: 'ngtp-water',
|
|
1750
2701
|
template: `
|
|
1751
|
-
<ngt-water-effect *args="[options()]" [camera]="
|
|
2702
|
+
<ngt-water-effect #effect *args="[options()]" [camera]="hostEffect.camera()">
|
|
1752
2703
|
<ngtp-effect-blend-mode />
|
|
1753
2704
|
<ng-content />
|
|
1754
2705
|
</ngt-water-effect>
|
|
@@ -1759,7 +2710,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1759
2710
|
hostDirectives: [{ directive: NgtpEffect, inputs: ['blendFunction', 'opacity'] }],
|
|
1760
2711
|
providers: [provideDefaultEffectOptions({ blendFunction: BlendFunction.NORMAL })],
|
|
1761
2712
|
}]
|
|
1762
|
-
}], ctorParameters: () => [] });
|
|
2713
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
1763
2714
|
|
|
1764
2715
|
/**
|
|
1765
2716
|
* Generated bundle index. Do not edit.
|