Skip to content

Commit b924d1c

Browse files
Add GLSL noise function support in p5.strands via ShaderGenerator
1 parent 9515a62 commit b924d1c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/webgl/ShaderGenerator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { parse } from 'acorn';
88
import { ancestor } from 'acorn-walk';
99
import escodegen from 'escodegen';
10+
import noiseGLSL from './shaders/functions/noise.glsl.js';
1011

1112
function shadergenerator(p5, fn) {
1213

@@ -1578,6 +1579,7 @@ function shadergenerator(p5, fn) {
15781579
],
15791580
'sqrt': { args: ['genType'], returnType: 'genType', isp5Function: true},
15801581
'step': { args: ['genType', 'genType'], returnType: 'genType', isp5Function: false},
1582+
'noise': { args: ['vec2'], returnType: 'float', isp5Function: false },
15811583
'trunc': { args: ['genType'], returnType: 'genType', isp5Function: false},
15821584

15831585
////////// Vector //////////
@@ -1632,6 +1634,7 @@ function shadergenerator(p5, fn) {
16321634
}
16331635

16341636

1637+
GLOBAL_SHADER.output.fragmentDeclarations.add(noiseGLSL);
16351638

16361639
export default shadergenerator;
16371640

0 commit comments

Comments
 (0)