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

Remove custom pipeline #196

Merged
merged 2 commits into from
Feb 7, 2023
Merged

Remove custom pipeline #196

merged 2 commits into from
Feb 7, 2023

Conversation

rparrett
Copy link
Contributor

@rparrett rparrett commented Feb 4, 2023

I was curious to see if this was possible and it was, so I'll open this up for discussion.

The benefits would be that we get to delete a bunch of code that is usually painful to migrate, and maybe Bevy will implement batching for Mesh2d some day.

The main hacky bit is that the MaterialMesh2dBundle needs a white color material for the vertex colors to work properly (bevy's default is fuchsia and the color is multiplied) and I'm currently just creating that every time remeshing happens. At the very least, that could be cleaned up so that it only happens on shape creation.

But I'm hoping for something cleaner. That probably involves using our own material/shader, which should be a lot less involved than a full-on custom pipeline. I'll investigate that soon.

I'm also not sure if it's possible to get lyon to tesselate with the correct winding order, so I just reversed the indices.

@rparrett rparrett marked this pull request as draft February 4, 2023 02:19
@rparrett
Copy link
Contributor Author

rparrett commented Feb 4, 2023

Here's a branch with a custom ShapeMaterial
https://github.com/rparrett/bevy_prototype_lyon/tree/shape_material
This re-introduces a bit of rendering boilerplate, but it looks pretty reasonable, actually.

And expanding that with texture support:
https://github.com/rparrett/bevy_prototype_lyon/tree/shape_material_uvs
I need to investigate whether the texture "flag" is totally necessary, and figure out what the UX for adding a texture to a shape should be.

@rparrett
Copy link
Contributor Author

rparrett commented Feb 7, 2023

My current plan is to rebase and use the ShapeMaterial option and leave supporting textures as future work.

This actually got a bit simpler after bevyengine/bevy#7514.

@Nilirad
Copy link
Owner

Nilirad commented Feb 7, 2023

This actually got a bit simpler after bevyengine/bevy#7514.

That's good. I remember culling was one of the problems I faced with the original renderer that induced me to create a custom pipeline, since Lyon seemed to not to do winding correctly.

@rparrett rparrett force-pushed the mesh2d branch 3 times, most recently from 7fa8f91 to 655a693 Compare February 7, 2023 16:42
@rparrett rparrett marked this pull request as ready for review February 7, 2023 16:44
@Nilirad
Copy link
Owner

Nilirad commented Feb 7, 2023

Looks good! Make sure to appease clippy and I think we're ready to go.

@Nilirad Nilirad merged commit 8b3d584 into Nilirad:master Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants