angular-three-postprocessing 2.2.1 → 2.3.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-three-postprocessing-n8ao.mjs","sources":["../../../../libs/postprocessing/n8ao/src/lib/n8ao.ts","../../../../libs/postprocessing/n8ao/src/angular-three-postprocessing-n8ao.ts"],"sourcesContent":["// @ts-expect-error - n8ao is not typed\nimport { N8AOPostPass } from 'n8ao';\n\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tCUSTOM_ELEMENTS_SCHEMA,\n\teffect,\n\tinject,\n\tinput,\n} from '@angular/core';\nimport { applyProps, NgtArgs, pick } from 'angular-three';\nimport { NgtpEffectComposer } from 'angular-three-postprocessing';\nimport { mergeInputs } from 'ngxtension/inject-inputs';\nimport { ColorRepresentation } from 'three';\n\nexport interface NgtpN8AOOptions {\n\taoRadius: number;\n\taoTones: number;\n\tdistanceFalloff: number;\n\tintensity: number;\n\tbiasOffset: number;\n\tbiasMultiplier: number;\n\taoSamples: number;\n\tdenoiseSamples: number;\n\tdenoiseRadius: number;\n\tcolor: ColorRepresentation;\n\thalfRes: boolean;\n\tdepthAwareUpsampling: boolean;\n\tscreenSpaceRadius: boolean;\n\trenderMode: 0 | 1 | 2 | 3 | 4;\n\tdenoiseIterations: number;\n\ttransparencyAware: boolean;\n\tgammaCorrection: boolean;\n\tlogarithmicDepthBuffer: boolean;\n\tcolorMultiply: boolean;\n\taccumulate: boolean;\n\tquality?: 'performance' | 'low' | 'medium' | 'high' | 'ultra';\n}\n\nconst defaultOptions: NgtpN8AOOptions = {\n\taoSamples: 16,\n\taoRadius: 5.0,\n\taoTones: 0.0,\n\tdenoiseSamples: 8,\n\tdenoiseRadius: 12,\n\tdistanceFalloff: 1.0,\n\tintensity: 5,\n\tdenoiseIterations: 2.0,\n\trenderMode: 0,\n\tbiasOffset: 0.0,\n\tbiasMultiplier: 0.0,\n\tcolor: 'black',\n\tgammaCorrection: true,\n\tlogarithmicDepthBuffer: false,\n\tscreenSpaceRadius: false,\n\thalfRes: false,\n\tdepthAwareUpsampling: true,\n\tcolorMultiply: true,\n\ttransparencyAware: false,\n\taccumulate: false,\n};\n\n@Component({\n\tselector: 'ngtp-n8ao',\n\tstandalone: true,\n\ttemplate: `\n\t\t<ngt-primitive *args=\"[effect()]\" />\n\t`,\n\timports: [NgtArgs],\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgtpN8AO {\n\toptions = input(defaultOptions, { transform: mergeInputs(defaultOptions) });\n\n\tprivate quality = pick(this.options, 'quality');\n\n\tprivate effectComposer = inject(NgtpEffectComposer);\n\n\teffect = computed(() => {\n\t\tconst [scene, camera] = [this.effectComposer.scene(), this.effectComposer.camera()];\n\t\treturn new N8AOPostPass(scene, camera);\n\t});\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst n8aoEffect = this.effect();\n\t\t\tif (!n8aoEffect) return;\n\n\t\t\tconst { quality: _, ...configurations } = this.options();\n\t\t\tapplyProps(n8aoEffect.configuration, configurations);\n\t\t});\n\n\t\teffect(() => {\n\t\t\tthis.setQualityEffect();\n\t\t});\n\t}\n\n\tprivate setQualityEffect() {\n\t\tconst effect = this.effect();\n\t\tif (!effect) return;\n\n\t\tconst quality = this.quality();\n\t\tif (!quality) return;\n\n\t\tconst titleCaseQuality = quality.charAt(0).toUpperCase() + quality.slice(1);\n\t\teffect.setQuality(titleCaseQuality);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;AAyCA,MAAM,cAAc,GAAoB;AACvC,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,QAAQ,EAAE,GAAG;AACb,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,aAAa,EAAE,EAAE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QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACS,OAAO,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA,EAAA;;2FAIL,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAVpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,CAAA;;AAET,CAAA,CAAA;oBACD,OAAO,EAAE,CAAC,OAAO,CAAC;oBAClB,OAAO,EAAE,CAAC,sBAAsB,CAAC;oBACjC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA,CAAA;;;ACzED;;AAEG;;;;"}
@@ -3,7 +3,7 @@ import { inject, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, inp
3
3
  import { injectStore, pick, extend, getLocalState, injectBeforeRender, NgtArgs, vector2, is, NgtSelection, omit, resolveRef } from 'angular-three';
4
4
  import { createNoopInjectionToken } from 'ngxtension/create-injection-token';
5
5
  import { mergeInputs } from 'ngxtension/inject-inputs';
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, SepiaEffect, ShockWaveEffect, SMAAEffect, TiltShiftEffect, VignetteEffect } from 'postprocessing';
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, SepiaEffect, ShockWaveEffect, SMAAEffect, TiltShiftEffect, ToneMappingEffect, VignetteEffect } from 'postprocessing';
7
7
  import { HalfFloatType, Group, NoToneMapping, Uniform, Texture, Color, CanvasTexture, RepeatWrapping, NearestFilter, Vector3, Vector2, Mesh } from 'three';
