Skip to content

Commit 0cd9448

Browse files
Bridge p5.js noise with GLSL noise in p5.strands
1 parent df4c546 commit 0cd9448

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/webgl/ShaderGenerator.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,12 +1631,10 @@ function shadergenerator(p5, fn) {
16311631
return originalLerp.apply(this, args); // Fallback to normal p5.js lerp
16321632
}
16331633
};
1634+
const originalNoise = fn.noise;
16341635
fn.noise = function (...args) {
16351636
if (!GLOBAL_SHADER?.isGenerating) {
1636-
p5._friendlyError(
1637-
`It looks like you've called noise() outside of a shader's modify() function.`
1638-
);
1639-
return;
1637+
return originalNoise.apply(this, args); // fallback to regular p5.js noise
16401638
}
16411639

16421640
GLOBAL_SHADER.output.vertexDeclarations.add(noiseGLSL);

0 commit comments

Comments
 (0)