bevy/examples/shader
Robert Swain 84991d34f3 Array texture example (#5077)
# Objective

- Make the reusable PBR shading functionality a little more reusable
  - Add constructor functions for `StandardMaterial` and `PbrInput` structs to populate them with default values
  - Document unclear `PbrInput` members
- Demonstrate how to reuse the bevy PBR shading functionality
- The final important piece from #3969 as the initial shot at making the PBR shader code reusable in custom materials

## Solution

- Add back and rework the 'old' `array_texture` example from pre-0.6.
- Create a custom shader material
  - Use a single array texture binding and sampler for the material bind group
  - Use a shader that calls `pbr()` from the `bevy_pbr::pbr_functions` import
- Spawn a row of cubes using the custom material
- In the shader, select the array texture layer to sample by using the world position x coordinate modulo the number of array texture layers

<img width="1392" alt="Screenshot 2022-06-23 at 12 28 05" src="https://user-images.githubusercontent.com/302146/175278593-2296f519-f577-4ece-81c0-d842283784a1.png">

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-06-28 00:58:50 +00:00
..
animate_shader.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
array_texture.rs Array texture example (#5077) 2022-06-28 00:58:50 +00:00
compute_shader_game_of_life.rs Update commented vsync code in example to use present_mode (#4926) 2022-06-04 20:00:01 +00:00
custom_vertex_attribute.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
post_processing.rs Add "depth_load_op" configuration to 3d Cameras (#4904) 2022-06-07 22:22:10 +00:00
shader_defs.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
shader_instancing.rs remove redundant query parameters (#4945) 2022-06-06 14:24:41 +00:00
shader_material.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
shader_material_glsl.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
shader_material_screenspace_texture.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00