bevy/examples/3d
Carter Anderson f28b921209 Add "depth_load_op" configuration to 3d Cameras (#4904)
# Objective

Users should be able to configure depth load operations on cameras. Currently every camera clears depth when it is rendered. But sometimes later passes need to rely on depth from previous passes.

## Solution

This adds the `Camera3d::depth_load_op` field with a new `Camera3dDepthLoadOp` value. This is a custom type because Camera3d uses "reverse-z depth" and this helps us record and document that in a discoverable way. It also gives us more control over reflection + other trait impls, whereas `LoadOp` is owned by the `wgpu` crate.

```rust
commands.spawn_bundle(Camera3dBundle {
    camera_3d: Camera3d {
        depth_load_op: Camera3dDepthLoadOp::Load,
        ..default()
    },
    ..default()
});
```

### two_passes example with the "second pass" camera configured to the default (clear depth to 0.0)

![image](https://user-images.githubusercontent.com/2694663/171743172-46d4fdd5-5090-46ea-abe4-1fbc519f6ee8.png)


### two_passes example with the "second pass" camera configured to "load" the depth
![image](https://user-images.githubusercontent.com/2694663/171743323-74dd9a1d-9c25-4883-98dd-38ca0bed8c17.png)

---

## Changelog

### Added

* `Camera3d` now has a `depth_load_op` field, which can configure the Camera's main 3d pass depth loading behavior.
2022-06-07 22:22:10 +00:00
..
3d_scene.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
lighting.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
load_gltf.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
msaa.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
orthographic.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
parenting.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
pbr.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
render_to_texture.rs Add "depth_load_op" configuration to 3d Cameras (#4904) 2022-06-07 22:22:10 +00:00
shadow_biases.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
shadow_caster_receiver.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
shapes.rs use the default() method in examples instead of Default::default() (#4952) 2022-06-07 02:16:47 +00:00
spherical_area_lights.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
split_screen.rs Add "depth_load_op" configuration to 3d Cameras (#4904) 2022-06-07 22:22:10 +00:00
texture.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
transparency_3d.rs use the default() method in examples instead of Default::default() (#4952) 2022-06-07 02:16:47 +00:00
two_passes.rs Add "depth_load_op" configuration to 3d Cameras (#4904) 2022-06-07 22:22:10 +00:00
update_gltf_scene.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
vertex_colors.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00
wireframe.rs Camera Driven Rendering (#4745) 2022-06-02 00:12:17 +00:00