shaders 2.2.42 → 2.2.44
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/core/WebcamTexture-D4Uv7Plz.js +168 -0
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -168
- package/dist/core/registry.d.ts +10 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +166 -0
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/WebcamTexture/index.d.ts +21 -0
- package/dist/core/shaders/WebcamTexture/index.d.ts.map +1 -0
- package/dist/core/shaders/WebcamTexture/index.js +2 -0
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/react/AngularBlur.js +144 -0
- package/dist/react/Ascii.js +144 -0
- package/dist/react/Beam.js +144 -0
- package/dist/react/Blob.js +144 -0
- package/dist/react/Blur.js +144 -0
- package/dist/react/BrightnessContrast.js +144 -0
- package/dist/react/Bulge.js +144 -0
- package/dist/react/CRTScreen.js +144 -0
- package/dist/react/ChannelBlur.js +144 -0
- package/dist/react/Checkerboard.js +144 -0
- package/dist/react/ChromaFlow.js +144 -0
- package/dist/react/ChromaticAberration.js +144 -0
- package/dist/react/Circle.js +144 -0
- package/dist/react/CursorTrail.js +144 -0
- package/dist/react/DiffuseBlur.js +144 -0
- package/dist/react/Dither.js +144 -0
- package/dist/react/DotGrid.js +144 -0
- package/dist/react/Duotone.js +144 -0
- package/dist/react/FilmGrain.js +144 -0
- package/dist/react/FloatingParticles.js +144 -0
- package/dist/react/GlassTiles.js +144 -0
- package/dist/react/Glow.js +144 -0
- package/dist/react/Godrays.js +144 -0
- package/dist/react/Grayscale.js +144 -0
- package/dist/react/Grid.js +144 -0
- package/dist/react/GridDistortion.js +144 -0
- package/dist/react/Group.js +144 -0
- package/dist/react/Halftone.js +144 -0
- package/dist/react/HueShift.js +144 -0
- package/dist/react/ImageTexture.js +144 -0
- package/dist/react/Invert.js +144 -0
- package/dist/react/LinearBlur.js +144 -0
- package/dist/react/LinearGradient.js +144 -0
- package/dist/react/Liquify.js +144 -0
- package/dist/react/Perspective.js +144 -0
- package/dist/react/Pixelate.js +144 -0
- package/dist/react/PolarCoordinates.js +144 -0
- package/dist/react/Posterize.js +144 -0
- package/dist/react/ProgressiveBlur.js +144 -0
- package/dist/react/RadialGradient.js +144 -0
- package/dist/react/RectangularCoordinates.js +144 -0
- package/dist/react/Ripples.js +144 -0
- package/dist/react/Saturation.js +144 -0
- package/dist/react/Shader.js +166 -0
- package/dist/react/Sharpness.js +144 -0
- package/dist/react/Shatter.js +144 -0
- package/dist/react/SimplexNoise.js +144 -0
- package/dist/react/SineWave.js +144 -0
- package/dist/react/SolidColor.js +144 -0
- package/dist/react/Spherize.js +144 -0
- package/dist/react/Spiral.js +144 -0
- package/dist/react/Strands.js +144 -0
- package/dist/react/Stretch.js +144 -0
- package/dist/react/Stripes.js +144 -0
- package/dist/react/Swirl.js +144 -0
- package/dist/react/TiltShift.js +144 -0
- package/dist/react/Tint.js +144 -0
- package/dist/react/Tritone.js +144 -0
- package/dist/react/Twirl.js +144 -0
- package/dist/react/Vibrance.js +144 -0
- package/dist/react/WaveDistortion.js +144 -0
- package/dist/react/WebcamTexture.js +144 -0
- package/dist/react/ZoomBlur.js +144 -0
- package/dist/react/components/WebcamTexture.d.ts +31 -0
- package/dist/react/components/WebcamTexture.d.ts.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +65 -8646
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +392 -1
- package/dist/registry.js +91 -0
- package/dist/solid/components/AngularBlur.js +148 -0
- package/dist/solid/components/Ascii.js +148 -0
- package/dist/solid/components/Beam.js +148 -0
- package/dist/solid/components/Blob.js +148 -0
- package/dist/solid/components/Blur.js +148 -0
- package/dist/solid/components/BrightnessContrast.js +148 -0
- package/dist/solid/components/Bulge.js +148 -0
- package/dist/solid/components/CRTScreen.js +148 -0
- package/dist/solid/components/ChannelBlur.js +148 -0
- package/dist/solid/components/Checkerboard.js +148 -0
- package/dist/solid/components/ChromaFlow.js +148 -0
- package/dist/solid/components/ChromaticAberration.js +148 -0
- package/dist/solid/components/Circle.js +148 -0
- package/dist/solid/components/CursorTrail.js +148 -0
- package/dist/solid/components/DiffuseBlur.js +148 -0
- package/dist/solid/components/Dither.js +148 -0
- package/dist/solid/components/DotGrid.js +148 -0
- package/dist/solid/components/Duotone.js +148 -0
- package/dist/solid/components/FilmGrain.js +148 -0
- package/dist/solid/components/FloatingParticles.js +148 -0
- package/dist/solid/components/GlassTiles.js +148 -0
- package/dist/solid/components/Glow.js +148 -0
- package/dist/solid/components/Godrays.js +148 -0
- package/dist/solid/components/Grayscale.js +148 -0
- package/dist/solid/components/Grid.js +148 -0
- package/dist/solid/components/GridDistortion.js +148 -0
- package/dist/solid/components/Group.js +148 -0
- package/dist/solid/components/Halftone.js +148 -0
- package/dist/solid/components/HueShift.js +148 -0
- package/dist/solid/components/ImageTexture.js +148 -0
- package/dist/solid/components/Invert.js +148 -0
- package/dist/solid/components/LinearBlur.js +148 -0
- package/dist/solid/components/LinearGradient.js +148 -0
- package/dist/solid/components/Liquify.js +148 -0
- package/dist/solid/components/Perspective.js +148 -0
- package/dist/solid/components/Pixelate.js +148 -0
- package/dist/solid/components/PolarCoordinates.js +148 -0
- package/dist/solid/components/Posterize.js +148 -0
- package/dist/solid/components/ProgressiveBlur.js +148 -0
- package/dist/solid/components/RadialGradient.js +148 -0
- package/dist/solid/components/RectangularCoordinates.js +148 -0
- package/dist/solid/components/Ripples.js +148 -0
- package/dist/solid/components/Saturation.js +148 -0
- package/dist/solid/components/Sharpness.js +148 -0
- package/dist/solid/components/Shatter.js +148 -0
- package/dist/solid/components/SimplexNoise.js +148 -0
- package/dist/solid/components/SineWave.js +148 -0
- package/dist/solid/components/SolidColor.js +148 -0
- package/dist/solid/components/Spherize.js +148 -0
- package/dist/solid/components/Spiral.js +148 -0
- package/dist/solid/components/Strands.js +148 -0
- package/dist/solid/components/Stretch.js +148 -0
- package/dist/solid/components/Stripes.js +148 -0
- package/dist/solid/components/Swirl.js +148 -0
- package/dist/solid/components/TiltShift.js +148 -0
- package/dist/solid/components/Tint.js +148 -0
- package/dist/solid/components/Tritone.js +148 -0
- package/dist/solid/components/Twirl.js +148 -0
- package/dist/solid/components/Vibrance.js +148 -0
- package/dist/solid/components/WaveDistortion.js +148 -0
- package/dist/solid/components/WebcamTexture.d.ts +28 -0
- package/dist/solid/components/WebcamTexture.d.ts.map +1 -0
- package/dist/solid/components/WebcamTexture.js +148 -0
- package/dist/solid/components/ZoomBlur.js +148 -0
- package/dist/solid/engine/Shader.js +189 -0
- package/dist/solid/index.d.ts +1 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +126 -8847
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +66 -414
- package/dist/svelte/components/WebcamTexture.svelte.d.ts +19 -0
- package/dist/svelte/generatePresetCode-CtXcoyI0.js +393 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +115 -4
- package/dist/svelte/utils/generatePresetCode.js +1 -1
- package/dist/vue/AngularBlur.js +3 -0
- package/dist/vue/AngularBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Ascii.js +3 -0
- package/dist/vue/Ascii.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Beam.js +3 -0
- package/dist/vue/Beam.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Blob.js +3 -0
- package/dist/vue/Blob.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/vue/Blur.js +3 -0
- package/dist/vue/Blur.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/BrightnessContrast.js +3 -0
- package/dist/vue/BrightnessContrast.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Bulge.js +3 -0
- package/dist/vue/Bulge.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/CRTScreen.js +3 -0
- package/dist/vue/CRTScreen.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/ChannelBlur.js +3 -0
- package/dist/vue/ChannelBlur.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Checkerboard.js +3 -0
- package/dist/vue/Checkerboard.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/ChromaFlow.js +3 -0
- package/dist/vue/ChromaFlow.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/vue/ChromaticAberration.js +3 -0
- package/dist/vue/ChromaticAberration.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Circle.js +3 -0
- package/dist/vue/Circle.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/CursorTrail.js +3 -0
- package/dist/vue/CursorTrail.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/DiffuseBlur.js +3 -0
- package/dist/vue/DiffuseBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Dither.js +3 -0
- package/dist/vue/Dither.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/DotGrid.js +3 -0
- package/dist/vue/DotGrid.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Duotone.js +3 -0
- package/dist/vue/Duotone.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/FilmGrain.js +3 -0
- package/dist/vue/FilmGrain.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/FloatingParticles.js +3 -0
- package/dist/vue/FloatingParticles.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/vue/GlassTiles.js +3 -0
- package/dist/vue/GlassTiles.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Glow.js +3 -0
- package/dist/vue/Glow.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Godrays.js +3 -0
- package/dist/vue/Godrays.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Grayscale.js +3 -0
- package/dist/vue/Grayscale.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/vue/Grid.js +3 -0
- package/dist/vue/Grid.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/GridDistortion.js +3 -0
- package/dist/vue/GridDistortion.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/Group.js +3 -0
- package/dist/vue/Group.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/vue/Halftone.js +3 -0
- package/dist/vue/Halftone.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/HueShift.js +3 -0
- package/dist/vue/HueShift.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/ImageTexture.js +3 -0
- package/dist/vue/ImageTexture.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Invert.js +3 -0
- package/dist/vue/Invert.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/vue/LinearBlur.js +3 -0
- package/dist/vue/LinearBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/LinearGradient.js +3 -0
- package/dist/vue/LinearGradient.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Liquify.js +3 -0
- package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Perspective.js +3 -0
- package/dist/vue/Perspective.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Pixelate.js +3 -0
- package/dist/vue/Pixelate.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/PolarCoordinates.js +3 -0
- package/dist/vue/PolarCoordinates.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Posterize.js +3 -0
- package/dist/vue/Posterize.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/ProgressiveBlur.js +3 -0
- package/dist/vue/ProgressiveBlur.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/RadialGradient.js +3 -0
- package/dist/vue/RadialGradient.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/RectangularCoordinates.js +3 -0
- package/dist/vue/RectangularCoordinates.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Ripples.js +3 -0
- package/dist/vue/Ripples.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/vue/Saturation.js +3 -0
- package/dist/vue/Saturation.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/Shader.js +3 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +153 -0
- package/dist/vue/Sharpness.js +3 -0
- package/dist/vue/Sharpness.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/Shatter.js +3 -0
- package/dist/vue/Shatter.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/SimplexNoise.js +3 -0
- package/dist/vue/SimplexNoise.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/SineWave.js +3 -0
- package/dist/vue/SineWave.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/vue/SolidColor.js +3 -0
- package/dist/vue/SolidColor.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/Spherize.js +3 -0
- package/dist/vue/Spherize.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Spiral.js +3 -0
- package/dist/vue/Spiral.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Strands.js +3 -0
- package/dist/vue/Strands.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Stretch.js +3 -0
- package/dist/vue/Stretch.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Stripes.js +3 -0
- package/dist/vue/Stripes.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Swirl.js +3 -0
- package/dist/vue/Swirl.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/TiltShift.js +3 -0
- package/dist/vue/TiltShift.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Tint.js +3 -0
- package/dist/vue/Tint.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Tritone.js +3 -0
- package/dist/vue/Tritone.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Twirl.js +3 -0
- package/dist/vue/Twirl.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Vibrance.js +3 -0
- package/dist/vue/Vibrance.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/WaveDistortion.js +3 -0
- package/dist/vue/WaveDistortion.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/WebcamTexture.js +3 -0
- package/dist/vue/WebcamTexture.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/ZoomBlur.js +3 -0
- package/dist/vue/ZoomBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/components/WebcamTexture.vue.d.ts +57 -0
- package/dist/vue/components/WebcamTexture.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +65 -7749
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +391 -1
- package/package.json +9 -1
- package/dist/react/generatePresetCode-BrkW1bEe.js +0 -741
- package/dist/svelte/generatePresetCode-bx7z5wvC.js +0 -741
- package/dist/vue/generatePresetCode-_7ZzqQPH.js +0 -740
- /package/dist/core/{ZoomBlur-CTrw7HxX.js → ZoomBlur-CIkkDBIo.js} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { SRGBColorSpace, VideoTexture } from "three/webgpu";
|
|
2
|
+
import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
|
+
const componentDefinition = {
|
|
4
|
+
name: "WebcamTexture",
|
|
5
|
+
category: "Base Layers",
|
|
6
|
+
description: "Display a live webcam feed with customizable object-fit modes",
|
|
7
|
+
props: {
|
|
8
|
+
objectFit: {
|
|
9
|
+
default: "cover",
|
|
10
|
+
description: "How the webcam feed should be sized within the viewport",
|
|
11
|
+
transform: (value) => {
|
|
12
|
+
return {
|
|
13
|
+
"cover": 0,
|
|
14
|
+
"contain": 1,
|
|
15
|
+
"fill": 2,
|
|
16
|
+
"scale-down": 3,
|
|
17
|
+
"none": 4
|
|
18
|
+
}[value] ?? 0;
|
|
19
|
+
},
|
|
20
|
+
ui: {
|
|
21
|
+
type: "select",
|
|
22
|
+
options: [
|
|
23
|
+
{
|
|
24
|
+
label: "Cover",
|
|
25
|
+
value: "cover"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "Contain",
|
|
29
|
+
value: "contain"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Fill",
|
|
33
|
+
value: "fill"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Scale Down",
|
|
37
|
+
value: "scale-down"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "None",
|
|
41
|
+
value: "none"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
label: "Object Fit"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
mirror: {
|
|
48
|
+
default: true,
|
|
49
|
+
description: "Mirror the webcam feed horizontally (selfie mode)",
|
|
50
|
+
ui: {
|
|
51
|
+
type: "checkbox",
|
|
52
|
+
label: "Mirror"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
fragmentNode: ({ uniforms, onCleanup }) => {
|
|
57
|
+
const baseUV = screenUV;
|
|
58
|
+
let mediaStream = null;
|
|
59
|
+
let videoElement = null;
|
|
60
|
+
let videoTexture = null;
|
|
61
|
+
let isInitialized = false;
|
|
62
|
+
let isDisposed = false;
|
|
63
|
+
const videoAspectUniform = uniform(1);
|
|
64
|
+
const videoWidthUniform = uniform(640);
|
|
65
|
+
const videoHeightUniform = uniform(480);
|
|
66
|
+
const placeholderVideo = document.createElement("video");
|
|
67
|
+
placeholderVideo.playsInline = true;
|
|
68
|
+
placeholderVideo.muted = true;
|
|
69
|
+
videoTexture = new VideoTexture(placeholderVideo);
|
|
70
|
+
videoTexture.colorSpace = SRGBColorSpace;
|
|
71
|
+
const textureNode = texture(videoTexture);
|
|
72
|
+
const startWebcam = async () => {
|
|
73
|
+
if (isInitialized || isDisposed) return;
|
|
74
|
+
try {
|
|
75
|
+
mediaStream = await navigator.mediaDevices.getUserMedia({
|
|
76
|
+
video: {
|
|
77
|
+
width: { ideal: 1280 },
|
|
78
|
+
height: { ideal: 720 },
|
|
79
|
+
facingMode: "user"
|
|
80
|
+
},
|
|
81
|
+
audio: false
|
|
82
|
+
});
|
|
83
|
+
if (isDisposed) {
|
|
84
|
+
mediaStream.getTracks().forEach((track) => track.stop());
|
|
85
|
+
mediaStream = null;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
videoElement = document.createElement("video");
|
|
89
|
+
videoElement.srcObject = mediaStream;
|
|
90
|
+
videoElement.playsInline = true;
|
|
91
|
+
videoElement.muted = true;
|
|
92
|
+
await new Promise((resolve, reject) => {
|
|
93
|
+
if (!videoElement) return reject(/* @__PURE__ */ new Error("Video element not created"));
|
|
94
|
+
videoElement.onloadedmetadata = () => {
|
|
95
|
+
resolve();
|
|
96
|
+
};
|
|
97
|
+
videoElement.onerror = () => {
|
|
98
|
+
reject(/* @__PURE__ */ new Error("Failed to load video metadata"));
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
if (isDisposed) return;
|
|
102
|
+
await videoElement.play();
|
|
103
|
+
if (isDisposed) return;
|
|
104
|
+
const width = videoElement.videoWidth || 640;
|
|
105
|
+
const height = videoElement.videoHeight || 480;
|
|
106
|
+
videoAspectUniform.value = width / height;
|
|
107
|
+
videoWidthUniform.value = width;
|
|
108
|
+
videoHeightUniform.value = height;
|
|
109
|
+
if (videoTexture) videoTexture.dispose();
|
|
110
|
+
videoTexture = new VideoTexture(videoElement);
|
|
111
|
+
videoTexture.colorSpace = SRGBColorSpace;
|
|
112
|
+
textureNode.value = videoTexture;
|
|
113
|
+
isInitialized = true;
|
|
114
|
+
console.log(`[WebcamTexture] Webcam started: ${width}x${height}`);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (error instanceof DOMException) if (error.name === "NotAllowedError") console.error("[WebcamTexture] Camera permission denied by user");
|
|
117
|
+
else if (error.name === "NotFoundError") console.error("[WebcamTexture] No camera found on this device");
|
|
118
|
+
else if (error.name === "NotReadableError") console.error("[WebcamTexture] Camera is already in use by another application");
|
|
119
|
+
else console.error("[WebcamTexture] Camera error:", error.message);
|
|
120
|
+
else console.error("[WebcamTexture] Failed to start webcam:", error);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
startWebcam();
|
|
124
|
+
onCleanup(() => {
|
|
125
|
+
isDisposed = true;
|
|
126
|
+
if (mediaStream) {
|
|
127
|
+
mediaStream.getTracks().forEach((track) => track.stop());
|
|
128
|
+
mediaStream = null;
|
|
129
|
+
}
|
|
130
|
+
if (videoTexture) {
|
|
131
|
+
videoTexture.dispose();
|
|
132
|
+
videoTexture = null;
|
|
133
|
+
}
|
|
134
|
+
if (videoElement) {
|
|
135
|
+
videoElement.srcObject = null;
|
|
136
|
+
videoElement = null;
|
|
137
|
+
}
|
|
138
|
+
placeholderVideo.srcObject = null;
|
|
139
|
+
isInitialized = false;
|
|
140
|
+
});
|
|
141
|
+
const uv$1 = baseUV;
|
|
142
|
+
const viewportAspect = viewportSize.x.div(viewportSize.y);
|
|
143
|
+
const objectFitMode = uniforms.objectFit.uniform;
|
|
144
|
+
const coverScale = max(viewportAspect.div(videoAspectUniform), float(1));
|
|
145
|
+
const coverUVScale = vec2(videoAspectUniform.div(viewportAspect).mul(coverScale), coverScale);
|
|
146
|
+
const containScale = min(viewportAspect.div(videoAspectUniform), float(1));
|
|
147
|
+
const containUVScale = vec2(videoAspectUniform.div(viewportAspect).mul(containScale), containScale);
|
|
148
|
+
const fillUVScale = vec2(1, 1);
|
|
149
|
+
const scaleDownScale = min(min(viewportAspect.div(videoAspectUniform), float(1)), min(viewportSize.x.div(videoWidthUniform), viewportSize.y.div(videoHeightUniform)));
|
|
150
|
+
const scaleDownUVScale = vec2(videoAspectUniform.div(viewportAspect).mul(scaleDownScale), scaleDownScale);
|
|
151
|
+
const noneScale = min(viewportSize.x.div(videoWidthUniform), viewportSize.y.div(videoHeightUniform));
|
|
152
|
+
const noneUVScale = vec2(videoAspectUniform.div(viewportAspect).mul(noneScale), noneScale);
|
|
153
|
+
const isCover = step(objectFitMode, float(.5));
|
|
154
|
+
const isContain = step(float(.5), objectFitMode).mul(step(objectFitMode, float(1.5)));
|
|
155
|
+
const isFill = step(float(1.5), objectFitMode).mul(step(objectFitMode, float(2.5)));
|
|
156
|
+
const isScaleDown = step(float(2.5), objectFitMode).mul(step(objectFitMode, float(3.5)));
|
|
157
|
+
const isNone = step(float(3.5), objectFitMode);
|
|
158
|
+
const uvScale = vec2(0).add(coverUVScale.mul(isCover)).add(containUVScale.mul(isContain)).add(fillUVScale.mul(isFill)).add(scaleDownUVScale.mul(isScaleDown)).add(noneUVScale.mul(isNone));
|
|
159
|
+
const adjustedUV = uv$1.sub(vec2(.5)).div(uvScale).add(vec2(.5));
|
|
160
|
+
const mirrorMode = uniforms.mirror.uniform;
|
|
161
|
+
const finalUV = vec2(select(mirrorMode, float(1).sub(adjustedUV.x), adjustedUV.x), float(1).sub(adjustedUV.y));
|
|
162
|
+
const sampledColor = textureNode.sample(finalUV);
|
|
163
|
+
const isOutOfBounds = or(or(finalUV.x.lessThan(0), finalUV.x.greaterThan(1)), or(finalUV.y.lessThan(0), finalUV.y.greaterThan(1)));
|
|
164
|
+
return vec4(sampledColor.rgb, select(isOutOfBounds, float(0), sampledColor.a));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
var WebcamTexture_default = componentDefinition;
|
|
168
|
+
export { componentDefinition as n, WebcamTexture_default as t };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -16,6 +16,4 @@ export { edgeMask } from './helpers/edgeMask';
|
|
|
16
16
|
export type { UniformsMap, PropConfig, NodeMetadata, MaskConfig, TransformConfig } from './types';
|
|
17
17
|
export type { BlendMode } from './blendModes';
|
|
18
18
|
export type { PerformanceStats } from './performanceTracker';
|
|
19
|
-
export { shaderRegistry, getAllShaders, getShaderByName, getShadersByCategory, getShaderCategories } from './shaderRegistry';
|
|
20
|
-
export type { ShaderRegistryEntry } from './shaderRegistry';
|
|
21
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAG3C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAG7C,YAAY,EAAC,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAC/F,YAAY,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AAC3C,YAAY,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAG3C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAG7C,YAAY,EAAC,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAC/F,YAAY,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AAC3C,YAAY,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA"}
|
package/dist/core/index.js
CHANGED
|
@@ -1,68 +1,6 @@
|
|
|
1
1
|
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
2
|
import { a as transformColorUpdate, c as transformPositionUpdate, r as transformColor, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
3
3
|
import { t as createAnimatedTime } from "./time-BZqyVJXt.js";
|
|
4
|
-
import { n as componentDefinition } from "./AngularBlur-CuwAjUOA.js";
|
|
5
|
-
import { n as componentDefinition$1 } from "./Ascii-Dxk6VaBp.js";
|
|
6
|
-
import "./colorMixing-CZPFmiT4.js";
|
|
7
|
-
import { n as componentDefinition$2 } from "./Beam-CbG4MkLo.js";
|
|
8
|
-
import { n as componentDefinition$3 } from "./Blob-Ck1tVOL_.js";
|
|
9
|
-
import { n as componentDefinition$4 } from "./Blur-k37gOaRA.js";
|
|
10
|
-
import { n as componentDefinition$5 } from "./BrightnessContrast-CaErceqR.js";
|
|
11
|
-
import { n as componentDefinition$6 } from "./Bulge-BVcWo6On.js";
|
|
12
|
-
import { n as componentDefinition$7 } from "./ChannelBlur-CQoP7Igg.js";
|
|
13
|
-
import { n as componentDefinition$8 } from "./Checkerboard-D_hGvoO7.js";
|
|
14
|
-
import { n as componentDefinition$9 } from "./ChromaFlow-DizYQSgf.js";
|
|
15
|
-
import { n as componentDefinition$10 } from "./ChromaticAberration-Bk_DMYJm.js";
|
|
16
|
-
import { n as componentDefinition$11 } from "./Circle-BlVzkeyl.js";
|
|
17
|
-
import { n as componentDefinition$12 } from "./CRTScreen-CcAYeqoI.js";
|
|
18
|
-
import { n as componentDefinition$13 } from "./CursorTrail-CxXWV7KH.js";
|
|
19
|
-
import { n as componentDefinition$14 } from "./DiffuseBlur-BTSRl65K.js";
|
|
20
|
-
import { n as componentDefinition$15 } from "./Dither-C1KyBYuE.js";
|
|
21
|
-
import { n as componentDefinition$16 } from "./DotGrid-ll8XCA0p.js";
|
|
22
|
-
import { n as componentDefinition$17 } from "./Duotone-d2gQJr4M.js";
|
|
23
|
-
import { n as componentDefinition$18 } from "./FilmGrain-3h6TIe1T.js";
|
|
24
|
-
import { n as componentDefinition$19 } from "./FloatingParticles-D95-rj4h.js";
|
|
25
|
-
import { n as componentDefinition$20 } from "./GlassTiles-DqT67iqr.js";
|
|
26
|
-
import { n as componentDefinition$21 } from "./Glow-BYNKuw0E.js";
|
|
27
|
-
import { n as componentDefinition$22 } from "./Godrays-DCk1c8sQ.js";
|
|
28
|
-
import { n as componentDefinition$23 } from "./Grayscale-BH3tLDGN.js";
|
|
29
|
-
import { n as componentDefinition$24 } from "./Grid-CdslWvoH.js";
|
|
30
|
-
import { n as componentDefinition$25 } from "./GridDistortion-D-iiGELF.js";
|
|
31
|
-
import { n as componentDefinition$26 } from "./Group-ByGv48Lm.js";
|
|
32
|
-
import { n as componentDefinition$27 } from "./Halftone-CV0aFuRG.js";
|
|
33
|
-
import { n as componentDefinition$28 } from "./HueShift-DQ2WgImx.js";
|
|
34
|
-
import { n as componentDefinition$29 } from "./ImageTexture-DKFb8ze3.js";
|
|
35
|
-
import { n as componentDefinition$30 } from "./Invert-w9duGaUu.js";
|
|
36
|
-
import { n as componentDefinition$31 } from "./LinearBlur-CTXjolzL.js";
|
|
37
|
-
import { n as componentDefinition$32 } from "./LinearGradient-CZo6e7r8.js";
|
|
38
|
-
import { n as componentDefinition$33 } from "./Liquify-BbfDBMNZ.js";
|
|
39
|
-
import { n as componentDefinition$34 } from "./Perspective-CSP2Hb16.js";
|
|
40
|
-
import { n as componentDefinition$35 } from "./Pixelate-BAoi-CSx.js";
|
|
41
|
-
import { n as componentDefinition$36 } from "./PolarCoordinates-BwN9HhFK.js";
|
|
42
|
-
import { n as componentDefinition$37 } from "./Posterize-XoAqPWv2.js";
|
|
43
|
-
import { n as componentDefinition$38 } from "./ProgressiveBlur-RuAm_BKx.js";
|
|
44
|
-
import { n as componentDefinition$39 } from "./RadialGradient-BfFuRbIl.js";
|
|
45
|
-
import { n as componentDefinition$40 } from "./RectangularCoordinates-CiW3J4UT.js";
|
|
46
|
-
import { n as componentDefinition$41 } from "./Ripples-DKBIp3Qq.js";
|
|
47
|
-
import { n as componentDefinition$42 } from "./Saturation-DVVlpikK.js";
|
|
48
|
-
import { n as componentDefinition$43 } from "./Sharpness-cw57bW0s.js";
|
|
49
|
-
import { n as componentDefinition$44 } from "./Shatter-COjV2jLy.js";
|
|
50
|
-
import { n as componentDefinition$45 } from "./SimplexNoise-Ce79jgYM.js";
|
|
51
|
-
import { n as componentDefinition$46 } from "./SineWave-Cv2gOU8a.js";
|
|
52
|
-
import { n as componentDefinition$47 } from "./SolidColor-DFkDBFq3.js";
|
|
53
|
-
import { n as componentDefinition$48 } from "./Spherize-R-s4pX9t.js";
|
|
54
|
-
import { n as componentDefinition$49 } from "./Spiral-W4dALX1z.js";
|
|
55
|
-
import { n as componentDefinition$50 } from "./Strands-DtN5POfO.js";
|
|
56
|
-
import { n as componentDefinition$51 } from "./Stretch-BzvP_hdu.js";
|
|
57
|
-
import { n as componentDefinition$52 } from "./Stripes-BbNFX05u.js";
|
|
58
|
-
import { n as componentDefinition$53 } from "./Swirl-CfsYsr4X.js";
|
|
59
|
-
import { n as componentDefinition$54 } from "./TiltShift-B6gbm7Z8.js";
|
|
60
|
-
import { n as componentDefinition$55 } from "./Tint-CpnitsHw.js";
|
|
61
|
-
import { n as componentDefinition$56 } from "./Tritone-DzvSKVfR.js";
|
|
62
|
-
import { n as componentDefinition$57 } from "./Twirl-BXH4uAd6.js";
|
|
63
|
-
import { n as componentDefinition$58 } from "./Vibrance-ByN9bRgU.js";
|
|
64
|
-
import { n as componentDefinition$59 } from "./WaveDistortion-BA1PyqYH.js";
|
|
65
|
-
import { n as componentDefinition$60 } from "./ZoomBlur-CTrw7HxX.js";
|
|
66
4
|
import { Material, Mesh, MeshBasicNodeMaterial, OrthographicCamera, PlaneGeometry, SRGBColorSpace, Scene, WebGPURenderer } from "three/webgpu";
|
|
67
5
|
import { WebGLRenderer } from "three";
|
|
68
6
|
import { PI, abs, add, atan, convertToTexture, cos, div, dot, float, fract, max, min, mix, mul, pow, screenUV, sin, smoothstep, sqrt, step, sub, time, uniform, uv, vec2, vec3, vec4 } from "three/tsl";
|
|
@@ -1089,7 +1027,7 @@ function shaderRenderer() {
|
|
|
1089
1027
|
}
|
|
1090
1028
|
}
|
|
1091
1029
|
};
|
|
1092
|
-
const registerNode = (id, fragmentNodeFunc, parentId, metadata, uniforms = {}, componentDefinition
|
|
1030
|
+
const registerNode = (id, fragmentNodeFunc, parentId, metadata, uniforms = {}, componentDefinition) => {
|
|
1093
1031
|
if (fragmentNodeFunc === null) {
|
|
1094
1032
|
const queueIndex = pendingRegistrationQueue.findIndex((item) => item.id === id);
|
|
1095
1033
|
if (queueIndex !== -1) {
|
|
@@ -1107,7 +1045,7 @@ function shaderRenderer() {
|
|
|
1107
1045
|
parentId,
|
|
1108
1046
|
metadata,
|
|
1109
1047
|
uniforms,
|
|
1110
|
-
componentDefinition
|
|
1048
|
+
componentDefinition
|
|
1111
1049
|
};
|
|
1112
1050
|
else pendingRegistrationQueue.push({
|
|
1113
1051
|
id,
|
|
@@ -1115,7 +1053,7 @@ function shaderRenderer() {
|
|
|
1115
1053
|
parentId,
|
|
1116
1054
|
metadata,
|
|
1117
1055
|
uniforms,
|
|
1118
|
-
componentDefinition
|
|
1056
|
+
componentDefinition
|
|
1119
1057
|
});
|
|
1120
1058
|
return;
|
|
1121
1059
|
}
|
|
@@ -1148,11 +1086,11 @@ function shaderRenderer() {
|
|
|
1148
1086
|
}
|
|
1149
1087
|
const nodeInfo = {
|
|
1150
1088
|
id,
|
|
1151
|
-
componentName: componentDefinition
|
|
1089
|
+
componentName: componentDefinition?.name || "Unknown",
|
|
1152
1090
|
fragmentNodeFunc,
|
|
1153
1091
|
parentId,
|
|
1154
|
-
requiresRTT: componentDefinition
|
|
1155
|
-
requiresChild: componentDefinition
|
|
1092
|
+
requiresRTT: componentDefinition?.requiresRTT || false,
|
|
1093
|
+
requiresChild: componentDefinition?.requiresChild || false,
|
|
1156
1094
|
opacityUniform,
|
|
1157
1095
|
metadata: {
|
|
1158
1096
|
blendMode: metadata?.blendMode || "normal",
|
|
@@ -1468,7 +1406,7 @@ function shaderRenderer() {
|
|
|
1468
1406
|
if (pendingRegistrationQueue.length === 0) return;
|
|
1469
1407
|
const queue = [...pendingRegistrationQueue];
|
|
1470
1408
|
pendingRegistrationQueue = [];
|
|
1471
|
-
for (const { id, fragmentNodeFunc, parentId, metadata, uniforms, componentDefinition
|
|
1409
|
+
for (const { id, fragmentNodeFunc, parentId, metadata, uniforms, componentDefinition } of queue) if (fragmentNodeFunc) registerNode(id, fragmentNodeFunc, parentId, metadata, uniforms, componentDefinition);
|
|
1472
1410
|
};
|
|
1473
1411
|
const initialize = async ({ canvas, enablePerformanceTracking: enableTracking = false }) => {
|
|
1474
1412
|
if (isInitialized || isInitializing) return;
|
|
@@ -1760,102 +1698,4 @@ const edgeMask = (options = {}) => {
|
|
|
1760
1698
|
const ovalDistance = ovalX.mul(ovalX).add(ovalY.mul(ovalY)).sqrt();
|
|
1761
1699
|
return float(1).sub(smoothstep(float(1).sub(float(inset)), float(1).sub(float(inset)).add(float(softness)), ovalDistance.mul(float(1).add(float(softness)))));
|
|
1762
1700
|
};
|
|
1763
|
-
|
|
1764
|
-
const registry = {};
|
|
1765
|
-
const shaderDefinitions = {
|
|
1766
|
-
AngularBlur: componentDefinition,
|
|
1767
|
-
Ascii: componentDefinition$1,
|
|
1768
|
-
Beam: componentDefinition$2,
|
|
1769
|
-
Blob: componentDefinition$3,
|
|
1770
|
-
Blur: componentDefinition$4,
|
|
1771
|
-
BrightnessContrast: componentDefinition$5,
|
|
1772
|
-
Bulge: componentDefinition$6,
|
|
1773
|
-
ChannelBlur: componentDefinition$7,
|
|
1774
|
-
Checkerboard: componentDefinition$8,
|
|
1775
|
-
ChromaFlow: componentDefinition$9,
|
|
1776
|
-
ChromaticAberration: componentDefinition$10,
|
|
1777
|
-
Circle: componentDefinition$11,
|
|
1778
|
-
CRTScreen: componentDefinition$12,
|
|
1779
|
-
CursorTrail: componentDefinition$13,
|
|
1780
|
-
DiffuseBlur: componentDefinition$14,
|
|
1781
|
-
Dither: componentDefinition$15,
|
|
1782
|
-
DotGrid: componentDefinition$16,
|
|
1783
|
-
Duotone: componentDefinition$17,
|
|
1784
|
-
FilmGrain: componentDefinition$18,
|
|
1785
|
-
FloatingParticles: componentDefinition$19,
|
|
1786
|
-
GlassTiles: componentDefinition$20,
|
|
1787
|
-
Glow: componentDefinition$21,
|
|
1788
|
-
Godrays: componentDefinition$22,
|
|
1789
|
-
Grayscale: componentDefinition$23,
|
|
1790
|
-
Grid: componentDefinition$24,
|
|
1791
|
-
GridDistortion: componentDefinition$25,
|
|
1792
|
-
Group: componentDefinition$26,
|
|
1793
|
-
Halftone: componentDefinition$27,
|
|
1794
|
-
HueShift: componentDefinition$28,
|
|
1795
|
-
ImageTexture: componentDefinition$29,
|
|
1796
|
-
Invert: componentDefinition$30,
|
|
1797
|
-
LinearBlur: componentDefinition$31,
|
|
1798
|
-
LinearGradient: componentDefinition$32,
|
|
1799
|
-
Liquify: componentDefinition$33,
|
|
1800
|
-
Perspective: componentDefinition$34,
|
|
1801
|
-
Pixelate: componentDefinition$35,
|
|
1802
|
-
PolarCoordinates: componentDefinition$36,
|
|
1803
|
-
Posterize: componentDefinition$37,
|
|
1804
|
-
ProgressiveBlur: componentDefinition$38,
|
|
1805
|
-
RadialGradient: componentDefinition$39,
|
|
1806
|
-
RectangularCoordinates: componentDefinition$40,
|
|
1807
|
-
Ripples: componentDefinition$41,
|
|
1808
|
-
Saturation: componentDefinition$42,
|
|
1809
|
-
Sharpness: componentDefinition$43,
|
|
1810
|
-
Shatter: componentDefinition$44,
|
|
1811
|
-
SimplexNoise: componentDefinition$45,
|
|
1812
|
-
SineWave: componentDefinition$46,
|
|
1813
|
-
SolidColor: componentDefinition$47,
|
|
1814
|
-
Spherize: componentDefinition$48,
|
|
1815
|
-
Spiral: componentDefinition$49,
|
|
1816
|
-
Strands: componentDefinition$50,
|
|
1817
|
-
Stretch: componentDefinition$51,
|
|
1818
|
-
Stripes: componentDefinition$52,
|
|
1819
|
-
Swirl: componentDefinition$53,
|
|
1820
|
-
TiltShift: componentDefinition$54,
|
|
1821
|
-
Tint: componentDefinition$55,
|
|
1822
|
-
Tritone: componentDefinition$56,
|
|
1823
|
-
Twirl: componentDefinition$57,
|
|
1824
|
-
Vibrance: componentDefinition$58,
|
|
1825
|
-
WaveDistortion: componentDefinition$59,
|
|
1826
|
-
ZoomBlur: componentDefinition$60
|
|
1827
|
-
};
|
|
1828
|
-
Object.entries(shaderDefinitions).forEach(([fileName, def]) => {
|
|
1829
|
-
const propsMetadata = {};
|
|
1830
|
-
if (def.props) Object.entries(def.props).forEach(([propName, propConfig]) => {
|
|
1831
|
-
if (propConfig.ui) propsMetadata[propName] = {
|
|
1832
|
-
ui: propConfig.ui,
|
|
1833
|
-
default: propConfig.default,
|
|
1834
|
-
description: propConfig.description
|
|
1835
|
-
};
|
|
1836
|
-
});
|
|
1837
|
-
registry[def.name] = {
|
|
1838
|
-
name: def.name,
|
|
1839
|
-
fileName,
|
|
1840
|
-
category: def.category || "Uncategorized",
|
|
1841
|
-
definition: def,
|
|
1842
|
-
propsMetadata
|
|
1843
|
-
};
|
|
1844
|
-
});
|
|
1845
|
-
return registry;
|
|
1846
|
-
};
|
|
1847
|
-
const shaderRegistry = createShaderRegistry();
|
|
1848
|
-
function getAllShaders() {
|
|
1849
|
-
return Object.values(shaderRegistry);
|
|
1850
|
-
}
|
|
1851
|
-
function getShaderByName(name) {
|
|
1852
|
-
return shaderRegistry[name];
|
|
1853
|
-
}
|
|
1854
|
-
function getShadersByCategory(category) {
|
|
1855
|
-
return Object.values(shaderRegistry).filter((shader) => shader.category === category);
|
|
1856
|
-
}
|
|
1857
|
-
function getShaderCategories() {
|
|
1858
|
-
const categories = new Set(Object.values(shaderRegistry).map((shader) => shader.category));
|
|
1859
|
-
return Array.from(categories).sort();
|
|
1860
|
-
}
|
|
1861
|
-
export { createAnimatedTime, createUniformsMap, distort, edgeMask, getAllShaders, getShaderByName, getShaderCategories, getShadersByCategory, glow, grain, resolveMaskDependencies, shaderRegistry, shaderRenderer, updateUniformValue };
|
|
1701
|
+
export { createAnimatedTime, createUniformsMap, distort, edgeMask, glow, grain, resolveMaskDependencies, shaderRenderer, updateUniformValue };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shader Registry - imports all shader definitions
|
|
3
|
+
*
|
|
4
|
+
* Import from 'shaders-core/registry' to access the full shader registry.
|
|
5
|
+
* Note: This will bundle all shader definitions into your app.
|
|
6
|
+
* Only import this if you need dynamic access to all shaders.
|
|
7
|
+
*/
|
|
8
|
+
export { shaderRegistry, getAllShaders, getShaderByName, getShadersByCategory, getShaderCategories } from './shaderRegistry';
|
|
9
|
+
export type { ShaderRegistryEntry } from './shaderRegistry';
|
|
10
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import "./edges-Bd7GP4s2.js";
|
|
2
|
+
import "./transformations-YbhRK-rd.js";
|
|
3
|
+
import "./time-BZqyVJXt.js";
|
|
4
|
+
import { n as componentDefinition } from "./AngularBlur-CuwAjUOA.js";
|
|
5
|
+
import { n as componentDefinition$1 } from "./Ascii-Dxk6VaBp.js";
|
|
6
|
+
import "./colorMixing-CZPFmiT4.js";
|
|
7
|
+
import { n as componentDefinition$2 } from "./Beam-CbG4MkLo.js";
|
|
8
|
+
import { n as componentDefinition$3 } from "./Blob-Ck1tVOL_.js";
|
|
9
|
+
import { n as componentDefinition$4 } from "./Blur-k37gOaRA.js";
|
|
10
|
+
import { n as componentDefinition$5 } from "./BrightnessContrast-CaErceqR.js";
|
|
11
|
+
import { n as componentDefinition$6 } from "./Bulge-BVcWo6On.js";
|
|
12
|
+
import { n as componentDefinition$7 } from "./ChannelBlur-CQoP7Igg.js";
|
|
13
|
+
import { n as componentDefinition$8 } from "./Checkerboard-D_hGvoO7.js";
|
|
14
|
+
import { n as componentDefinition$9 } from "./ChromaFlow-DizYQSgf.js";
|
|
15
|
+
import { n as componentDefinition$10 } from "./ChromaticAberration-Bk_DMYJm.js";
|
|
16
|
+
import { n as componentDefinition$11 } from "./Circle-BlVzkeyl.js";
|
|
17
|
+
import { n as componentDefinition$12 } from "./CRTScreen-CcAYeqoI.js";
|
|
18
|
+
import { n as componentDefinition$13 } from "./CursorTrail-CxXWV7KH.js";
|
|
19
|
+
import { n as componentDefinition$14 } from "./DiffuseBlur-BTSRl65K.js";
|
|
20
|
+
import { n as componentDefinition$15 } from "./Dither-C1KyBYuE.js";
|
|
21
|
+
import { n as componentDefinition$16 } from "./DotGrid-ll8XCA0p.js";
|
|
22
|
+
import { n as componentDefinition$17 } from "./Duotone-d2gQJr4M.js";
|
|
23
|
+
import { n as componentDefinition$18 } from "./FilmGrain-3h6TIe1T.js";
|
|
24
|
+
import { n as componentDefinition$19 } from "./FloatingParticles-D95-rj4h.js";
|
|
25
|
+
import { n as componentDefinition$20 } from "./GlassTiles-DqT67iqr.js";
|
|
26
|
+
import { n as componentDefinition$21 } from "./Glow-BYNKuw0E.js";
|
|
27
|
+
import { n as componentDefinition$22 } from "./Godrays-DCk1c8sQ.js";
|
|
28
|
+
import { n as componentDefinition$23 } from "./Grayscale-BH3tLDGN.js";
|
|
29
|
+
import { n as componentDefinition$24 } from "./Grid-CdslWvoH.js";
|
|
30
|
+
import { n as componentDefinition$25 } from "./GridDistortion-D-iiGELF.js";
|
|
31
|
+
import { n as componentDefinition$26 } from "./Group-ByGv48Lm.js";
|
|
32
|
+
import { n as componentDefinition$27 } from "./Halftone-CV0aFuRG.js";
|
|
33
|
+
import { n as componentDefinition$28 } from "./HueShift-DQ2WgImx.js";
|
|
34
|
+
import { n as componentDefinition$29 } from "./ImageTexture-DKFb8ze3.js";
|
|
35
|
+
import { n as componentDefinition$30 } from "./Invert-w9duGaUu.js";
|
|
36
|
+
import { n as componentDefinition$31 } from "./LinearBlur-CTXjolzL.js";
|
|
37
|
+
import { n as componentDefinition$32 } from "./LinearGradient-CZo6e7r8.js";
|
|
38
|
+
import { n as componentDefinition$33 } from "./Liquify-BbfDBMNZ.js";
|
|
39
|
+
import { n as componentDefinition$34 } from "./Perspective-CSP2Hb16.js";
|
|
40
|
+
import { n as componentDefinition$35 } from "./Pixelate-BAoi-CSx.js";
|
|
41
|
+
import { n as componentDefinition$36 } from "./PolarCoordinates-BwN9HhFK.js";
|
|
42
|
+
import { n as componentDefinition$37 } from "./Posterize-XoAqPWv2.js";
|
|
43
|
+
import { n as componentDefinition$38 } from "./ProgressiveBlur-RuAm_BKx.js";
|
|
44
|
+
import { n as componentDefinition$39 } from "./RadialGradient-BfFuRbIl.js";
|
|
45
|
+
import { n as componentDefinition$40 } from "./RectangularCoordinates-CiW3J4UT.js";
|
|
46
|
+
import { n as componentDefinition$41 } from "./Ripples-DKBIp3Qq.js";
|
|
47
|
+
import { n as componentDefinition$42 } from "./Saturation-DVVlpikK.js";
|
|
48
|
+
import { n as componentDefinition$43 } from "./Sharpness-cw57bW0s.js";
|
|
49
|
+
import { n as componentDefinition$44 } from "./Shatter-COjV2jLy.js";
|
|
50
|
+
import { n as componentDefinition$45 } from "./SimplexNoise-Ce79jgYM.js";
|
|
51
|
+
import { n as componentDefinition$46 } from "./SineWave-Cv2gOU8a.js";
|
|
52
|
+
import { n as componentDefinition$47 } from "./SolidColor-DFkDBFq3.js";
|
|
53
|
+
import { n as componentDefinition$48 } from "./Spherize-R-s4pX9t.js";
|
|
54
|
+
import { n as componentDefinition$49 } from "./Spiral-W4dALX1z.js";
|
|
55
|
+
import { n as componentDefinition$50 } from "./Strands-DtN5POfO.js";
|
|
56
|
+
import { n as componentDefinition$51 } from "./Stretch-BzvP_hdu.js";
|
|
57
|
+
import { n as componentDefinition$52 } from "./Stripes-BbNFX05u.js";
|
|
58
|
+
import { n as componentDefinition$53 } from "./Swirl-CfsYsr4X.js";
|
|
59
|
+
import { n as componentDefinition$54 } from "./TiltShift-B6gbm7Z8.js";
|
|
60
|
+
import { n as componentDefinition$55 } from "./Tint-CpnitsHw.js";
|
|
61
|
+
import { n as componentDefinition$56 } from "./Tritone-DzvSKVfR.js";
|
|
62
|
+
import { n as componentDefinition$57 } from "./Twirl-BXH4uAd6.js";
|
|
63
|
+
import { n as componentDefinition$58 } from "./Vibrance-ByN9bRgU.js";
|
|
64
|
+
import { n as componentDefinition$59 } from "./WaveDistortion-BA1PyqYH.js";
|
|
65
|
+
import { n as componentDefinition$60 } from "./WebcamTexture-D4Uv7Plz.js";
|
|
66
|
+
import { n as componentDefinition$61 } from "./ZoomBlur-CIkkDBIo.js";
|
|
67
|
+
var createShaderRegistry = () => {
|
|
68
|
+
const registry = {};
|
|
69
|
+
const shaderDefinitions = {
|
|
70
|
+
AngularBlur: componentDefinition,
|
|
71
|
+
Ascii: componentDefinition$1,
|
|
72
|
+
Beam: componentDefinition$2,
|
|
73
|
+
Blob: componentDefinition$3,
|
|
74
|
+
Blur: componentDefinition$4,
|
|
75
|
+
BrightnessContrast: componentDefinition$5,
|
|
76
|
+
Bulge: componentDefinition$6,
|
|
77
|
+
ChannelBlur: componentDefinition$7,
|
|
78
|
+
Checkerboard: componentDefinition$8,
|
|
79
|
+
ChromaFlow: componentDefinition$9,
|
|
80
|
+
ChromaticAberration: componentDefinition$10,
|
|
81
|
+
Circle: componentDefinition$11,
|
|
82
|
+
CRTScreen: componentDefinition$12,
|
|
83
|
+
CursorTrail: componentDefinition$13,
|
|
84
|
+
DiffuseBlur: componentDefinition$14,
|
|
85
|
+
Dither: componentDefinition$15,
|
|
86
|
+
DotGrid: componentDefinition$16,
|
|
87
|
+
Duotone: componentDefinition$17,
|
|
88
|
+
FilmGrain: componentDefinition$18,
|
|
89
|
+
FloatingParticles: componentDefinition$19,
|
|
90
|
+
GlassTiles: componentDefinition$20,
|
|
91
|
+
Glow: componentDefinition$21,
|
|
92
|
+
Godrays: componentDefinition$22,
|
|
93
|
+
Grayscale: componentDefinition$23,
|
|
94
|
+
Grid: componentDefinition$24,
|
|
95
|
+
GridDistortion: componentDefinition$25,
|
|
96
|
+
Group: componentDefinition$26,
|
|
97
|
+
Halftone: componentDefinition$27,
|
|
98
|
+
HueShift: componentDefinition$28,
|
|
99
|
+
ImageTexture: componentDefinition$29,
|
|
100
|
+
Invert: componentDefinition$30,
|
|
101
|
+
LinearBlur: componentDefinition$31,
|
|
102
|
+
LinearGradient: componentDefinition$32,
|
|
103
|
+
Liquify: componentDefinition$33,
|
|
104
|
+
Perspective: componentDefinition$34,
|
|
105
|
+
Pixelate: componentDefinition$35,
|
|
106
|
+
PolarCoordinates: componentDefinition$36,
|
|
107
|
+
Posterize: componentDefinition$37,
|
|
108
|
+
ProgressiveBlur: componentDefinition$38,
|
|
109
|
+
RadialGradient: componentDefinition$39,
|
|
110
|
+
RectangularCoordinates: componentDefinition$40,
|
|
111
|
+
Ripples: componentDefinition$41,
|
|
112
|
+
Saturation: componentDefinition$42,
|
|
113
|
+
Sharpness: componentDefinition$43,
|
|
114
|
+
Shatter: componentDefinition$44,
|
|
115
|
+
SimplexNoise: componentDefinition$45,
|
|
116
|
+
SineWave: componentDefinition$46,
|
|
117
|
+
SolidColor: componentDefinition$47,
|
|
118
|
+
Spherize: componentDefinition$48,
|
|
119
|
+
Spiral: componentDefinition$49,
|
|
120
|
+
Strands: componentDefinition$50,
|
|
121
|
+
Stretch: componentDefinition$51,
|
|
122
|
+
Stripes: componentDefinition$52,
|
|
123
|
+
Swirl: componentDefinition$53,
|
|
124
|
+
TiltShift: componentDefinition$54,
|
|
125
|
+
Tint: componentDefinition$55,
|
|
126
|
+
Tritone: componentDefinition$56,
|
|
127
|
+
Twirl: componentDefinition$57,
|
|
128
|
+
Vibrance: componentDefinition$58,
|
|
129
|
+
WaveDistortion: componentDefinition$59,
|
|
130
|
+
WebcamTexture: componentDefinition$60,
|
|
131
|
+
ZoomBlur: componentDefinition$61
|
|
132
|
+
};
|
|
133
|
+
Object.entries(shaderDefinitions).forEach(([fileName, def]) => {
|
|
134
|
+
const propsMetadata = {};
|
|
135
|
+
if (def.props) Object.entries(def.props).forEach(([propName, propConfig]) => {
|
|
136
|
+
if (propConfig.ui) propsMetadata[propName] = {
|
|
137
|
+
ui: propConfig.ui,
|
|
138
|
+
default: propConfig.default,
|
|
139
|
+
description: propConfig.description
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
registry[def.name] = {
|
|
143
|
+
name: def.name,
|
|
144
|
+
fileName,
|
|
145
|
+
category: def.category || "Uncategorized",
|
|
146
|
+
definition: def,
|
|
147
|
+
propsMetadata
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
return registry;
|
|
151
|
+
};
|
|
152
|
+
const shaderRegistry = createShaderRegistry();
|
|
153
|
+
function getAllShaders() {
|
|
154
|
+
return Object.values(shaderRegistry);
|
|
155
|
+
}
|
|
156
|
+
function getShaderByName(name) {
|
|
157
|
+
return shaderRegistry[name];
|
|
158
|
+
}
|
|
159
|
+
function getShadersByCategory(category) {
|
|
160
|
+
return Object.values(shaderRegistry).filter((shader) => shader.category === category);
|
|
161
|
+
}
|
|
162
|
+
function getShaderCategories() {
|
|
163
|
+
const categories = new Set(Object.values(shaderRegistry).map((shader) => shader.category));
|
|
164
|
+
return Array.from(categories).sort();
|
|
165
|
+
}
|
|
166
|
+
export { getAllShaders, getShaderByName, getShaderCategories, getShadersByCategory, shaderRegistry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaderRegistry.d.ts","sourceRoot":"","sources":["../src/shaderRegistry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shaderRegistry.d.ts","sourceRoot":"","sources":["../src/shaderRegistry.ts"],"names":[],"mappings":"AAiEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAC5B,EAAE,CAAC,EAAE,GAAG,CAAA;QACR,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAC,CAAA;CACH;AAkGD,eAAO,MAAM,cAAc,qCAAyB,CAAA;AAGpD,wBAAgB,aAAa,IAAI,mBAAmB,EAAE,CAErD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAE7E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAE5E;AAED,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAG9C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentDefinition } from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface ComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* How the webcam feed should be sized within the viewport
|
|
6
|
+
*
|
|
7
|
+
* Accepts one of: `"cover"`, `"contain"`, `"fill"`, `"scale-down"`, `"none"`.
|
|
8
|
+
* @default "cover"
|
|
9
|
+
*/
|
|
10
|
+
objectFit: string;
|
|
11
|
+
/**
|
|
12
|
+
* Mirror the webcam feed horizontally (selfie mode)
|
|
13
|
+
*
|
|
14
|
+
* Accepts a boolean value (`true` or `false`).
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
mirror: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const componentDefinition: ComponentDefinition<ComponentProps>;
|
|
20
|
+
export default componentDefinition;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shaders/WebcamTexture/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,iBAAiB,CAAA;AAMvE,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,cAAc,CAsRnE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../../transformations-YbhRK-rd.js";
|
|
2
|
-
import { n as componentDefinition, t as ZoomBlur_default } from "../../ZoomBlur-
|
|
2
|
+
import { n as componentDefinition, t as ZoomBlur_default } from "../../ZoomBlur-CIkkDBIo.js";
|
|
3
3
|
export { componentDefinition, ZoomBlur_default as default };
|