-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Materials can now use the screen texture (#2849)
https://github.com/excaliburjs/Excalibur/assets/612071/ade92ec3-caff-4835-8410-74f4ebbbe421 This PR adds a new feature for materials that allows them to reference the screen texture. They way it works is it's the screen's framebuffer RIGHT before the material draw call (if you include the complete drawing you get the infinite mirror artifact which is pretty unusable) 2 new uniforms * `u_screen_texture` - This is the texture of the screen right before the material draw call * `u_time_ms` - This is the milliseconds since page navigation (`performance.now()` under the hood) 2 new attribute/varyings * `a_screenuv` - The vertex attribute corresponding to the screen uv relative to the current graphic * `v_screenuv` - The fragment varying corresponding to the screen uv relative to the current graphic Finally there is a new convenience api for updating shader values in materials. `.update(shader => {...})` ```typescript game.input.pointers.primary.on('move', evt => { heartActor.pos = evt.worldPos; swirlMaterial.update(shader => { shader.trySetUniformFloatVector('iMouse', evt.worldPos); }); }); ```
- Loading branch information
Showing
9 changed files
with
341 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.