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

Custom shaders #428

Merged
merged 17 commits into from
Jul 23, 2023
Merged

Custom shaders #428

merged 17 commits into from
Jul 23, 2023

Conversation

StarArawn
Copy link
Owner

@StarArawn StarArawn commented May 13, 2023

This PR adds custom shaders to bevy_ecs_tilemap in the form of a MaterialTilemap trait. Users can create their own materials like:

#[derive(AsBindGroup, TypeUuid, Debug, Clone, Default)]
#[uuid = "31575692-a956-4762-98e2-5d457f552d0a"]
pub struct MyMaterial {}

impl MaterialTilemap for MyMaterial {
    fn fragment_shader() -> bevy::render::render_resource::ShaderRef {
        "custom_shader.wgsl".into()
    }
}

This works fundamentally in the same way as bevy's Material2d or Material3d traits.

Migration Guide:
TilemapBundle should be replaced with StandardTilemapBundle.
TilemapBundle<T: MaterialTilemap> is now used for custom materials.

@StarArawn StarArawn requested a review from rparrett May 13, 2023 12:08
@rparrett
Copy link
Collaborator

This is pretty neat.

Seeing a couple issues:

  • Seems like the chunking example is misbehaving when moving away from the origin.
  • The docs for TilemapBundle and StandardTilemapBundle are identical. Would be nice for those to explain how they differ and perhaps link to each other.

And just an opinion:

  • I think TilemapBundle is a better name for StandardTilemapBundle. It seems like users not doing fancy stuff shouldn't need to think about / migrate anything.

@StarArawn
Copy link
Owner Author

Closes: #443

@StarArawn StarArawn merged commit 9850dc6 into main Jul 23, 2023
4 checks passed
@StarArawn StarArawn deleted the custom-shaders branch July 23, 2023 15:22
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