@flighthq/effects-wgpu 0.1.0
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/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/wgpuBloomEffect.d.ts +4 -0
- package/dist/wgpuBloomEffect.d.ts.map +1 -0
- package/dist/wgpuBloomEffect.js +72 -0
- package/dist/wgpuBloomEffect.js.map +1 -0
- package/dist/wgpuBokehDepthOfFieldEffect.d.ts +4 -0
- package/dist/wgpuBokehDepthOfFieldEffect.d.ts.map +1 -0
- package/dist/wgpuBokehDepthOfFieldEffect.js +51 -0
- package/dist/wgpuBokehDepthOfFieldEffect.js.map +1 -0
- package/dist/wgpuBrightnessContrastEffect.d.ts +4 -0
- package/dist/wgpuBrightnessContrastEffect.d.ts.map +1 -0
- package/dist/wgpuBrightnessContrastEffect.js +29 -0
- package/dist/wgpuBrightnessContrastEffect.js.map +1 -0
- package/dist/wgpuCameraMotionBlurEffect.d.ts +4 -0
- package/dist/wgpuCameraMotionBlurEffect.d.ts.map +1 -0
- package/dist/wgpuCameraMotionBlurEffect.js +49 -0
- package/dist/wgpuCameraMotionBlurEffect.js.map +1 -0
- package/dist/wgpuChannelMixerEffect.d.ts +4 -0
- package/dist/wgpuChannelMixerEffect.d.ts.map +1 -0
- package/dist/wgpuChannelMixerEffect.js +34 -0
- package/dist/wgpuChannelMixerEffect.js.map +1 -0
- package/dist/wgpuChromaticAberrationEffect.d.ts +4 -0
- package/dist/wgpuChromaticAberrationEffect.d.ts.map +1 -0
- package/dist/wgpuChromaticAberrationEffect.js +40 -0
- package/dist/wgpuChromaticAberrationEffect.js.map +1 -0
- package/dist/wgpuColorGradeEffect.d.ts +4 -0
- package/dist/wgpuColorGradeEffect.d.ts.map +1 -0
- package/dist/wgpuColorGradeEffect.js +52 -0
- package/dist/wgpuColorGradeEffect.js.map +1 -0
- package/dist/wgpuCrtEffect.d.ts +4 -0
- package/dist/wgpuCrtEffect.d.ts.map +1 -0
- package/dist/wgpuCrtEffect.js +60 -0
- package/dist/wgpuCrtEffect.js.map +1 -0
- package/dist/wgpuDirectionalBlurEffect.d.ts +4 -0
- package/dist/wgpuDirectionalBlurEffect.d.ts.map +1 -0
- package/dist/wgpuDirectionalBlurEffect.js +52 -0
- package/dist/wgpuDirectionalBlurEffect.js.map +1 -0
- package/dist/wgpuDisplacementEffect.d.ts +4 -0
- package/dist/wgpuDisplacementEffect.d.ts.map +1 -0
- package/dist/wgpuDisplacementEffect.js +44 -0
- package/dist/wgpuDisplacementEffect.js.map +1 -0
- package/dist/wgpuDitherEffect.d.ts +4 -0
- package/dist/wgpuDitherEffect.d.ts.map +1 -0
- package/dist/wgpuDitherEffect.js +45 -0
- package/dist/wgpuDitherEffect.js.map +1 -0
- package/dist/wgpuEffectProgramCache.d.ts +4 -0
- package/dist/wgpuEffectProgramCache.d.ts.map +1 -0
- package/dist/wgpuEffectProgramCache.js +26 -0
- package/dist/wgpuEffectProgramCache.js.map +1 -0
- package/dist/wgpuExposureEffect.d.ts +4 -0
- package/dist/wgpuExposureEffect.d.ts.map +1 -0
- package/dist/wgpuExposureEffect.js +28 -0
- package/dist/wgpuExposureEffect.js.map +1 -0
- package/dist/wgpuFilmGrainEffect.d.ts +4 -0
- package/dist/wgpuFilmGrainEffect.d.ts.map +1 -0
- package/dist/wgpuFilmGrainEffect.js +41 -0
- package/dist/wgpuFilmGrainEffect.js.map +1 -0
- package/dist/wgpuFxaaEffect.d.ts +4 -0
- package/dist/wgpuFxaaEffect.d.ts.map +1 -0
- package/dist/wgpuFxaaEffect.js +65 -0
- package/dist/wgpuFxaaEffect.js.map +1 -0
- package/dist/wgpuGlitchEffect.d.ts +4 -0
- package/dist/wgpuGlitchEffect.d.ts.map +1 -0
- package/dist/wgpuGlitchEffect.js +60 -0
- package/dist/wgpuGlitchEffect.js.map +1 -0
- package/dist/wgpuGodRaysEffect.d.ts +4 -0
- package/dist/wgpuGodRaysEffect.d.ts.map +1 -0
- package/dist/wgpuGodRaysEffect.js +67 -0
- package/dist/wgpuGodRaysEffect.js.map +1 -0
- package/dist/wgpuGrayscaleEffect.d.ts +4 -0
- package/dist/wgpuGrayscaleEffect.d.ts.map +1 -0
- package/dist/wgpuGrayscaleEffect.js +27 -0
- package/dist/wgpuGrayscaleEffect.js.map +1 -0
- package/dist/wgpuHalftoneEffect.d.ts +4 -0
- package/dist/wgpuHalftoneEffect.d.ts.map +1 -0
- package/dist/wgpuHalftoneEffect.js +45 -0
- package/dist/wgpuHalftoneEffect.js.map +1 -0
- package/dist/wgpuHueSaturationEffect.d.ts +4 -0
- package/dist/wgpuHueSaturationEffect.d.ts.map +1 -0
- package/dist/wgpuHueSaturationEffect.js +75 -0
- package/dist/wgpuHueSaturationEffect.js.map +1 -0
- package/dist/wgpuInvertEffect.d.ts +4 -0
- package/dist/wgpuInvertEffect.d.ts.map +1 -0
- package/dist/wgpuInvertEffect.js +26 -0
- package/dist/wgpuInvertEffect.js.map +1 -0
- package/dist/wgpuKuwaharaEffect.d.ts +4 -0
- package/dist/wgpuKuwaharaEffect.d.ts.map +1 -0
- package/dist/wgpuKuwaharaEffect.js +69 -0
- package/dist/wgpuKuwaharaEffect.js.map +1 -0
- package/dist/wgpuLensDirtEffect.d.ts +4 -0
- package/dist/wgpuLensDirtEffect.d.ts.map +1 -0
- package/dist/wgpuLensDirtEffect.js +51 -0
- package/dist/wgpuLensDirtEffect.js.map +1 -0
- package/dist/wgpuLensDistortionEffect.d.ts +4 -0
- package/dist/wgpuLensDistortionEffect.d.ts.map +1 -0
- package/dist/wgpuLensDistortionEffect.js +36 -0
- package/dist/wgpuLensDistortionEffect.js.map +1 -0
- package/dist/wgpuLensFlareEffect.d.ts +4 -0
- package/dist/wgpuLensFlareEffect.d.ts.map +1 -0
- package/dist/wgpuLensFlareEffect.js +61 -0
- package/dist/wgpuLensFlareEffect.js.map +1 -0
- package/dist/wgpuLiftGammaGainEffect.d.ts +4 -0
- package/dist/wgpuLiftGammaGainEffect.d.ts.map +1 -0
- package/dist/wgpuLiftGammaGainEffect.js +51 -0
- package/dist/wgpuLiftGammaGainEffect.js.map +1 -0
- package/dist/wgpuLookupTableGradeEffect.d.ts +4 -0
- package/dist/wgpuLookupTableGradeEffect.d.ts.map +1 -0
- package/dist/wgpuLookupTableGradeEffect.js +30 -0
- package/dist/wgpuLookupTableGradeEffect.js.map +1 -0
- package/dist/wgpuMotionBlurEffect.d.ts +4 -0
- package/dist/wgpuMotionBlurEffect.d.ts.map +1 -0
- package/dist/wgpuMotionBlurEffect.js +97 -0
- package/dist/wgpuMotionBlurEffect.js.map +1 -0
- package/dist/wgpuOutlineEffect.d.ts +4 -0
- package/dist/wgpuOutlineEffect.d.ts.map +1 -0
- package/dist/wgpuOutlineEffect.js +64 -0
- package/dist/wgpuOutlineEffect.js.map +1 -0
- package/dist/wgpuPixelateEffect.d.ts +4 -0
- package/dist/wgpuPixelateEffect.d.ts.map +1 -0
- package/dist/wgpuPixelateEffect.js +34 -0
- package/dist/wgpuPixelateEffect.js.map +1 -0
- package/dist/wgpuPosterizeEffect.d.ts +4 -0
- package/dist/wgpuPosterizeEffect.d.ts.map +1 -0
- package/dist/wgpuPosterizeEffect.js +27 -0
- package/dist/wgpuPosterizeEffect.js.map +1 -0
- package/dist/wgpuRadialBlurEffect.d.ts +4 -0
- package/dist/wgpuRadialBlurEffect.d.ts.map +1 -0
- package/dist/wgpuRadialBlurEffect.js +50 -0
- package/dist/wgpuRadialBlurEffect.js.map +1 -0
- package/dist/wgpuRenderEffectPipeline.d.ts +7 -0
- package/dist/wgpuRenderEffectPipeline.d.ts.map +1 -0
- package/dist/wgpuRenderEffectPipeline.js +106 -0
- package/dist/wgpuRenderEffectPipeline.js.map +1 -0
- package/dist/wgpuRenderEffectRegistrants.d.ts +9 -0
- package/dist/wgpuRenderEffectRegistrants.d.ts.map +1 -0
- package/dist/wgpuRenderEffectRegistrants.js +129 -0
- package/dist/wgpuRenderEffectRegistrants.js.map +1 -0
- package/dist/wgpuRenderEffectRegistry.d.ts +5 -0
- package/dist/wgpuRenderEffectRegistry.d.ts.map +1 -0
- package/dist/wgpuRenderEffectRegistry.js +25 -0
- package/dist/wgpuRenderEffectRegistry.js.map +1 -0
- package/dist/wgpuScanlinesEffect.d.ts +4 -0
- package/dist/wgpuScanlinesEffect.d.ts.map +1 -0
- package/dist/wgpuScanlinesEffect.js +32 -0
- package/dist/wgpuScanlinesEffect.js.map +1 -0
- package/dist/wgpuScreenSpaceFogEffect.d.ts +4 -0
- package/dist/wgpuScreenSpaceFogEffect.d.ts.map +1 -0
- package/dist/wgpuScreenSpaceFogEffect.js +47 -0
- package/dist/wgpuScreenSpaceFogEffect.js.map +1 -0
- package/dist/wgpuSepiaEffect.d.ts +4 -0
- package/dist/wgpuSepiaEffect.d.ts.map +1 -0
- package/dist/wgpuSepiaEffect.js +31 -0
- package/dist/wgpuSepiaEffect.js.map +1 -0
- package/dist/wgpuSharpenEffect.d.ts +4 -0
- package/dist/wgpuSharpenEffect.d.ts.map +1 -0
- package/dist/wgpuSharpenEffect.js +40 -0
- package/dist/wgpuSharpenEffect.js.map +1 -0
- package/dist/wgpuSketchEffect.d.ts +4 -0
- package/dist/wgpuSketchEffect.d.ts.map +1 -0
- package/dist/wgpuSketchEffect.js +51 -0
- package/dist/wgpuSketchEffect.js.map +1 -0
- package/dist/wgpuSmaaEffect.d.ts +4 -0
- package/dist/wgpuSmaaEffect.d.ts.map +1 -0
- package/dist/wgpuSmaaEffect.js +52 -0
- package/dist/wgpuSmaaEffect.js.map +1 -0
- package/dist/wgpuSsaoEffect.d.ts +4 -0
- package/dist/wgpuSsaoEffect.d.ts.map +1 -0
- package/dist/wgpuSsaoEffect.js +51 -0
- package/dist/wgpuSsaoEffect.js.map +1 -0
- package/dist/wgpuSsrEffect.d.ts +4 -0
- package/dist/wgpuSsrEffect.d.ts.map +1 -0
- package/dist/wgpuSsrEffect.js +28 -0
- package/dist/wgpuSsrEffect.js.map +1 -0
- package/dist/wgpuTaaEffect.d.ts +4 -0
- package/dist/wgpuTaaEffect.d.ts.map +1 -0
- package/dist/wgpuTaaEffect.js +27 -0
- package/dist/wgpuTaaEffect.js.map +1 -0
- package/dist/wgpuTiltShiftEffect.d.ts +4 -0
- package/dist/wgpuTiltShiftEffect.d.ts.map +1 -0
- package/dist/wgpuTiltShiftEffect.js +51 -0
- package/dist/wgpuTiltShiftEffect.js.map +1 -0
- package/dist/wgpuToneMapEffect.d.ts +4 -0
- package/dist/wgpuToneMapEffect.d.ts.map +1 -0
- package/dist/wgpuToneMapEffect.js +57 -0
- package/dist/wgpuToneMapEffect.js.map +1 -0
- package/dist/wgpuVignetteEffect.d.ts +4 -0
- package/dist/wgpuVignetteEffect.d.ts.map +1 -0
- package/dist/wgpuVignetteEffect.js +54 -0
- package/dist/wgpuVignetteEffect.js.map +1 -0
- package/dist/wgpuWhiteBalanceEffect.d.ts +4 -0
- package/dist/wgpuWhiteBalanceEffect.d.ts.map +1 -0
- package/dist/wgpuWhiteBalanceEffect.js +32 -0
- package/dist/wgpuWhiteBalanceEffect.js.map +1 -0
- package/package.json +42 -0
- package/src/wgpuBloomEffect.test.ts +13 -0
- package/src/wgpuBokehDepthOfFieldEffect.test.ts +16 -0
- package/src/wgpuBrightnessContrastEffect.test.ts +16 -0
- package/src/wgpuCameraMotionBlurEffect.test.ts +16 -0
- package/src/wgpuChannelMixerEffect.test.ts +13 -0
- package/src/wgpuChromaticAberrationEffect.test.ts +16 -0
- package/src/wgpuColorGradeEffect.test.ts +13 -0
- package/src/wgpuCrtEffect.test.ts +13 -0
- package/src/wgpuDirectionalBlurEffect.test.ts +13 -0
- package/src/wgpuDisplacementEffect.test.ts +13 -0
- package/src/wgpuDitherEffect.test.ts +13 -0
- package/src/wgpuEffectProgramCache.test.ts +7 -0
- package/src/wgpuExposureEffect.test.ts +13 -0
- package/src/wgpuFilmGrainEffect.test.ts +13 -0
- package/src/wgpuFxaaEffect.test.ts +13 -0
- package/src/wgpuGlitchEffect.test.ts +13 -0
- package/src/wgpuGodRaysEffect.test.ts +13 -0
- package/src/wgpuGrayscaleEffect.test.ts +13 -0
- package/src/wgpuHalftoneEffect.test.ts +13 -0
- package/src/wgpuHueSaturationEffect.test.ts +13 -0
- package/src/wgpuInvertEffect.test.ts +13 -0
- package/src/wgpuKuwaharaEffect.test.ts +13 -0
- package/src/wgpuLensDirtEffect.test.ts +13 -0
- package/src/wgpuLensDistortionEffect.test.ts +13 -0
- package/src/wgpuLensFlareEffect.test.ts +13 -0
- package/src/wgpuLiftGammaGainEffect.test.ts +13 -0
- package/src/wgpuLookupTableGradeEffect.test.ts +16 -0
- package/src/wgpuMotionBlurEffect.test.ts +13 -0
- package/src/wgpuOutlineEffect.test.ts +13 -0
- package/src/wgpuPixelateEffect.test.ts +13 -0
- package/src/wgpuPosterizeEffect.test.ts +13 -0
- package/src/wgpuRadialBlurEffect.test.ts +13 -0
- package/src/wgpuRenderEffectPipeline.test.ts +45 -0
- package/src/wgpuRenderEffectRegistrants.test.ts +122 -0
- package/src/wgpuRenderEffectRegistry.test.ts +40 -0
- package/src/wgpuScanlinesEffect.test.ts +13 -0
- package/src/wgpuScreenSpaceFogEffect.test.ts +13 -0
- package/src/wgpuSepiaEffect.test.ts +13 -0
- package/src/wgpuSharpenEffect.test.ts +13 -0
- package/src/wgpuSketchEffect.test.ts +13 -0
- package/src/wgpuSmaaEffect.test.ts +13 -0
- package/src/wgpuSsaoEffect.test.ts +13 -0
- package/src/wgpuSsrEffect.test.ts +13 -0
- package/src/wgpuTaaEffect.test.ts +13 -0
- package/src/wgpuTiltShiftEffect.test.ts +13 -0
- package/src/wgpuToneMapEffect.test.ts +13 -0
- package/src/wgpuVignetteEffect.test.ts +13 -0
- package/src/wgpuWhiteBalanceEffect.test.ts +13 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { drawWgpuFilterPass } from '@flighthq/filters-wgpu';
|
|
2
|
+
import { getWgpuEffectPipeline } from './wgpuEffectProgramCache';
|
|
3
|
+
// Tilt-shift: keep a horizontal focus band sharp and blur above and below it. The band is centered at
|
|
4
|
+
// `center` on Y with height `width`; blur strength ramps with distance outside the band. Blur is
|
|
5
|
+
// approximated by averaging a few neighbor taps using the pixel size from the resolution uniform.
|
|
6
|
+
export function applyTiltShiftEffectToWgpu(state, source, dest, effect) {
|
|
7
|
+
const center = effect.center ?? 0.5;
|
|
8
|
+
const width = effect.width ?? 0.3;
|
|
9
|
+
const blur = effect.blur ?? 4;
|
|
10
|
+
const pipeline = getWgpuEffectPipeline(state, 'lens.tiltShift', TILT_SHIFT_FRAGMENT_WGSL, 'replace');
|
|
11
|
+
drawWgpuFilterPass(state, source, dest, pipeline, (f32) => {
|
|
12
|
+
f32[0] = center;
|
|
13
|
+
f32[1] = width;
|
|
14
|
+
f32[2] = blur;
|
|
15
|
+
f32[4] = source.width;
|
|
16
|
+
f32[5] = source.height;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export const defaultWgpuTiltShiftEffectRunner = (ctx, effect) => {
|
|
20
|
+
applyTiltShiftEffectToWgpu(ctx.state, ctx.source, ctx.dest, effect);
|
|
21
|
+
};
|
|
22
|
+
// Slot layout: [0]=center, [1]=width, [2]=blur, [3]=pad, [4..5]=resolution (vec2 aligned to 16 bytes).
|
|
23
|
+
const TILT_SHIFT_FRAGMENT_WGSL = /* wgsl */ `
|
|
24
|
+
struct Uniforms {
|
|
25
|
+
u_center : f32,
|
|
26
|
+
u_width : f32,
|
|
27
|
+
u_blur : f32,
|
|
28
|
+
_pad0 : f32,
|
|
29
|
+
u_resolution : vec2f,
|
|
30
|
+
}
|
|
31
|
+
@group(0) @binding(0) var<uniform> uni : Uniforms;
|
|
32
|
+
@group(1) @binding(0) var tex : texture_2d<f32>;
|
|
33
|
+
@group(1) @binding(1) var smp : sampler;
|
|
34
|
+
|
|
35
|
+
@fragment
|
|
36
|
+
fn fs_main(@location(0) uv : vec2f) -> @location(0) vec4f {
|
|
37
|
+
let texel = vec2f(1.0) / uni.u_resolution;
|
|
38
|
+
let dist = abs(uv.y - uni.u_center);
|
|
39
|
+
let edge = uni.u_width * 0.5;
|
|
40
|
+
let amount = smoothstep(edge, edge + uni.u_width, dist);
|
|
41
|
+
let radius = amount * uni.u_blur;
|
|
42
|
+
var sum = vec4f(0.0);
|
|
43
|
+
var total = 0.0;
|
|
44
|
+
for (var i = -3; i <= 3; i = i + 1) {
|
|
45
|
+
let offset = vec2f(0.0, f32(i)) * radius * texel;
|
|
46
|
+
sum = sum + textureSampleLevel(tex, smp, uv + offset, 0.0);
|
|
47
|
+
total = total + 1.0;
|
|
48
|
+
}
|
|
49
|
+
return sum / total;
|
|
50
|
+
}`;
|
|
51
|
+
//# sourceMappingURL=wgpuTiltShiftEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuTiltShiftEffect.js","sourceRoot":"","sources":["../src/wgpuTiltShiftEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,sGAAsG;AACtG,iGAAiG;AACjG,kGAAkG;AAClG,MAAM,UAAU,0BAA0B,CACxC,KAAsB,EACtB,MAAkC,EAClC,IAAgC,EAChC,MAAiC;IAEjC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,SAAS,CAAC,CAAC;IACrG,kBAAkB,CAAC,KAAK,EAAE,MAA0B,EAAE,IAAwB,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAChG,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;QAChB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QACf,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACd,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;QACtB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACtF,0BAA0B,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAyB,CAAC,CAAC;AACzF,CAAC,CAAC;AAEF,uGAAuG;AACvG,MAAM,wBAAwB,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B1C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToneMapEffect, WgpuRenderEffectRunner, WgpuRenderState, WgpuRenderTarget } from '@flighthq/types';
|
|
2
|
+
export declare function applyToneMapEffectToWgpu(state: WgpuRenderState, source: Readonly<WgpuRenderTarget>, dest: Readonly<WgpuRenderTarget>, effect: Readonly<ToneMapEffect>): void;
|
|
3
|
+
export declare const defaultWgpuToneMapEffectRunner: WgpuRenderEffectRunner;
|
|
4
|
+
//# sourceMappingURL=wgpuToneMapEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuToneMapEffect.d.ts","sourceRoot":"","sources":["../src/wgpuToneMapEffect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOhH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAChC,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,GAC9B,IAAI,CASN;AAED,eAAO,MAAM,8BAA8B,EAAE,sBAE5C,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { drawWgpuFilterPass } from '@flighthq/filters-wgpu';
|
|
2
|
+
import { getWgpuEffectPipeline } from './wgpuEffectProgramCache';
|
|
3
|
+
// Tone map: compress HDR to displayable range via the selected operator. Single-pass reference recipe,
|
|
4
|
+
// the Wgpu mirror of effects-gl's applyToneMapEffectToGl. The operator selects a tonemap body
|
|
5
|
+
// that is compiled into the fragment once per state, keyed by operator name.
|
|
6
|
+
export function applyToneMapEffectToWgpu(state, source, dest, effect) {
|
|
7
|
+
const operator = effect.operator ?? 'aces';
|
|
8
|
+
const exposure = effect.exposure ?? 1;
|
|
9
|
+
const white = effect.white ?? 1;
|
|
10
|
+
const pipeline = getWgpuEffectPipeline(state, `toneMap.${operator}`, buildToneMapFragment(operator), 'replace');
|
|
11
|
+
drawWgpuFilterPass(state, source, dest, pipeline, (f32) => {
|
|
12
|
+
f32[0] = exposure;
|
|
13
|
+
f32[1] = white;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export const defaultWgpuToneMapEffectRunner = (ctx, effect) => {
|
|
17
|
+
applyToneMapEffectToWgpu(ctx.state, ctx.source, ctx.dest, effect);
|
|
18
|
+
};
|
|
19
|
+
function buildToneMapFragment(operator) {
|
|
20
|
+
return TONEMAP_FRAGMENT_HEAD + (TONEMAP_OPERATORS[operator] ?? TONEMAP_OPERATORS.aces) + TONEMAP_FRAGMENT_TAIL;
|
|
21
|
+
}
|
|
22
|
+
// Slots [0]=exposure, [1]=white; the operator body is spliced between head and tail. The struct's two
|
|
23
|
+
// scalars pad to a 16-byte boundary.
|
|
24
|
+
const TONEMAP_FRAGMENT_HEAD = /* wgsl */ `
|
|
25
|
+
struct Uniforms { u_exposure : f32, u_white : f32, _pad0 : f32, _pad1 : f32, }
|
|
26
|
+
@group(0) @binding(0) var<uniform> uni : Uniforms;
|
|
27
|
+
@group(1) @binding(0) var tex : texture_2d<f32>;
|
|
28
|
+
@group(1) @binding(1) var smp : sampler;
|
|
29
|
+
|
|
30
|
+
fn tonemap(x : vec3f) -> vec3f {`;
|
|
31
|
+
const TONEMAP_FRAGMENT_TAIL = /* wgsl */ `}
|
|
32
|
+
|
|
33
|
+
@fragment
|
|
34
|
+
fn fs_main(@location(0) uv : vec2f) -> @location(0) vec4f {
|
|
35
|
+
let c = textureSampleLevel(tex, smp, uv, 0.0);
|
|
36
|
+
let mapped = tonemap(c.rgb * uni.u_exposure);
|
|
37
|
+
return vec4f(clamp(mapped, vec3f(0.0), vec3f(1.0)), c.a);
|
|
38
|
+
}`;
|
|
39
|
+
const TONEMAP_OPERATORS = {
|
|
40
|
+
aces: `
|
|
41
|
+
let a = x * (2.51 * x + 0.03);
|
|
42
|
+
let b = x * (2.43 * x + 0.59) + 0.14;
|
|
43
|
+
return a / b;`,
|
|
44
|
+
reinhard: `
|
|
45
|
+
return x / (1.0 + x / (uni.u_white * uni.u_white));`,
|
|
46
|
+
filmic: `
|
|
47
|
+
let X = max(vec3f(0.0), x - 0.004);
|
|
48
|
+
return (X * (6.2 * X + 0.5)) / (X * (6.2 * X + 1.7) + 0.06);`,
|
|
49
|
+
uncharted2: `
|
|
50
|
+
let A = 0.15; let B = 0.50; let C = 0.10; let D = 0.20; let E = 0.02; let F = 0.30;
|
|
51
|
+
let v = ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F;
|
|
52
|
+
return v;`,
|
|
53
|
+
agx: `
|
|
54
|
+
let v = clamp((x - 0.004) / (1.0 + x), vec3f(0.0), vec3f(1.0));
|
|
55
|
+
return pow(v, vec3f(0.8));`,
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=wgpuToneMapEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuToneMapEffect.js","sourceRoot":"","sources":["../src/wgpuToneMapEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,uGAAuG;AACvG,8FAA8F;AAC9F,6EAA6E;AAC7E,MAAM,UAAU,wBAAwB,CACtC,KAAsB,EACtB,MAAkC,EAClC,IAAgC,EAChC,MAA+B;IAE/B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,WAAW,QAAQ,EAAE,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IAChH,kBAAkB,CAAC,KAAK,EAAE,MAA0B,EAAE,IAAwB,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAChG,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;QAClB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACpF,wBAAwB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAuB,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,OAAO,qBAAqB,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC;AACjH,CAAC;AAED,sGAAsG;AACtG,qCAAqC;AACrC,MAAM,qBAAqB,GAAG,UAAU,CAAC;;;;;;iCAMR,CAAC;AAElC,MAAM,qBAAqB,GAAG,UAAU,CAAC;;;;;;;EAOvC,CAAC;AAEH,MAAM,iBAAiB,GAA2B;IAChD,IAAI,EAAE;;;gBAGQ;IACd,QAAQ,EAAE;sDAC0C;IACpD,MAAM,EAAE;;+DAEqD;IAC7D,UAAU,EAAE;;;YAGF;IACV,GAAG,EAAE;;6BAEsB;CAC5B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VignetteEffect, WgpuRenderEffectRunner, WgpuRenderState, WgpuRenderTarget } from '@flighthq/types';
|
|
2
|
+
export declare function applyVignetteEffectToWgpu(state: WgpuRenderState, source: Readonly<WgpuRenderTarget>, dest: Readonly<WgpuRenderTarget>, effect: Readonly<VignetteEffect>): void;
|
|
3
|
+
export declare const defaultWgpuVignetteEffectRunner: WgpuRenderEffectRunner;
|
|
4
|
+
//# sourceMappingURL=wgpuVignetteEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuVignetteEffect.d.ts","sourceRoot":"","sources":["../src/wgpuVignetteEffect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASjH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAChC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,GAC/B,IAAI,CAmBN;AAED,eAAO,MAAM,+BAA+B,EAAE,sBAE7C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { drawWgpuFilterPass } from '@flighthq/filters-wgpu';
|
|
2
|
+
import { getWgpuEffectPipeline } from './wgpuEffectProgramCache';
|
|
3
|
+
// Vignette: darken toward the edges. Pixels inside `radius` stay full bright; beyond it, brightness
|
|
4
|
+
// falls off over `softness` and the color is blended toward the (unpacked) vignette color by intensity.
|
|
5
|
+
// Single-pass reference recipe, the Wgpu mirror of effects-gl's applyVignetteEffectToGl. The
|
|
6
|
+
// fragment works in centered coordinates (uv - 0.5) so radial math measures distance from the center;
|
|
7
|
+
// the packed RGBA color int is unpacked to normalized components in JS before upload.
|
|
8
|
+
export function applyVignetteEffectToWgpu(state, source, dest, effect) {
|
|
9
|
+
const intensity = effect.intensity ?? 1;
|
|
10
|
+
const radius = effect.radius ?? 0.75;
|
|
11
|
+
const softness = effect.softness ?? 0.45;
|
|
12
|
+
const color = effect.color ?? 0x000000ff;
|
|
13
|
+
const r = ((color >>> 24) & 0xff) / 255;
|
|
14
|
+
const g = ((color >>> 16) & 0xff) / 255;
|
|
15
|
+
const b = ((color >>> 8) & 0xff) / 255;
|
|
16
|
+
const a = (color & 0xff) / 255;
|
|
17
|
+
const pipeline = getWgpuEffectPipeline(state, 'lens.vignette', VIGNETTE_FRAGMENT_WGSL, 'replace');
|
|
18
|
+
drawWgpuFilterPass(state, source, dest, pipeline, (f32) => {
|
|
19
|
+
f32[0] = intensity;
|
|
20
|
+
f32[1] = radius;
|
|
21
|
+
f32[2] = softness;
|
|
22
|
+
f32[4] = r;
|
|
23
|
+
f32[5] = g;
|
|
24
|
+
f32[6] = b;
|
|
25
|
+
f32[7] = a;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export const defaultWgpuVignetteEffectRunner = (ctx, effect) => {
|
|
29
|
+
applyVignetteEffectToWgpu(ctx.state, ctx.source, ctx.dest, effect);
|
|
30
|
+
};
|
|
31
|
+
// Slot layout: [0]=intensity, [1]=radius, [2]=softness, [3]=pad, [4..7]=color rgba. The std140-style
|
|
32
|
+
// struct aligns the vec4 color to a 16-byte boundary, so the JS writes skip slot [3].
|
|
33
|
+
const VIGNETTE_FRAGMENT_WGSL = /* wgsl */ `
|
|
34
|
+
struct Uniforms {
|
|
35
|
+
u_intensity : f32,
|
|
36
|
+
u_radius : f32,
|
|
37
|
+
u_softness : f32,
|
|
38
|
+
_pad0 : f32,
|
|
39
|
+
u_color : vec4f,
|
|
40
|
+
}
|
|
41
|
+
@group(0) @binding(0) var<uniform> uni : Uniforms;
|
|
42
|
+
@group(1) @binding(0) var tex : texture_2d<f32>;
|
|
43
|
+
@group(1) @binding(1) var smp : sampler;
|
|
44
|
+
|
|
45
|
+
@fragment
|
|
46
|
+
fn fs_main(@location(0) uv : vec2f) -> @location(0) vec4f {
|
|
47
|
+
let c = textureSampleLevel(tex, smp, uv, 0.0);
|
|
48
|
+
let centered = uv - vec2f(0.5);
|
|
49
|
+
let dist = length(centered) * 1.41421356;
|
|
50
|
+
let vig = smoothstep(uni.u_radius, uni.u_radius - uni.u_softness, dist);
|
|
51
|
+
let darken = (1.0 - vig) * uni.u_intensity * uni.u_color.a;
|
|
52
|
+
return vec4f(mix(c.rgb, uni.u_color.rgb, darken), c.a);
|
|
53
|
+
}`;
|
|
54
|
+
//# sourceMappingURL=wgpuVignetteEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuVignetteEffect.js","sourceRoot":"","sources":["../src/wgpuVignetteEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,oGAAoG;AACpG,wGAAwG;AACxG,6FAA6F;AAC7F,sGAAsG;AACtG,sFAAsF;AACtF,MAAM,UAAU,yBAAyB,CACvC,KAAsB,EACtB,MAAkC,EAClC,IAAgC,EAChC,MAAgC;IAEhC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC;IACzC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IACvC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IAC/B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAC;IAClG,kBAAkB,CAAC,KAAK,EAAE,MAA0B,EAAE,IAAwB,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAChG,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;QACnB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;QAChB,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;QAClB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACrF,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAwB,CAAC,CAAC;AACvF,CAAC,CAAC;AAEF,qGAAqG;AACrG,sFAAsF;AACtF,MAAM,sBAAsB,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;EAoBxC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WgpuRenderEffectRunner, WgpuRenderState, WgpuRenderTarget, WhiteBalanceEffect } from '@flighthq/types';
|
|
2
|
+
export declare function applyWhiteBalanceEffectToWgpu(state: WgpuRenderState, source: Readonly<WgpuRenderTarget>, dest: Readonly<WgpuRenderTarget>, effect: Readonly<WhiteBalanceEffect>): void;
|
|
3
|
+
export declare const defaultWgpuWhiteBalanceEffectRunner: WgpuRenderEffectRunner;
|
|
4
|
+
//# sourceMappingURL=wgpuWhiteBalanceEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuWhiteBalanceEffect.d.ts","sourceRoot":"","sources":["../src/wgpuWhiteBalanceEffect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAChC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACnC,IAAI,CAQN;AAED,eAAO,MAAM,mCAAmC,EAAE,sBAEjD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { drawWgpuFilterPass } from '@flighthq/filters-wgpu';
|
|
2
|
+
import { getWgpuEffectPipeline } from './wgpuEffectProgramCache';
|
|
3
|
+
// White balance: warm/cool temperature and magenta/green tint channel shift.
|
|
4
|
+
export function applyWhiteBalanceEffectToWgpu(state, source, dest, effect) {
|
|
5
|
+
const temperature = effect.temperature ?? 0;
|
|
6
|
+
const tint = effect.tint ?? 0;
|
|
7
|
+
const pipeline = getWgpuEffectPipeline(state, 'colorGrade.whiteBalance', WHITE_BALANCE_FRAGMENT_WGSL, 'replace');
|
|
8
|
+
drawWgpuFilterPass(state, source, dest, pipeline, (f32) => {
|
|
9
|
+
f32[0] = temperature;
|
|
10
|
+
f32[1] = tint;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export const defaultWgpuWhiteBalanceEffectRunner = (ctx, effect) => {
|
|
14
|
+
applyWhiteBalanceEffectToWgpu(ctx.state, ctx.source, ctx.dest, effect);
|
|
15
|
+
};
|
|
16
|
+
// Slot layout: [0]=temperature, [1]=tint.
|
|
17
|
+
const WHITE_BALANCE_FRAGMENT_WGSL = /* wgsl */ `
|
|
18
|
+
struct Uniforms { u_temperature : f32, u_tint : f32, _pad0 : f32, _pad1 : f32, }
|
|
19
|
+
@group(0) @binding(0) var<uniform> uni : Uniforms;
|
|
20
|
+
@group(1) @binding(0) var tex : texture_2d<f32>;
|
|
21
|
+
@group(1) @binding(1) var smp : sampler;
|
|
22
|
+
|
|
23
|
+
@fragment
|
|
24
|
+
fn fs_main(@location(0) uv : vec2f) -> @location(0) vec4f {
|
|
25
|
+
let c = textureSampleLevel(tex, smp, uv, 0.0);
|
|
26
|
+
var rgb = c.rgb;
|
|
27
|
+
rgb.r += uni.u_temperature * 0.5;
|
|
28
|
+
rgb.b -= uni.u_temperature * 0.5;
|
|
29
|
+
rgb.g += uni.u_tint * 0.5;
|
|
30
|
+
return vec4f(clamp(rgb, vec3f(0.0), vec3f(1.0)), c.a);
|
|
31
|
+
}`;
|
|
32
|
+
//# sourceMappingURL=wgpuWhiteBalanceEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wgpuWhiteBalanceEffect.js","sourceRoot":"","sources":["../src/wgpuWhiteBalanceEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,6EAA6E;AAC7E,MAAM,UAAU,6BAA6B,CAC3C,KAAsB,EACtB,MAAkC,EAClC,IAAgC,EAChC,MAAoC;IAEpC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,SAAS,CAAC,CAAC;IACjH,kBAAkB,CAAC,KAAK,EAAE,MAA0B,EAAE,IAAwB,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAChG,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;QACrB,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,mCAAmC,GAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACzF,6BAA6B,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAA4B,CAAC,CAAC;AAC/F,CAAC,CAAC;AAEF,0CAA0C;AAC1C,MAAM,2BAA2B,GAAG,UAAU,CAAC;;;;;;;;;;;;;;EAc7C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flighthq/effects-wgpu",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"src/**/*.test.ts",
|
|
16
|
+
"!dist/**/*.test.js",
|
|
17
|
+
"!dist/**/*.test.d.ts",
|
|
18
|
+
"!dist/**/*.test.js.map",
|
|
19
|
+
"!dist/**/*.test.d.ts.map"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -b",
|
|
23
|
+
"clean": "tsc -b --clean",
|
|
24
|
+
"test": "vitest run --config vitest.config.ts",
|
|
25
|
+
"test:watch": "vitest --watch --config vitest.config.ts",
|
|
26
|
+
"prepack": "npm run clean && npm run clean:dist && npm run build",
|
|
27
|
+
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@flighthq/effects": "0.1.0",
|
|
31
|
+
"@flighthq/filters": "0.1.0",
|
|
32
|
+
"@flighthq/filters-wgpu": "0.1.0",
|
|
33
|
+
"@flighthq/geometry": "0.1.0",
|
|
34
|
+
"@flighthq/render-wgpu": "0.1.0",
|
|
35
|
+
"@flighthq/types": "0.1.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"typescript": "^5.3.0"
|
|
39
|
+
},
|
|
40
|
+
"description": "WebGPU shader recipes for render effects (substrate-agnostic post-process pipeline)",
|
|
41
|
+
"sideEffects": false
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyBloomEffectToWgpu, defaultWgpuBloomEffectRunner } from './wgpuBloomEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyBloomEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyBloomEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuBloomEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuBloomEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyBokehDepthOfFieldEffectToWgpu,
|
|
3
|
+
defaultWgpuBokehDepthOfFieldEffectRunner,
|
|
4
|
+
} from './wgpuBokehDepthOfFieldEffect';
|
|
5
|
+
|
|
6
|
+
describe('applyBokehDepthOfFieldEffectToWgpu', () => {
|
|
7
|
+
it('is a function', () => {
|
|
8
|
+
expect(typeof applyBokehDepthOfFieldEffectToWgpu).toBe('function');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('defaultWgpuBokehDepthOfFieldEffectRunner', () => {
|
|
13
|
+
it('is a function', () => {
|
|
14
|
+
expect(typeof defaultWgpuBokehDepthOfFieldEffectRunner).toBe('function');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyBrightnessContrastEffectToWgpu,
|
|
3
|
+
defaultWgpuBrightnessContrastEffectRunner,
|
|
4
|
+
} from './wgpuBrightnessContrastEffect';
|
|
5
|
+
|
|
6
|
+
describe('applyBrightnessContrastEffectToWgpu', () => {
|
|
7
|
+
it('is a function', () => {
|
|
8
|
+
expect(typeof applyBrightnessContrastEffectToWgpu).toBe('function');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('defaultWgpuBrightnessContrastEffectRunner', () => {
|
|
13
|
+
it('is a function', () => {
|
|
14
|
+
expect(typeof defaultWgpuBrightnessContrastEffectRunner).toBe('function');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyCameraMotionBlurEffectToWgpu,
|
|
3
|
+
defaultWgpuCameraMotionBlurEffectRunner,
|
|
4
|
+
} from './wgpuCameraMotionBlurEffect';
|
|
5
|
+
|
|
6
|
+
describe('applyCameraMotionBlurEffectToWgpu', () => {
|
|
7
|
+
it('is a function', () => {
|
|
8
|
+
expect(typeof applyCameraMotionBlurEffectToWgpu).toBe('function');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('defaultWgpuCameraMotionBlurEffectRunner', () => {
|
|
13
|
+
it('is a function', () => {
|
|
14
|
+
expect(typeof defaultWgpuCameraMotionBlurEffectRunner).toBe('function');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyChannelMixerEffectToWgpu, defaultWgpuChannelMixerEffectRunner } from './wgpuChannelMixerEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyChannelMixerEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyChannelMixerEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuChannelMixerEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuChannelMixerEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyChromaticAberrationEffectToWgpu,
|
|
3
|
+
defaultWgpuChromaticAberrationEffectRunner,
|
|
4
|
+
} from './wgpuChromaticAberrationEffect';
|
|
5
|
+
|
|
6
|
+
describe('applyChromaticAberrationEffectToWgpu', () => {
|
|
7
|
+
it('is a function', () => {
|
|
8
|
+
expect(typeof applyChromaticAberrationEffectToWgpu).toBe('function');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('defaultWgpuChromaticAberrationEffectRunner', () => {
|
|
13
|
+
it('is a function', () => {
|
|
14
|
+
expect(typeof defaultWgpuChromaticAberrationEffectRunner).toBe('function');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyColorGradeEffectToWgpu, defaultWgpuColorGradeEffectRunner } from './wgpuColorGradeEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyColorGradeEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyColorGradeEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuColorGradeEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuColorGradeEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyCrtEffectToWgpu, defaultWgpuCrtEffectRunner } from './wgpuCrtEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyCrtEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyCrtEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuCrtEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuCrtEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyDirectionalBlurEffectToWgpu, defaultWgpuDirectionalBlurEffectRunner } from './wgpuDirectionalBlurEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyDirectionalBlurEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyDirectionalBlurEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuDirectionalBlurEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuDirectionalBlurEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyDisplacementEffectToWgpu, defaultWgpuDisplacementEffectRunner } from './wgpuDisplacementEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyDisplacementEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyDisplacementEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuDisplacementEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuDisplacementEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyDitherEffectToWgpu, defaultWgpuDitherEffectRunner } from './wgpuDitherEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyDitherEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyDitherEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuDitherEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuDitherEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyExposureEffectToWgpu, defaultWgpuExposureEffectRunner } from './wgpuExposureEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyExposureEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyExposureEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuExposureEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuExposureEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyFilmGrainEffectToWgpu, defaultWgpuFilmGrainEffectRunner } from './wgpuFilmGrainEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyFilmGrainEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyFilmGrainEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuFilmGrainEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuFilmGrainEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyFxaaEffectToWgpu, defaultWgpuFxaaEffectRunner } from './wgpuFxaaEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyFxaaEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyFxaaEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuFxaaEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuFxaaEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyGlitchEffectToWgpu, defaultWgpuGlitchEffectRunner } from './wgpuGlitchEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyGlitchEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyGlitchEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuGlitchEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuGlitchEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyGodRaysEffectToWgpu, defaultWgpuGodRaysEffectRunner } from './wgpuGodRaysEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyGodRaysEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyGodRaysEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuGodRaysEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuGodRaysEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyGrayscaleEffectToWgpu, defaultWgpuGrayscaleEffectRunner } from './wgpuGrayscaleEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyGrayscaleEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyGrayscaleEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuGrayscaleEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuGrayscaleEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyHalftoneEffectToWgpu, defaultWgpuHalftoneEffectRunner } from './wgpuHalftoneEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyHalftoneEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyHalftoneEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuHalftoneEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuHalftoneEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyHueSaturationEffectToWgpu, defaultWgpuHueSaturationEffectRunner } from './wgpuHueSaturationEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyHueSaturationEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyHueSaturationEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuHueSaturationEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuHueSaturationEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyInvertEffectToWgpu, defaultWgpuInvertEffectRunner } from './wgpuInvertEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyInvertEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyInvertEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuInvertEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuInvertEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyKuwaharaEffectToWgpu, defaultWgpuKuwaharaEffectRunner } from './wgpuKuwaharaEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyKuwaharaEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyKuwaharaEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuKuwaharaEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuKuwaharaEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyLensDirtEffectToWgpu, defaultWgpuLensDirtEffectRunner } from './wgpuLensDirtEffect';
|
|
2
|
+
|
|
3
|
+
describe('applyLensDirtEffectToWgpu', () => {
|
|
4
|
+
it('is a function', () => {
|
|
5
|
+
expect(typeof applyLensDirtEffectToWgpu).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('defaultWgpuLensDirtEffectRunner', () => {
|
|
10
|
+
it('is a function', () => {
|
|
11
|
+
expect(typeof defaultWgpuLensDirtEffectRunner).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
});
|