angular-three-postprocessing 4.2.0 → 4.2.1
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.
|
@@ -3,7 +3,7 @@ import { inject, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component, inp
|
|
|
3
3
|
import { injectStore, pick, extend, getInstanceState, beforeRender, NgtArgs, vector3, vector2, omit, resolveRef, is, NgtSelectionApi, loaderResource } 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, DepthPickingPass, CopyPass, DepthOfFieldEffect, BloomEffect, BlendFunction, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, MaskFunction, DotScreenEffect, FXAAEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, LUT3DEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SelectiveBloomEffect, SepiaEffect,
|
|
6
|
+
import { EffectAttribute, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, DepthPickingPass, CopyPass, DepthOfFieldEffect, BloomEffect, BlendFunction, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, MaskFunction, DotScreenEffect, FXAAEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, LUT3DEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SelectiveBloomEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, SSAOEffect, TextureEffect, TiltShiftEffect, ToneMappingEffect, VignetteEffect } from 'postprocessing';
|
|
7
7
|
import * as THREE from 'three';
|
|
8
8
|
import { Group } from 'three';
|
|
9
9
|
import { isWebGL2Available } from 'three-stdlib';
|
|
@@ -2757,65 +2757,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
2757
2757
|
}]
|
|
2758
2758
|
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
2759
2759
|
|
|
2760
|
-
class NgtpSSAO {
|
|
2761
|
-
constructor() {
|
|
2762
|
-
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2763
|
-
this.effectComposer = inject(NgtpEffectComposer);
|
|
2764
|
-
this.effect = computed(() => {
|
|
2765
|
-
const [normalPass, downSamplingPass] = [
|
|
2766
|
-
this.effectComposer.normalPass(),
|
|
2767
|
-
this.effectComposer.downSamplingPass(),
|
|
2768
|
-
];
|
|
2769
|
-
if (normalPass === null && downSamplingPass === null) {
|
|
2770
|
-
console.error('[NGT Postprocessing] Please enable the NormalPass in the EffectComposer in order to use SSAO.');
|
|
2771
|
-
return null;
|
|
2772
|
-
}
|
|
2773
|
-
const [camera, options] = [this.effectComposer.camera(), this.options()];
|
|
2774
|
-
return new SSAOEffect(camera, normalPass && !downSamplingPass ? normalPass.texture : null, {
|
|
2775
|
-
blendFunction: BlendFunction.MULTIPLY,
|
|
2776
|
-
samples: 30,
|
|
2777
|
-
rings: 4,
|
|
2778
|
-
distanceThreshold: 1.0,
|
|
2779
|
-
distanceFalloff: 0.0,
|
|
2780
|
-
rangeThreshold: 0.5,
|
|
2781
|
-
rangeFalloff: 0.1,
|
|
2782
|
-
luminanceInfluence: 0.9,
|
|
2783
|
-
radius: 20,
|
|
2784
|
-
bias: 0.5,
|
|
2785
|
-
intensity: 1.0,
|
|
2786
|
-
color: undefined,
|
|
2787
|
-
// @ts-expect-error - normalDepthBuffer is not in the types but is supported
|
|
2788
|
-
normalDepthBuffer: downSamplingPass ? downSamplingPass.texture : null,
|
|
2789
|
-
resolutionScale: 1,
|
|
2790
|
-
depthAwareUpsampling: true,
|
|
2791
|
-
...options,
|
|
2792
|
-
});
|
|
2793
|
-
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
2794
|
-
effect((onCleanup) => {
|
|
2795
|
-
const ssaoEffect = this.effect();
|
|
2796
|
-
if (!ssaoEffect)
|
|
2797
|
-
return;
|
|
2798
|
-
onCleanup(() => ssaoEffect.dispose());
|
|
2799
|
-
});
|
|
2800
|
-
}
|
|
2801
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NgtpSSAO, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2802
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: NgtpSSAO, isStandalone: true, selector: "ngtp-ssao", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
2803
|
-
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
2804
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2805
|
-
}
|
|
2806
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NgtpSSAO, decorators: [{
|
|
2807
|
-
type: Component,
|
|
2808
|
-
args: [{
|
|
2809
|
-
selector: 'ngtp-ssao',
|
|
2810
|
-
template: `
|
|
2811
|
-
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
2812
|
-
`,
|
|
2813
|
-
imports: [NgtArgs],
|
|
2814
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
2815
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2816
|
-
}]
|
|
2817
|
-
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
2818
|
-
|
|
2819
2760
|
/**
|
|
2820
2761
|
* Angular component that applies a shock wave distortion effect.
|
|
2821
2762
|
*
|
|
@@ -2927,6 +2868,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
2927
2868
|
}]
|
|
2928
2869
|
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], effectRef: [{ type: i0.ViewChild, args: ['effect', { isSignal: true }] }] } });
|
|
2929
2870
|
|
|
2871
|
+
class NgtpSSAO {
|
|
2872
|
+
constructor() {
|
|
2873
|
+
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
2874
|
+
this.effectComposer = inject(NgtpEffectComposer);
|
|
2875
|
+
this.effect = computed(() => {
|
|
2876
|
+
const [normalPass, downSamplingPass] = [
|
|
2877
|
+
this.effectComposer.normalPass(),
|
|
2878
|
+
this.effectComposer.downSamplingPass(),
|
|
2879
|
+
];
|
|
2880
|
+
if (normalPass === null && downSamplingPass === null) {
|
|
2881
|
+
console.error('[NGT Postprocessing] Please enable the NormalPass in the EffectComposer in order to use SSAO.');
|
|
2882
|
+
return null;
|
|
2883
|
+
}
|
|
2884
|
+
const [camera, options] = [this.effectComposer.camera(), this.options()];
|
|
2885
|
+
return new SSAOEffect(camera, normalPass && !downSamplingPass ? normalPass.texture : null, {
|
|
2886
|
+
blendFunction: BlendFunction.MULTIPLY,
|
|
2887
|
+
samples: 30,
|
|
2888
|
+
rings: 4,
|
|
2889
|
+
distanceThreshold: 1.0,
|
|
2890
|
+
distanceFalloff: 0.0,
|
|
2891
|
+
rangeThreshold: 0.5,
|
|
2892
|
+
rangeFalloff: 0.1,
|
|
2893
|
+
luminanceInfluence: 0.9,
|
|
2894
|
+
radius: 20,
|
|
2895
|
+
bias: 0.5,
|
|
2896
|
+
intensity: 1.0,
|
|
2897
|
+
color: undefined,
|
|
2898
|
+
// @ts-expect-error - normalDepthBuffer is not in the types but is supported
|
|
2899
|
+
normalDepthBuffer: downSamplingPass ? downSamplingPass.texture : null,
|
|
2900
|
+
resolutionScale: 1,
|
|
2901
|
+
depthAwareUpsampling: true,
|
|
2902
|
+
...options,
|
|
2903
|
+
});
|
|
2904
|
+
}, ...(ngDevMode ? [{ debugName: "effect" }] : []));
|
|
2905
|
+
effect((onCleanup) => {
|
|
2906
|
+
const ssaoEffect = this.effect();
|
|
2907
|
+
if (!ssaoEffect)
|
|
2908
|
+
return;
|
|
2909
|
+
onCleanup(() => ssaoEffect.dispose());
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NgtpSSAO, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2913
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.6", type: NgtpSSAO, isStandalone: true, selector: "ngtp-ssao", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
2914
|
+
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
2915
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2916
|
+
}
|
|
2917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NgtpSSAO, decorators: [{
|
|
2918
|
+
type: Component,
|
|
2919
|
+
args: [{
|
|
2920
|
+
selector: 'ngtp-ssao',
|
|
2921
|
+
template: `
|
|
2922
|
+
<ngt-primitive *args="[effect()]" [dispose]="null" />
|
|
2923
|
+
`,
|
|
2924
|
+
imports: [NgtArgs],
|
|
2925
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
2926
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2927
|
+
}]
|
|
2928
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
2929
|
+
|
|
2930
2930
|
class NgtpTexture {
|
|
2931
2931
|
constructor() {
|
|
2932
2932
|
this.options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|