shaders 2.2.29 → 2.2.31
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/{AngularBlur-DKFExWUF.js → AngularBlur-CuwAjUOA.js} +1 -1
- package/dist/core/{Ascii-BRApYlD4.js → Ascii-Dxk6VaBp.js} +30 -7
- package/dist/core/{Beam-DU7wxmIh.js → Beam-CbG4MkLo.js} +3 -4
- package/dist/core/{Blob-nssNzEgN.js → Blob-C_fYRjJF.js} +4 -5
- package/dist/core/{Bulge-Dm02_fG6.js → Bulge-C8-_hIFp.js} +2 -21
- package/dist/core/{Checkerboard-SKsXoUXE.js → Checkerboard-D_H3XYbF.js} +3 -4
- package/dist/core/{ChromaFlow-VpfgLFbs.js → ChromaFlow-DhzC_8Ne.js} +19 -17
- package/dist/core/{ChromaticAberration-CaCyXMyE.js → ChromaticAberration-hi7WGiVk.js} +1 -1
- package/dist/core/{Circle-BHnAmzVb.js → Circle-DI0gXpyD.js} +3 -4
- package/dist/core/{CursorTrail-CfVWIKok.js → CursorTrail-B9EQ9FsP.js} +1 -1
- package/dist/core/{DiffuseBlur-GWPb8Zht.js → DiffuseBlur-Cg7AsB3W.js} +2 -13
- package/dist/core/{Dither-BNEeyo0u.js → Dither-Bb5rLGEI.js} +1 -1
- package/dist/core/{DotGrid-CRRS6nbt.js → DotGrid-B2DXsjFE.js} +3 -4
- package/dist/core/{Duotone-5gKND3an.js → Duotone-CRwhugbV.js} +1 -1
- package/dist/core/{FilmGrain-osBGk_b9.js → FilmGrain-CY4ZO9UI.js} +2 -3
- package/dist/core/{FloatingParticles-CULOurGT.js → FloatingParticles-BduIDXKd.js} +3 -4
- package/dist/core/{GlassTiles-CA90XrNT.js → GlassTiles-uW7j91uC.js} +1 -13
- package/dist/core/{Godrays-BQsDwU26.js → Godrays-ChqiT2zn.js} +3 -4
- package/dist/core/{Grid-CWHxwO7R.js → Grid-DazyiX15.js} +3 -4
- package/dist/core/{GridDistortion-CZB9w-rv.js → GridDistortion-CYQUwuXw.js} +2 -2
- package/dist/core/{Halftone-MMcLMRpL.js → Halftone-Ddrldk6b.js} +1 -1
- package/dist/core/{ImageTexture-D9OMwqAs.js → ImageTexture-D0xwHmkW.js} +2 -3
- package/dist/core/{LinearBlur-B-Ikurxt.js → LinearBlur-cYfqaOhb.js} +1 -1
- package/dist/core/{LinearGradient-DV6UkhZk.js → LinearGradient-B6ySxWpU.js} +3 -4
- package/dist/core/{Liquify-W8UQNeEM.js → Liquify-yoKWSK0F.js} +2 -8
- package/dist/core/{Pixelate-_pyYeLRP.js → Pixelate-BmE_Zryn.js} +0 -4
- package/dist/core/{PolarCoordinates-D63xm0oJ.js → PolarCoordinates-PLyS00-P.js} +2 -11
- package/dist/core/{ProgressiveBlur-G-s-o9ic.js → ProgressiveBlur-XD4ivmMn.js} +1 -1
- package/dist/core/{RadialGradient-BGVqSwh0.js → RadialGradient-pwKyDUBu.js} +3 -4
- package/dist/core/{RectangularCoordinates-DyHBo456.js → RectangularCoordinates-Dq2JrmOX.js} +2 -11
- package/dist/core/{Ripples-2FGWCZlp.js → Ripples-Ot1rx8kL.js} +4 -5
- package/dist/core/{SimplexNoise-B6dtUCmn.js → SimplexNoise-BfilWh05.js} +4 -5
- package/dist/core/{SineWave-BtPf6-2H.js → SineWave-DRqL-jda.js} +3 -4
- package/dist/core/{SolidColor-CETl1cEr.js → SolidColor-B62ZBRlK.js} +1 -2
- package/dist/core/{Spherize-BwvUcorJ.js → Spherize-DDP0_5VP.js} +1 -1
- package/dist/core/{Spiral-DmJWmUmr.js → Spiral-Cx7Z8gLc.js} +3 -4
- package/dist/core/{Strands-CV1oCmHx.js → Strands-C9FBVtDe.js} +4 -5
- package/dist/core/{Stretch-pl-Cn2F8.js → Stretch-BCpOO3q6.js} +2 -21
- package/dist/core/{Swirl-D65vXLDw.js → Swirl-KUjGnUAM.js} +4 -5
- package/dist/core/{TiltShift-CFcK6Hzg.js → TiltShift-CvKqM1xk.js} +1 -1
- package/dist/core/{Tritone-EmnjV2rX.js → Tritone-BeEJj4U0.js} +1 -1
- package/dist/core/{Twirl-HSMyRx5I.js → Twirl-EJ3aS_lo.js} +2 -12
- package/dist/core/{WaveDistortion-DG8GO_l8.js → WaveDistortion-BOWBSWEU.js} +2 -24
- package/dist/core/{ZoomBlur-C01oGwwG.js → ZoomBlur-gB0BxldE.js} +1 -1
- package/dist/core/{edges-Djr_12SL.js → edges-Bd7GP4s2.js} +1 -10
- package/dist/core/index.js +198 -653
- package/dist/core/performanceTracker.d.ts +7 -1
- package/dist/core/performanceTracker.d.ts.map +1 -1
- package/dist/core/renderer.d.ts +0 -21
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/core/shaders/AngularBlur/index.js +2 -2
- package/dist/core/shaders/Ascii/index.d.ts.map +1 -1
- package/dist/core/shaders/Ascii/index.js +1 -1
- package/dist/core/shaders/Beam/index.d.ts.map +1 -1
- package/dist/core/shaders/Beam/index.js +2 -2
- package/dist/core/shaders/Blob/index.d.ts.map +1 -1
- package/dist/core/shaders/Blob/index.js +3 -3
- package/dist/core/shaders/Bulge/index.d.ts.map +1 -1
- package/dist/core/shaders/Bulge/index.js +3 -3
- package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
- package/dist/core/shaders/Checkerboard/index.js +2 -2
- package/dist/core/shaders/ChromaFlow/index.d.ts.map +1 -1
- package/dist/core/shaders/ChromaFlow/index.js +2 -2
- package/dist/core/shaders/ChromaticAberration/index.js +2 -2
- package/dist/core/shaders/Circle/index.d.ts.map +1 -1
- package/dist/core/shaders/Circle/index.js +2 -2
- package/dist/core/shaders/CursorTrail/index.js +2 -2
- package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/DiffuseBlur/index.js +3 -3
- package/dist/core/shaders/Dither/index.js +2 -2
- package/dist/core/shaders/DotGrid/index.d.ts.map +1 -1
- package/dist/core/shaders/DotGrid/index.js +2 -2
- package/dist/core/shaders/Duotone/index.js +2 -2
- package/dist/core/shaders/FilmGrain/index.d.ts.map +1 -1
- package/dist/core/shaders/FilmGrain/index.js +1 -1
- package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
- package/dist/core/shaders/FloatingParticles/index.js +2 -2
- package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
- package/dist/core/shaders/GlassTiles/index.js +1 -1
- package/dist/core/shaders/Godrays/index.d.ts.map +1 -1
- package/dist/core/shaders/Godrays/index.js +2 -2
- package/dist/core/shaders/Grid/index.d.ts.map +1 -1
- package/dist/core/shaders/Grid/index.js +2 -2
- package/dist/core/shaders/GridDistortion/index.js +3 -3
- package/dist/core/shaders/Halftone/index.js +2 -2
- package/dist/core/shaders/ImageTexture/index.d.ts.map +1 -1
- package/dist/core/shaders/ImageTexture/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.js +2 -2
- package/dist/core/shaders/LinearGradient/index.d.ts.map +1 -1
- package/dist/core/shaders/LinearGradient/index.js +2 -2
- package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
- package/dist/core/shaders/Liquify/index.js +3 -3
- package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.d.ts.map +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +3 -3
- package/dist/core/shaders/ProgressiveBlur/index.js +2 -2
- package/dist/core/shaders/RadialGradient/index.d.ts.map +1 -1
- package/dist/core/shaders/RadialGradient/index.js +2 -2
- package/dist/core/shaders/RectangularCoordinates/index.d.ts.map +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +3 -3
- package/dist/core/shaders/Ripples/index.d.ts.map +1 -1
- package/dist/core/shaders/Ripples/index.js +3 -3
- package/dist/core/shaders/SimplexNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +3 -3
- package/dist/core/shaders/SineWave/index.d.ts.map +1 -1
- package/dist/core/shaders/SineWave/index.js +2 -2
- package/dist/core/shaders/SolidColor/index.d.ts.map +1 -1
- package/dist/core/shaders/SolidColor/index.js +2 -2
- package/dist/core/shaders/Spherize/index.js +2 -2
- package/dist/core/shaders/Spiral/index.d.ts.map +1 -1
- package/dist/core/shaders/Spiral/index.js +2 -2
- package/dist/core/shaders/Strands/index.d.ts.map +1 -1
- package/dist/core/shaders/Strands/index.js +3 -3
- package/dist/core/shaders/Stretch/index.d.ts.map +1 -1
- package/dist/core/shaders/Stretch/index.js +3 -3
- package/dist/core/shaders/Swirl/index.d.ts.map +1 -1
- package/dist/core/shaders/Swirl/index.js +3 -3
- package/dist/core/shaders/TiltShift/index.js +2 -2
- package/dist/core/shaders/Tritone/index.js +2 -2
- package/dist/core/shaders/Twirl/index.d.ts.map +1 -1
- package/dist/core/shaders/Twirl/index.js +3 -3
- package/dist/core/shaders/WaveDistortion/index.d.ts.map +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +3 -3
- package/dist/core/shaders/ZoomBlur/index.js +2 -2
- package/dist/core/{transformations-Dv5JW9ck.js → transformations-YbhRK-rd.js} +51 -1
- package/dist/core/types.d.ts +0 -81
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/utilities/transformations.d.ts +17 -0
- package/dist/core/utilities/transformations.d.ts.map +1 -1
- package/dist/core/utilities/uniforms.d.ts.map +1 -1
- package/dist/registry.js +0 -19
- package/package.json +1 -1
- /package/dist/core/{time-CTJvRUZ4.js → time-DgRTVr2F.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { Fn, convertToTexture, cos, float, screenUV, sin, vec2, vec4 } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "AngularBlur",
|
|
@@ -124,6 +124,9 @@ const componentDefinition = {
|
|
|
124
124
|
}
|
|
125
125
|
} catch (error) {}
|
|
126
126
|
}
|
|
127
|
+
let reusableCanvas = null;
|
|
128
|
+
let reusableCtx = null;
|
|
129
|
+
let reusableDataBuffer = null;
|
|
127
130
|
const createCharacterAtlas = async (characters, cellSize, fontFamily, spacing) => {
|
|
128
131
|
if (!characters || characters.length === 0) throw new Error("Characters string cannot be empty");
|
|
129
132
|
const charCount$1 = characters.length;
|
|
@@ -132,11 +135,22 @@ const componentDefinition = {
|
|
|
132
135
|
const spacingMultiplier = Math.max(1, 2 / spacing);
|
|
133
136
|
const actualCellSize = Math.min(baseAtlasCellSize * spacingMultiplier, ATLAS_TEXTURE_SIZE / atlasSize$1);
|
|
134
137
|
const fontSize = actualCellSize * .75;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
if (!reusableCanvas) {
|
|
139
|
+
reusableCanvas = document.createElement("canvas");
|
|
140
|
+
reusableCanvas.width = ATLAS_TEXTURE_SIZE;
|
|
141
|
+
reusableCanvas.height = ATLAS_TEXTURE_SIZE;
|
|
142
|
+
reusableCtx = reusableCanvas.getContext("2d");
|
|
143
|
+
if (!reusableCtx) {
|
|
144
|
+
console.error("[Ascii] Failed to create 2D canvas context for character atlas");
|
|
145
|
+
throw new Error("Ascii shader: Canvas 2D context unavailable");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!reusableCtx) {
|
|
149
|
+
console.error("[Ascii] Canvas context unexpectedly null during atlas creation");
|
|
150
|
+
throw new Error("Ascii shader: Canvas 2D context unavailable");
|
|
151
|
+
}
|
|
152
|
+
const ctx = reusableCtx;
|
|
153
|
+
ctx.clearRect(0, 0, ATLAS_TEXTURE_SIZE, ATLAS_TEXTURE_SIZE);
|
|
140
154
|
ctx.fillStyle = "#ffffff";
|
|
141
155
|
ctx.font = `${fontSize}px "${fontFamily}", ${fontFamily}, monospace`;
|
|
142
156
|
if (!ctx.font.includes(fontFamily) && !ctx.font.includes("IBM") && !ctx.font.includes("Plex")) ctx.font = `${fontSize}px ${fontFamily}, monospace`;
|
|
@@ -149,9 +163,11 @@ const componentDefinition = {
|
|
|
149
163
|
const y = row * actualCellSize + actualCellSize / 2;
|
|
150
164
|
ctx.fillText(char, x, y);
|
|
151
165
|
}
|
|
152
|
-
const imageData = ctx.getImageData(0, 0,
|
|
166
|
+
const imageData = ctx.getImageData(0, 0, ATLAS_TEXTURE_SIZE, ATLAS_TEXTURE_SIZE);
|
|
167
|
+
if (!reusableDataBuffer) reusableDataBuffer = new Uint8Array(ATLAS_TEXTURE_SIZE * ATLAS_TEXTURE_SIZE * 4);
|
|
168
|
+
reusableDataBuffer.set(imageData.data);
|
|
153
169
|
return {
|
|
154
|
-
data:
|
|
170
|
+
data: reusableDataBuffer,
|
|
155
171
|
width: ATLAS_TEXTURE_SIZE,
|
|
156
172
|
height: ATLAS_TEXTURE_SIZE,
|
|
157
173
|
atlasSize: atlasSize$1,
|
|
@@ -255,6 +271,13 @@ const componentDefinition = {
|
|
|
255
271
|
});
|
|
256
272
|
onCleanup(() => {
|
|
257
273
|
atlasTexture.dispose();
|
|
274
|
+
if (reusableCanvas) {
|
|
275
|
+
reusableCanvas.width = 0;
|
|
276
|
+
reusableCanvas.height = 0;
|
|
277
|
+
reusableCanvas = null;
|
|
278
|
+
reusableCtx = null;
|
|
279
|
+
}
|
|
280
|
+
reusableDataBuffer = null;
|
|
258
281
|
});
|
|
259
282
|
const effectiveCellSize = cellSizeUniform.mul(1.5);
|
|
260
283
|
const mainGridSize = viewportSize.div(effectiveCellSize);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { i as transformColorSpace,
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
3
3
|
import { clamp, float, max, mix, pow, screenUV, smoothstep, sqrt, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "Beam",
|
|
6
6
|
category: "Base Layers",
|
|
7
7
|
description: "A beam of light from one point to another.",
|
|
8
|
-
acceptsUVContext: true,
|
|
9
8
|
props: {
|
|
10
9
|
startPosition: {
|
|
11
10
|
default: {
|
|
@@ -104,8 +103,8 @@ const componentDefinition = {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
},
|
|
107
|
-
fragmentNode: ({ uniforms
|
|
108
|
-
const baseUV =
|
|
106
|
+
fragmentNode: ({ uniforms }) => {
|
|
107
|
+
const baseUV = screenUV;
|
|
109
108
|
const aspect = viewportSize.x.div(viewportSize.y);
|
|
110
109
|
const startPos = vec2(uniforms.startPosition.uniform.x, uniforms.startPosition.uniform.y.oneMinus());
|
|
111
110
|
const endPos = vec2(uniforms.endPosition.uniform.x, uniforms.endPosition.uniform.y.oneMinus());
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
|
+
import { t as createAnimatedTime } from "./time-DgRTVr2F.js";
|
|
3
3
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
4
4
|
import { dot, float, length, max, normalize, pow, reflect, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
5
5
|
const componentDefinition = {
|
|
6
6
|
name: "Blob",
|
|
7
7
|
category: "Base Layers",
|
|
8
8
|
description: "Organic animated blob with 3D lighting and gradients",
|
|
9
|
-
acceptsUVContext: true,
|
|
10
9
|
props: {
|
|
11
10
|
colorA: {
|
|
12
11
|
default: "#ff6b35",
|
|
@@ -158,8 +157,8 @@ const componentDefinition = {
|
|
|
158
157
|
}
|
|
159
158
|
},
|
|
160
159
|
fragmentNode: (params) => {
|
|
161
|
-
const { uniforms
|
|
162
|
-
const baseUV =
|
|
160
|
+
const { uniforms } = params;
|
|
161
|
+
const baseUV = screenUV;
|
|
163
162
|
const animTime = createAnimatedTime(params, uniforms.speed, uniforms.seed);
|
|
164
163
|
const colorA = uniforms.colorA.uniform;
|
|
165
164
|
const colorB = uniforms.colorB.uniform;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as applyEdgeHandling } from "./edges-
|
|
2
|
-
import {
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
|
+
import { o as transformEdges, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
3
3
|
import { convertToTexture, float, length, max, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "Bulge",
|
|
@@ -81,25 +81,6 @@ const componentDefinition = {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
|
-
uvTransformNode: ({ uv: uv$1, uniforms, viewportSize: viewportSize$1 }) => {
|
|
85
|
-
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
86
|
-
const aspectCorrectedUV = vec2(uv$1.x.mul(aspect), uv$1.y);
|
|
87
|
-
const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
|
|
88
|
-
const delta = aspectCorrectedUV.sub(centerPos);
|
|
89
|
-
const distance$1 = length(delta);
|
|
90
|
-
const effectRadius = uniforms.radius.uniform.mul(.5);
|
|
91
|
-
const falloffAmount = uniforms.falloff.uniform;
|
|
92
|
-
const smoothFalloff = smoothstep(effectRadius.mul(float(1).sub(falloffAmount).sub(float(.001)).max(float(0))), effectRadius, distance$1).oneMinus();
|
|
93
|
-
const normalizedDist = distance$1.div(effectRadius);
|
|
94
|
-
const distSq = normalizedDist.mul(normalizedDist);
|
|
95
|
-
const quadraticFalloff = max(float(0), float(1).sub(distSq));
|
|
96
|
-
const falloff = smoothFalloff.mul(quadraticFalloff);
|
|
97
|
-
const displacementAmount = uniforms.strength.uniform.negate().mul(falloff);
|
|
98
|
-
const scaleFactor = float(1).add(displacementAmount);
|
|
99
|
-
const bulgedDelta = delta.mul(scaleFactor);
|
|
100
|
-
const bulgedUV = centerPos.add(bulgedDelta);
|
|
101
|
-
return vec2(bulgedUV.x.div(aspect), bulgedUV.y);
|
|
102
|
-
},
|
|
103
84
|
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
104
85
|
if (!childNode) return vec4(0, 0, 0, 0);
|
|
105
86
|
const childTexture = convertToTexture(childNode);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
3
3
|
import { float, floor, fract, min, mod, screenUV, smoothstep, vec2, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "Checkerboard",
|
|
6
6
|
category: "Base Layers",
|
|
7
7
|
description: "Classic checkerboard pattern with two alternating colors",
|
|
8
|
-
acceptsUVContext: true,
|
|
9
8
|
props: {
|
|
10
9
|
colorA: {
|
|
11
10
|
default: "#cccccc",
|
|
@@ -58,8 +57,8 @@ const componentDefinition = {
|
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
},
|
|
61
|
-
fragmentNode: ({ uniforms
|
|
62
|
-
const uv$1 =
|
|
60
|
+
fragmentNode: ({ uniforms }) => {
|
|
61
|
+
const uv$1 = screenUV;
|
|
63
62
|
const aspect = viewportSize.x.div(viewportSize.y);
|
|
64
63
|
const correctedUV = vec2(uv$1.x.mul(aspect), uv$1.y.oneMinus());
|
|
65
64
|
const cells = uniforms.cells.uniform;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as transformColor } from "./transformations-
|
|
1
|
+
import { r as transformColor } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
|
|
3
3
|
import { float, mix, screenUV, smoothstep, texture, uniform, vec2, vec4 } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
@@ -89,6 +89,8 @@ const componentDefinition = {
|
|
|
89
89
|
const GRID_SIZE = 128;
|
|
90
90
|
const displacementData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
91
91
|
const liquidData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
92
|
+
const tempDisplacementData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
93
|
+
const tempLiquidData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
92
94
|
const displacementTexture = new DataTexture(displacementData, GRID_SIZE, GRID_SIZE, RGFormat, FloatType);
|
|
93
95
|
displacementTexture.magFilter = LinearFilter;
|
|
94
96
|
displacementTexture.minFilter = LinearFilter;
|
|
@@ -119,15 +121,15 @@ const componentDefinition = {
|
|
|
119
121
|
const intensity = uniforms.intensity.uniform.value;
|
|
120
122
|
const radius = uniforms.radius.uniform.value * .05;
|
|
121
123
|
const momentum = uniforms.momentum.uniform.value;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
tempDisplacementData.set(displacementData);
|
|
125
|
+
tempLiquidData.set(liquidData);
|
|
124
126
|
const flowFadeRate = 1 - dt / Math.max(.1, 1);
|
|
125
|
-
for (let i = 0; i < GRID_SIZE * GRID_SIZE * 2; i++)
|
|
127
|
+
for (let i = 0; i < GRID_SIZE * GRID_SIZE * 2; i++) tempDisplacementData[i] = displacementData[i] * flowFadeRate;
|
|
126
128
|
for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
|
|
127
129
|
const idx = (i * GRID_SIZE + j) * 2;
|
|
128
130
|
const liquidFadeRate = 1 - dt / Math.max(.4, 1);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
tempLiquidData[idx] = liquidData[idx] * liquidFadeRate;
|
|
132
|
+
tempLiquidData[idx + 1] = liquidData[idx + 1] * liquidFadeRate;
|
|
131
133
|
if (Math.abs(displacementData[idx]) > .001 || Math.abs(displacementData[idx + 1]) > .001) {
|
|
132
134
|
const flowSpeed = momentum * 50 * dt;
|
|
133
135
|
const advectX = j - displacementData[idx] * flowSpeed;
|
|
@@ -143,7 +145,7 @@ const componentDefinition = {
|
|
|
143
145
|
const idx01 = (y0 * GRID_SIZE + x1) * 2;
|
|
144
146
|
const idx10 = (y1 * GRID_SIZE + x0) * 2;
|
|
145
147
|
const idx11 = (y1 * GRID_SIZE + x1) * 2;
|
|
146
|
-
|
|
148
|
+
tempLiquidData[idx] = (liquidData[idx00] * (1 - fx) * (1 - fy) + liquidData[idx01] * fx * (1 - fy) + liquidData[idx10] * (1 - fx) * fy + liquidData[idx11] * fx * fy) * liquidFadeRate;
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
}
|
|
@@ -158,19 +160,19 @@ const componentDefinition = {
|
|
|
158
160
|
const effectiveRadius = radius * Math.min(speed * speed * 20, 1);
|
|
159
161
|
if (dist < effectiveRadius * 2 && Math.abs(velX) + Math.abs(velY) > .01) {
|
|
160
162
|
const influence = Math.exp(-dist * dist / (effectiveRadius * effectiveRadius));
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
tempDisplacementData[idx] += mouseVelX.value * influence * (intensity * 100) * dt * .01;
|
|
164
|
+
tempDisplacementData[idx + 1] += mouseVelY.value * influence * (intensity * 100) * dt * .01;
|
|
163
165
|
const speedMultiplier = Math.min(speed * 10, 1);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
tempLiquidData[idx] += influence * (intensity * 100) * dt * .01 * speedMultiplier;
|
|
167
|
+
tempLiquidData[idx + 1] = 0;
|
|
166
168
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
tempDisplacementData[idx] = Math.max(-1, Math.min(1, tempDisplacementData[idx]));
|
|
170
|
+
tempDisplacementData[idx + 1] = Math.max(-1, Math.min(1, tempDisplacementData[idx + 1]));
|
|
171
|
+
tempLiquidData[idx] = Math.max(0, Math.min(1, tempLiquidData[idx]));
|
|
172
|
+
tempLiquidData[idx + 1] = 0;
|
|
171
173
|
}
|
|
172
|
-
displacementData.set(
|
|
173
|
-
liquidData.set(
|
|
174
|
+
displacementData.set(tempDisplacementData);
|
|
175
|
+
liquidData.set(tempLiquidData);
|
|
174
176
|
displacementTexture.needsUpdate = true;
|
|
175
177
|
liquidTexture.needsUpdate = true;
|
|
176
178
|
prevX = pointer.x;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as transformAngle } from "./transformations-
|
|
1
|
+
import { n as transformAngle } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { convertToTexture, cos, radians, screenUV, sin, vec2, vec4 } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "ChromaticAberration",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as transformColor, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { length, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "Circle",
|
|
5
5
|
category: "Base Layers",
|
|
6
6
|
description: "Generate a circle with adjustable size and softness",
|
|
7
|
-
acceptsUVContext: true,
|
|
8
7
|
props: {
|
|
9
8
|
color: {
|
|
10
9
|
default: "#ffffff",
|
|
@@ -50,8 +49,8 @@ const componentDefinition = {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
|
-
fragmentNode: ({ uniforms
|
|
54
|
-
const uv$1 =
|
|
52
|
+
fragmentNode: ({ uniforms }) => {
|
|
53
|
+
const uv$1 = screenUV;
|
|
55
54
|
const aspect = viewportSize.x.div(viewportSize.y);
|
|
56
55
|
const aspectCorrectedUV = vec2(uv$1.x.mul(aspect), uv$1.y);
|
|
57
56
|
const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
3
3
|
import { DataTexture, FloatType, LinearFilter, RGBAFormat } from "three";
|
|
4
4
|
import { float, screenUV, step, texture, vec2, vec4 } from "three/tsl";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as applyEdgeHandling } from "./edges-
|
|
2
|
-
import {
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
|
+
import { o as transformEdges } from "./transformations-YbhRK-rd.js";
|
|
3
3
|
import { convertToTexture, dot, fract, screenUV, sin, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "DiffuseBlur",
|
|
@@ -47,17 +47,6 @@ const componentDefinition = {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
uvTransformNode: ({ uv: uv$1, uniforms, viewportSize: viewportSize$1 }) => {
|
|
51
|
-
const hash = (p) => {
|
|
52
|
-
return fract(sin(dot(p, vec2(12.9898, 78.233).mul(2))).mul(43758.5453));
|
|
53
|
-
};
|
|
54
|
-
const pixelSize = vec2(1).div(viewportSize$1);
|
|
55
|
-
const seed = uv$1.mul(1e3);
|
|
56
|
-
const rand1 = hash(seed);
|
|
57
|
-
const rand2 = hash(seed.add(vec2(73.2, 41.9)));
|
|
58
|
-
const offset = vec2(rand1.mul(2).sub(1), rand2.mul(2).sub(1)).mul(uniforms.intensity.uniform).mul(pixelSize);
|
|
59
|
-
return uv$1.add(offset);
|
|
60
|
-
},
|
|
61
50
|
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
62
51
|
if (!childNode) return vec4(0, 0, 0, 0);
|
|
63
52
|
const childTexture = convertToTexture(childNode);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as transformColor } from "./transformations-
|
|
1
|
+
import { r as transformColor } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { dot, floor, mix, screenUV, step, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "Dither",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { r as transformColor } from "./transformations-
|
|
1
|
+
import { r as transformColor } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { float, floor, fwidth, length, mix, screenUV, sin, smoothstep, time, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "DotGrid",
|
|
5
5
|
category: "Base Layers",
|
|
6
6
|
description: "Grid of dots with optional twinkling animation",
|
|
7
|
-
acceptsUVContext: true,
|
|
8
7
|
props: {
|
|
9
8
|
color: {
|
|
10
9
|
default: "#ffffff",
|
|
@@ -49,8 +48,8 @@ const componentDefinition = {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
|
-
fragmentNode: ({ uniforms
|
|
53
|
-
const uvCoords =
|
|
51
|
+
fragmentNode: ({ uniforms }) => {
|
|
52
|
+
const uvCoords = screenUV;
|
|
54
53
|
const density = uniforms.density.uniform;
|
|
55
54
|
const dotSize = uniforms.dotSize.uniform;
|
|
56
55
|
const dotColor = uniforms.color.uniform;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
3
3
|
import { convertToTexture, dot, screenUV, smoothstep, vec3, vec4 } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
@@ -4,7 +4,6 @@ const componentDefinition = {
|
|
|
4
4
|
category: "Stylize",
|
|
5
5
|
description: "Analog film grain texture overlay",
|
|
6
6
|
requiresChild: true,
|
|
7
|
-
acceptsUVContext: true,
|
|
8
7
|
props: { strength: {
|
|
9
8
|
default: .5,
|
|
10
9
|
description: "Intensity of the film grain noise",
|
|
@@ -16,10 +15,10 @@ const componentDefinition = {
|
|
|
16
15
|
label: "Strength"
|
|
17
16
|
}
|
|
18
17
|
} },
|
|
19
|
-
fragmentNode: ({ uniforms, childNode
|
|
18
|
+
fragmentNode: ({ uniforms, childNode }) => {
|
|
20
19
|
const strength = uniforms.strength.uniform;
|
|
21
20
|
const sourceColor = childNode || vec4(0, 0, 0, 0);
|
|
22
|
-
const grainIntensity = fract(sin(dot(
|
|
21
|
+
const grainIntensity = fract(sin(dot(screenUV, vec2(float(12.9898), float(78.233)).mul(float(2)))).mul(float(43758.5453))).mul(float(2)).sub(float(1)).mul(strength.mul(float(.1)));
|
|
23
22
|
return vec4(sourceColor.rgb.add(grainIntensity), sourceColor.a);
|
|
24
23
|
}
|
|
25
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as transformColor } from "./transformations-
|
|
1
|
+
import { r as transformColor } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { Fn, cos, dot, float, floor, fract, length, min, mix, screenUV, sin, smoothstep, time, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
var hash1_2 = Fn(([p]) => {
|
|
4
4
|
return fract(sin(dot(p, vec2(127.1, 311.7))).mul(43758.5453123));
|
|
@@ -24,7 +24,6 @@ const componentDefinition = {
|
|
|
24
24
|
category: "Base Layers",
|
|
25
25
|
description: "Animated floating particles with twinkle effects",
|
|
26
26
|
requiresRTT: false,
|
|
27
|
-
acceptsUVContext: true,
|
|
28
27
|
props: {
|
|
29
28
|
randomness: {
|
|
30
29
|
default: .25,
|
|
@@ -146,8 +145,8 @@ const componentDefinition = {
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
},
|
|
149
|
-
fragmentNode: ({ uniforms, childNode
|
|
150
|
-
const baseUV =
|
|
148
|
+
fragmentNode: ({ uniforms, childNode }) => {
|
|
149
|
+
const baseUV = screenUV;
|
|
151
150
|
const renderParticle = Fn(([uv$2]) => {
|
|
152
151
|
const rootUV = floor(uv$2);
|
|
153
152
|
const localPos = fract(uv$2);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { add, convertToTexture, div, floor, mul, screenUV,
|
|
1
|
+
import { add, convertToTexture, div, floor, mul, screenUV, sub, uniform, vec2, vec4 } from "three/tsl";
|
|
2
2
|
const componentDefinition = {
|
|
3
3
|
name: "GlassTiles",
|
|
4
4
|
category: "Distortions",
|
|
@@ -29,18 +29,6 @@ const componentDefinition = {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
uvTransformNode: ({ uv: uv$1, uniforms, viewportSize: viewportSize$1 }) => {
|
|
33
|
-
const intensity = uniforms.intensity.uniform;
|
|
34
|
-
const baseTileCount = uniforms.tileCount.uniform;
|
|
35
|
-
const aspectRatio = viewportSize$1.x.div(viewportSize$1.y);
|
|
36
|
-
const tileCount = vec2(select(aspectRatio.greaterThanEqual(1), baseTileCount.mul(aspectRatio), baseTileCount), select(aspectRatio.lessThan(1), baseTileCount.div(aspectRatio), baseTileCount));
|
|
37
|
-
const cellCoord = floor(uv$1.mul(tileCount)).div(tileCount);
|
|
38
|
-
const localUV = uv$1.sub(cellCoord);
|
|
39
|
-
const distortionCenter = vec2(.5, .5);
|
|
40
|
-
const distortionFactor = intensity.mul(.025);
|
|
41
|
-
const distortion = localUV.div(vec2(1, 1).div(tileCount)).sub(distortionCenter).mul(distortionFactor);
|
|
42
|
-
return localUV.add(distortion).add(cellCoord);
|
|
43
|
-
},
|
|
44
32
|
fragmentNode: ({ uniforms, childNode, dimensions, onCleanup }) => {
|
|
45
33
|
if (!childNode) {
|
|
46
34
|
console.error("You must pass a child component into the Glass Tiles shader.");
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as transformColor, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { Fn, PI, abs, atan, clamp, float, length, mix, pow, screenUV, sin, smoothstep, time, vec2, vec4 } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "Godrays",
|
|
5
5
|
category: "Base Layers",
|
|
6
6
|
description: "Volumetric light rays emanating from a point",
|
|
7
7
|
requiresRTT: false,
|
|
8
|
-
acceptsUVContext: true,
|
|
9
8
|
props: {
|
|
10
9
|
center: {
|
|
11
10
|
default: {
|
|
@@ -82,8 +81,8 @@ const componentDefinition = {
|
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
},
|
|
85
|
-
fragmentNode: ({ uniforms
|
|
86
|
-
const uv$1 =
|
|
84
|
+
fragmentNode: ({ uniforms }) => {
|
|
85
|
+
const uv$1 = screenUV;
|
|
87
86
|
const centerPos = vec2(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
88
87
|
const shapeUV = uv$1.sub(centerPos);
|
|
89
88
|
const valueNoise = Fn(([st]) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { r as transformColor } from "./transformations-
|
|
1
|
+
import { r as transformColor } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { fract, fwidth, max, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "Grid",
|
|
5
5
|
category: "Base Layers",
|
|
6
6
|
description: "Simple grid lines pattern with adjustable thickness",
|
|
7
|
-
acceptsUVContext: true,
|
|
8
7
|
props: {
|
|
9
8
|
color: {
|
|
10
9
|
default: "#ffffff",
|
|
@@ -38,8 +37,8 @@ const componentDefinition = {
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
},
|
|
41
|
-
fragmentNode: ({ uniforms
|
|
42
|
-
const uv$1 =
|
|
40
|
+
fragmentNode: ({ uniforms }) => {
|
|
41
|
+
const uv$1 = screenUV;
|
|
43
42
|
const aspect = viewportSize.x.div(viewportSize.y);
|
|
44
43
|
const correctedUV = vec2(uv$1.x.mul(aspect), uv$1.y.oneMinus());
|
|
45
44
|
const cells = uniforms.cells.uniform;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as applyEdgeHandling } from "./edges-
|
|
2
|
-
import {
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
|
+
import { o as transformEdges } from "./transformations-YbhRK-rd.js";
|
|
3
3
|
import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
|
|
4
4
|
import { convertToTexture, float, screenUV, texture, uniform, vec2, vec4 } from "three/tsl";
|
|
5
5
|
var DEFAULT_GRID_SIZE = 20;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as transformAngle } from "./transformations-
|
|
1
|
+
import { n as transformAngle } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { cos, dot, fract, length, radians, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "Halftone",
|
|
@@ -4,7 +4,6 @@ const componentDefinition = {
|
|
|
4
4
|
name: "ImageTexture",
|
|
5
5
|
category: "Base Layers",
|
|
6
6
|
description: "Display an image with customizable object-fit modes",
|
|
7
|
-
acceptsUVContext: true,
|
|
8
7
|
props: {
|
|
9
8
|
url: {
|
|
10
9
|
default: "https://shaders.com/sample.jpg",
|
|
@@ -54,8 +53,8 @@ const componentDefinition = {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
},
|
|
57
|
-
fragmentNode: ({ uniforms, onCleanup, onBeforeRender
|
|
58
|
-
const baseUV =
|
|
56
|
+
fragmentNode: ({ uniforms, onCleanup, onBeforeRender }) => {
|
|
57
|
+
const baseUV = screenUV;
|
|
59
58
|
const loader = new TextureLoader();
|
|
60
59
|
let currentUrl = "";
|
|
61
60
|
let isLoading = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as transformAngle } from "./transformations-
|
|
1
|
+
import { n as transformAngle } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { Fn, convertToTexture, cos, float, radians, screenUV, sin, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "LinearBlur",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as transformColorSpace, n as transformAngle, o as transformEdges, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
3
3
|
import { abs, cos, dot, float, fract, length, mod, normalize, radians, screenUV, sin, vec2, vec4 } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "LinearGradient",
|
|
6
6
|
category: "Base Layers",
|
|
7
7
|
description: "Create smooth linear color gradients",
|
|
8
|
-
acceptsUVContext: true,
|
|
9
8
|
props: {
|
|
10
9
|
colorA: {
|
|
11
10
|
default: "#1aff00",
|
|
@@ -99,8 +98,8 @@ const componentDefinition = {
|
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
},
|
|
102
|
-
fragmentNode: ({ uniforms
|
|
103
|
-
const uv$1 =
|
|
101
|
+
fragmentNode: ({ uniforms }) => {
|
|
102
|
+
const uv$1 = screenUV;
|
|
104
103
|
const startPos = vec2(uniforms.start.uniform[0], uniforms.start.uniform[1].oneMinus());
|
|
105
104
|
const endPos = vec2(uniforms.end.uniform[0], uniforms.end.uniform[1].oneMinus());
|
|
106
105
|
const gradientVector = endPos.sub(startPos);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as applyEdgeHandling } from "./edges-
|
|
2
|
-
import {
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
|
+
import { o as transformEdges } from "./transformations-YbhRK-rd.js";
|
|
3
3
|
import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
|
|
4
4
|
import { convertToTexture, float, screenUV, texture, uniform, vec2, vec4 } from "three/tsl";
|
|
5
5
|
var GRID_SIZE = 32;
|
|
@@ -101,12 +101,6 @@ const componentDefinition = {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
|
-
uvTransformNode: ({ uv: uv$1, uniforms }) => {
|
|
105
|
-
const displacement = getOrCreateDisplacementState(uniforms).tslNode.sample(uv$1).xy;
|
|
106
|
-
const maxDisplacement = float(.2);
|
|
107
|
-
const clampedDisplacement = displacement.clamp(vec2(maxDisplacement.negate(), maxDisplacement.negate()), vec2(maxDisplacement, maxDisplacement));
|
|
108
|
-
return uv$1.sub(clampedDisplacement);
|
|
109
|
-
},
|
|
110
104
|
fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup }) => {
|
|
111
105
|
const { dataTexture: displacementTexture, data: displacementData, tslNode: displacementField } = getOrCreateDisplacementState(uniforms);
|
|
112
106
|
const mouseVelX = uniform(0);
|
|
@@ -16,10 +16,6 @@ const componentDefinition = {
|
|
|
16
16
|
label: "Scale"
|
|
17
17
|
}
|
|
18
18
|
} },
|
|
19
|
-
uvTransformNode: ({ uv: uv$1, uniforms }) => {
|
|
20
|
-
const pixelSize = uniforms.scale.uniform;
|
|
21
|
-
return floor(uv$1.mul(pixelSize)).div(pixelSize);
|
|
22
|
-
},
|
|
23
19
|
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
24
20
|
if (!childNode) return vec4(0, 0, 0, 0);
|
|
25
21
|
const childTexture = convertToTexture(childNode);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as applyEdgeHandling } from "./edges-
|
|
2
|
-
import {
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
|
+
import { o as transformEdges, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
3
3
|
import { PI, atan, convertToTexture, length, mix, screenUV, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "PolarCoordinates",
|
|
@@ -81,15 +81,6 @@ const componentDefinition = {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
|
-
uvTransformNode: ({ uv: uv$1, uniforms, viewportSize: viewportSize$1 }) => {
|
|
85
|
-
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
86
|
-
const aspectCorrectedUV = vec2(uv$1.x.mul(aspect), uv$1.y);
|
|
87
|
-
const centerPos = vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus());
|
|
88
|
-
const delta = aspectCorrectedUV.sub(centerPos);
|
|
89
|
-
const normalizedAngle = atan(delta.y, delta.x).add(PI).div(PI.mul(2));
|
|
90
|
-
const r = length(delta);
|
|
91
|
-
return mix(uv$1, vec2(normalizedAngle.mul(uniforms.wrap.uniform), r.mul(uniforms.radius.uniform)), uniforms.intensity.uniform);
|
|
92
|
-
},
|
|
93
84
|
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
94
85
|
if (!childNode) return vec4(0, 0, 0, 0);
|
|
95
86
|
const childTexture = convertToTexture(childNode);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as transformAngle,
|
|
1
|
+
import { n as transformAngle, s as transformPosition } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { Fn, convertToTexture, cos, float, max, radians, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
|
|
3
3
|
const componentDefinition = {
|
|
4
4
|
name: "ProgressiveBlur",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { i as transformColorSpace,
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
|
|
2
2
|
import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
|
|
3
3
|
import { distance, float, screenUV, vec2, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "RadialGradient",
|
|
6
6
|
category: "Base Layers",
|
|
7
7
|
description: "Radial gradient radiating from a center point",
|
|
8
|
-
acceptsUVContext: true,
|
|
9
8
|
props: {
|
|
10
9
|
colorA: {
|
|
11
10
|
default: "#ff0000",
|
|
@@ -59,8 +58,8 @@ const componentDefinition = {
|
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
|
-
fragmentNode: ({ uniforms
|
|
63
|
-
const uv$1 =
|
|
61
|
+
fragmentNode: ({ uniforms }) => {
|
|
62
|
+
const uv$1 = screenUV;
|
|
64
63
|
const aspect = viewportSize.x.div(viewportSize.y);
|
|
65
64
|
const t = distance(vec2(uv$1.x.mul(aspect), uv$1.y), vec2(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus())).div(uniforms.radius.uniform).clamp(float(0), float(1));
|
|
66
65
|
return mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, t, uniforms.colorSpace.uniform);
|