Skip to content
Next Next commit
Alias GLSL mix as p5.strands lerp for shader consistency #7875
  • Loading branch information
LalitNarayanYadav authored Jun 7, 2025
commit c395deeb70e191b14e867c23f37b6a0dd7a09de3
11 changes: 11 additions & 0 deletions src/webgl/ShaderGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,17 @@
})
}

// Alias GLSL's mix function as lerp in p5.strands
// Bridging p5.js lerp and GLSL mix for consistency in shader expressions
const originalLerp = fn.lerp;

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/accessibility/outputs.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/color/color_conversion.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/color/setting.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/environment.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/main.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/p5.Graphics.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/rendering.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/structure.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/version.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22

Check failure on line 1625 in src/webgl/ShaderGenerator.js

View workflow job for this annotation

GitHub Actions / test

test/unit/core/vertex.js

ReferenceError: fn is not defined ❯ src/webgl/ShaderGenerator.js:1625:22
fn.lerp = function (...args) {
if (GLOBAL_SHADER?.isGenerating) {
return fn.mix(...args); // Use mix inside p5.strands
} else {
return originalLerp.apply(this, args); // Fallback to normal p5.js lerp
}
};

export default shadergenerator;

if (typeof p5 !== 'undefined') {
Expand Down