Add mouse, resolution, and time-based uniforms to bloomShaderCallback #7999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the existing
bloomShaderCallback
in thepreview/global/sketch.js
example to demonstrate how commonly used uniforms can be integrated with p5.strands. The following uniforms were added:mouse
: current mouse position ([mouseX, mouseY]
)resolution
: current canvas size ([width, height]
)millis
: time in ms since the sketch startedframeCount
: total number of frames rendereddeltaTime
: time elapsed between framesThese values are passed into the shader using
uniformVec2
anduniformFloat
, then used in the bloom shader’s glow calculation.This contribution addresses #7849, specifically the need to bridge p5.js values like
mouseX
,width
,millis()
, andframeCount
into thep5.strands
system.Test Plan
preview/global/sketch.js
millis
)The result should reflect both interactive and time-based changes.
cc: @davepagurek @ksen0 @lukeplowden
PR Checklist
npm run lint
passes