Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [#2416] Add Postprocessor hooks and default some uniforms #2667

Merged
merged 4 commits into from
Jun 26, 2023

Conversation

eonarheim
Copy link
Member

@eonarheim eonarheim commented Jun 25, 2023

===:clipboard: PR Checklist :clipboard:===

  • 📌 issue exists in github for these changes
  • 🔬 existing tests still pass
  • 🙈 code conforms to the style guide
  • 📐 new tests written and passing / old tests updated with new scenario(s)
  • 📄 changelog entry added (or not needed)

==================

Closes #2416

This PR adds some new default uniforms supplied to postprocessors automatically if they are present in the source

  • uniform float u_time_ms - total playback time in milliseconds
  • uniform float u_elapsed_ms - the elapsed time from the last frame in milliseconds
  • uniform vec2 u_resolution - the resolution of the canvas (in pixels)

Custom uniforms can now be set in an optional onUpdate() function on postprocessors, the internal shader.use() is called for users.

Example using the CRT post processor, see gist https://gist.github.com/eonarheim/5ebb7f9161c10894935479e0caa0f6c7

image

@github-actions github-actions bot added the enhancement Label applied to enhancements or improvements to existing features label Jun 25, 2023
@eonarheim eonarheim merged commit 214e609 into main Jun 26, 2023
@eonarheim eonarheim deleted the feature/2416-postprocessor-lifecycle-hook branch June 26, 2023 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Label applied to enhancements or improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a convenient hook for Postprocessors to update
1 participant