bevy/assets/shaders
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
..
animate_shader.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
array_texture.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
cubemap_unlit.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
custom_gltf_2d.wgsl Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
custom_material.frag improve shader import model (#5703) 2023-06-27 00:29:22 +00:00
custom_material.vert fix shader_material_glsl example (#9513) 2023-08-21 07:58:21 +00:00
custom_material.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
custom_material_import.wgsl fix custom shader imports (#10030) 2023-10-06 01:34:57 +00:00
custom_material_screenspace_texture.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
custom_vertex_attribute.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
extended_material.wgsl allow extensions to StandardMaterial (#7820) 2023-10-17 21:28:08 +00:00
fallback_image_test.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
game_of_life.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
instancing.wgsl Fix shader_instancing example (#9448) 2023-08-15 07:28:45 +00:00
line_material.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
post_processing.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
shader_defs.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
show_prepass.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
texture_binding_array.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
tonemapping_test_patterns.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00