File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { ancestor } from 'acorn-walk';
99import escodegen from 'escodegen' ;
1010
1111function shadergenerator ( p5 , fn ) {
12+
1213 let GLOBAL_SHADER ;
1314 let BRANCH ;
1415
@@ -1618,7 +1619,19 @@ function shadergenerator(p5, fn) {
16181619 }
16191620 }
16201621 } )
1622+ // Alias GLSL's mix function as lerp in p5.strands
1623+ // Bridging p5.js lerp and GLSL mix for consistency in shader expressions
1624+ const originalLerp = fn . lerp ;
1625+ fn . lerp = function ( ...args ) {
1626+ if ( GLOBAL_SHADER ?. isGenerating ) {
1627+ return this . mix ( ...args ) ; // Use mix inside p5.strands
1628+ } else {
1629+ return originalLerp . apply ( this , args ) ; // Fallback to normal p5.js lerp
1630+ }
1631+ } ;
16211632}
1633+
1634+
16221635
16231636export default shadergenerator ;
16241637
You can’t perform that action at this time.
0 commit comments