bevy/crates/bevy_sprite/src
robtfm c99351f7c2
allow extensions to StandardMaterial (#7820)
# Objective

allow extending `Material`s (including the built in `StandardMaterial`)
with custom vertex/fragment shaders and additional data, to easily get
pbr lighting with custom modifications, or otherwise extend a base
material.

# Solution

- added `ExtendedMaterial<B: Material, E: MaterialExtension>` which
contains a base material and a user-defined extension.
- added example `extended_material` showing how to use it
- modified AsBindGroup to have "unprepared" functions that return raw
resources / layout entries so that the extended material can combine
them

note: doesn't currently work with array resources, as i can't figure out
how to make the OwnedBindingResource::get_binding() work, as wgpu
requires a `&'a[&'a TextureView]` and i have a `Vec<TextureView>`.

# Migration Guide

manual implementations of `AsBindGroup` will need to be adjusted, the
changes are pretty straightforward and can be seen in the diff for e.g.
the `texture_binding_array` example.

---------

Co-authored-by: Robert Swain <robert.swain@gmail.com>
2023-10-17 21:28:08 +00:00
..
mesh2d allow extensions to StandardMaterial (#7820) 2023-10-17 21:28:08 +00:00
render Fix text2d view-visibility (#10100) 2023-10-13 19:14:31 +00:00
bundle.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
collide_aabb.rs Update docs to reflect that the shallowest and not the deepest penetr… (#8473) 2023-04-23 19:41:21 +00:00
dynamic_texture_atlas_builder.rs Doc bevy sprite (#7858) 2023-03-03 18:14:40 +00:00
lib.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
sprite.rs Make Anchor Copy (#9327) 2023-08-11 21:04:53 +00:00
texture_atlas_builder.rs Fix TextureAtlasBuilder padding (#10031) 2023-10-06 15:33:57 +00:00
texture_atlas.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00