bevy/crates/bevy_sprite/src/mesh2d
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
..
color_material.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
color_material.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
material.rs allow extensions to StandardMaterial (#7820) 2023-10-17 21:28:08 +00:00
mesh.rs Fix 2d_shapes and general 2D mesh instancing (#10051) 2023-10-08 20:17:01 +00:00
mesh2d.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
mesh2d_bindings.wgsl Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
mesh2d_functions.wgsl Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
mesh2d_types.wgsl Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
mesh2d_vertex_output.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
mesh2d_view_bindings.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
mesh2d_view_types.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
mod.rs Add 2d meshes and materials (#3460) 2022-01-08 01:29:08 +00:00