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: Custom Material/Shader per Actor Support #2670

Merged
merged 14 commits into from
Jul 5, 2023

Conversation

eonarheim
Copy link
Member

@eonarheim eonarheim commented Jun 27, 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)

==================
material

This PR adds custom material support which enables the custom shader per Actor. To do this there is a new ex.MaterialRenderer plugin which takes over from the default batch renderer (ex.ImageRenderer) if there is a material present then it will run the custom shader attached to the material. This works by setting ex.GraphicsComponent.material = someMaterial

const material = new ex.Material({
  name: 'test',
  fragmentSource,
  color: ex.Color.Red,
});

const actor.graphics.material = material;

Changes:

  • GraphicsComponent material support for whole actor shader support
  • Graphics context material support in save/restore
  • New ex.MaterialRenderer plugin
  • Updates to draw call to support materials

TODOs

  • Tests
  • API cleanup
  • Perf analysis

@github-actions github-actions bot added the enhancement Label applied to enhancements or improvements to existing features label Jun 27, 2023
@eonarheim eonarheim changed the title WIP: Custom Material/Shader per Actor Support feat: Custom Material/Shader per Actor Support Jul 5, 2023
@eonarheim eonarheim merged commit 357a72b into main Jul 5, 2023
@eonarheim eonarheim deleted the feature/custom-material-support branch July 5, 2023 03:18
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.

1 participant