8
8
  import { isWebGL2Available } from 'three-stdlib';
9
9
  import { easing } from 'maath';
@@ -530,9 +530,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
530
530
 
531
531
  class NgtpDepthOfField {
532
532
  constructor() {
533
- this.effectComposer = inject(NgtpEffectComposer);
534
533
  this.options = input({});
535
534
  this.autoFocus = computed(() => this.options().target != null);
535
+ this.effectComposer = inject(NgtpEffectComposer);
536
536
  this.effect = computed(() => {
537
537
  const [camera, options, autoFocus] = [this.effectComposer.camera(), this.options(), this.autoFocus()];
538
538
  const effect = new DepthOfFieldEffect(camera, options);
@@ -638,8 +638,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
638
638
 
639
639
  class NgtpGlitch {
640
640
  constructor() {
641
- this.store = injectStore();
642
- this.invalidate = this.store.select('invalidate');
643
641
  this.options = input({ active: true }, { transform: mergeInputs({ active: true }) });
644
642
  this.active = pick(this.options, 'active');
645
643
  this.mode = pick(this.options, 'mode');
@@ -647,6 +645,8 @@ class NgtpGlitch {
647
645
  this.duration = vector2(this.options, 'duration');
648
646
  this.chromaticAberrationOffset = vector2(this.options, 'chromaticAberrationOffset');
649
647
  this.strength = vector2(this.options, 'strength');
648
+ this.store = injectStore();
649
+ this.invalidate = this.store.select('invalidate');
650
650
  this.effect = computed(() => {
651
651
  const [{ ratio, dtSize, columns, blendFunction, perturbationMap }, delay, duration, chromaticAberrationOffset, strength,] = [this.options(), this.delay(), this.duration(), this.chromaticAberrationOffset(), this.strength()];
652
652
  return new GlitchEffect({
@@ -692,8 +692,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
692
692
 
693
693
  class NgtpGodRays {
694
694
  constructor() {
695
- this.effectComposer = inject(NgtpEffectComposer);
696
695
  this.options = input({});
696
+ this.effectComposer = inject(NgtpEffectComposer);
697
697
  this.effect = computed(() => {
698
698
  const [camera, { sun, ...options }] = [this.effectComposer.camera(), this.options()];
699
699
  return new GodRaysEffect(camera, is.ref(sun) ? sun.nativeElement : sun, options);
@@ -878,12 +878,12 @@ const defaultOptions$2 = {
878
878
  };
879
879
  class NgtpLensFlare {
880
880
  constructor() {
881
+ this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
881
882
  this.store = injectStore();
882
883
  this.viewport = this.store.select('viewport');
883
884
  this.raycaster = this.store.select('raycaster');
884
885
  this.pointer = this.store.select('pointer');
885
886
  this.effectComposer = inject(NgtpEffectComposer);
886
- this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
887
887
  this.projectedPosition = new Vector3();
888
888
  this.mouse2d = new Vector2();
889
889
  this.effect = computed(() => {
@@ -973,10 +973,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
973
973
 
974
974
  class NgtpLUT {
975
975
  constructor() {
976
- this.store = injectStore();
977
- this.invalidate = this.store.select('invalidate');
978
976
  this.options = input({});
979
977
  this.lut = pick(this.options, 'lut');
978
+ this.store = injectStore();
979
+ this.invalidate = this.store.select('invalidate');
980
980
  this.effect = computed(() => {
981
981
  const [lut, { lut: _, ...options }] = [this.lut(), this.options()];
982
982
  return new LUT3DEffect(lut, options);
@@ -1490,6 +1490,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
1490
1490
  }]
1491
1491
  }] });
1492
1492
 
1493
+ class NgtpToneMapping {
1494
+ constructor() {
1495
+ this.options = input({});
1496
+ this.parameters = omit(this.options, [
1497
+ 'blendFunction',
1498
+ 'adaptive',
1499
+ 'mode',
1500
+ 'resolution',
1501
+ 'maxLuminance',
1502
+ 'whitePoint',
1503
+ 'middleGrey',
1504
+ 'minLuminance',
1505
+ 'averageLuminance',
1506
+ 'adaptationRate',
1507
+ ]);
1508
+ this.blendFunction = pick(this.options, 'blendFunction');
1509
+ this.adaptive = pick(this.options, 'adaptive');
1510
+ this.mode = pick(this.options, 'mode');
1511
+ this.resolution = pick(this.options, 'resolution');
1512
+ this.maxLuminance = pick(this.options, 'maxLuminance');
1513
+ this.whitePoint = pick(this.options, 'whitePoint');
1514
+ this.middleGrey = pick(this.options, 'middleGrey');
1515
+ this.minLuminance = pick(this.options, 'minLuminance');
1516
+ this.averageLuminance = pick(this.options, 'averageLuminance');
1517
+ this.adaptationRate = pick(this.options, 'adaptationRate');
1518
+ this.effect = computed(() => {
1519
+ const [blendFunction, adaptive, mode, resolution, maxLuminance, whitePoint, middleGrey, minLuminance, averageLuminance, adaptationRate,] = [
1520
+ this.blendFunction(),
1521
+ this.adaptive(),
1522
+ this.mode(),
1523
+ this.resolution(),
1524
+ this.maxLuminance(),
1525
+ this.whitePoint(),
1526
+ this.middleGrey(),
1527
+ this.minLuminance(),
1528
+ this.averageLuminance(),
1529
+ this.adaptationRate(),
1530
+ ];
1531
+ const effect = new ToneMappingEffect({
1532
+ blendFunction,
1533
+ adaptive,
1534
+ mode,
1535
+ resolution,
1536
+ maxLuminance,
1537
+ whitePoint,
1538
+ middleGrey,
1539
+ minLuminance,
1540
+ averageLuminance,
1541
+ adaptationRate,
1542
+ });
1543
+ effect['setAttributes'](EffectAttribute.CONVOLUTION);
1544
+ return effect;
1545
+ });
1546
+ effect((onCleanup) => {
1547
+ const toneMappingEffect = this.effect();
1548
+ onCleanup(() => toneMappingEffect.dispose());
1549
+ });
1550
+ }
1551
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtpToneMapping, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1552
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.4", type: NgtpToneMapping, isStandalone: true, selector: "ngtp-tone-mapping", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1553
+ <ngt-primitive *args="[effect()]" [parameters]="parameters()" />
1554
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1555
+ }
1556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtpToneMapping, decorators: [{
1557
+ type: Component,
1558
+ args: [{
1559
+ selector: 'ngtp-tone-mapping',
1560
+ standalone: true,
1561
+ template: `
1562
+ <ngt-primitive *args="[effect()]" [parameters]="parameters()" />
1563
+ `,
1564
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1565
+ changeDetection: ChangeDetectionStrategy.OnPush,
1566
+ imports: [NgtArgs],
1567
+ }]
1568
+ }], ctorParameters: () => [] });
1569
+
1493
1570
  extend({ VignetteEffect });
1494
1571
  class NgtpVignette {
1495
1572
  constructor() {
@@ -1583,5 +1660,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
1583
1660
  * Generated bundle index. Do not edit.
1584
1661
  */
1585
1662
 
1586
- export { ASCIIEffect, LensFlareEffect, NgtpASCII, NgtpBloom, NgtpBrightnessContrast, NgtpChromaticAberration, NgtpColorAverage, NgtpColorDepth, NgtpDepth, NgtpDepthOfField, NgtpDotScreen, NgtpEffect, NgtpEffectBlendMode, NgtpEffectComposer, NgtpEffectHostDirective, NgtpFXAA, NgtpGlitch, NgtpGodRays, NgtpGrid, NgtpHueSaturation, NgtpLUT, NgtpLensFlare, NgtpNoise, NgtpOutline, NgtpPixelation, NgtpSMAA, NgtpScanline, NgtpSepia, NgtpShockWave, NgtpTiltShift, NgtpTiltShift2, NgtpVignette, NgtpWater, TiltShift2Effect, WaterEffect, injectDefaultEffectOptions, provideDefaultEffectOptions };
1663
+ export { ASCIIEffect, LensFlareEffect, NgtpASCII, NgtpBloom, NgtpBrightnessContrast, NgtpChromaticAberration, NgtpColorAverage, NgtpColorDepth, NgtpDepth, NgtpDepthOfField, NgtpDotScreen, NgtpEffect, NgtpEffectBlendMode, NgtpEffectComposer, NgtpEffectHostDirective, NgtpFXAA, NgtpGlitch, NgtpGodRays, NgtpGrid, NgtpHueSaturation, NgtpLUT, NgtpLensFlare, NgtpNoise, NgtpOutline, NgtpPixelation, NgtpSMAA, NgtpScanline, NgtpSepia, NgtpShockWave, NgtpTiltShift, NgtpTiltShift2, NgtpToneMapping, NgtpVignette, NgtpWater, TiltShift2Effect, WaterEffect, injectDefaultEffectOptions, provideDefaultEffectOptions };
1587
1664
  //# sourceMappingURL=angular-three-postprocessing.mjs.map