bevy/examples/3d
JMS55 70b0eacc3b
Keep track of when a texture is first cleared (#10325)
# Objective
- Custom render passes, or future passes in the engine (such as
https://github.com/bevyengine/bevy/pull/10164) need a better way to know
and indicate to the core passes whether the view color/depth/prepass
attachments have been cleared or not yet this frame, to know if they
should clear it themselves or load it.

## Solution

- For all render targets (depth textures, shadow textures, prepass
textures, main textures) use an atomic bool to track whether or not each
texture has been cleared this frame. Abstracted away in the new
ColorAttachment and DepthAttachment wrappers.

---

## Changelog
- Changed `ViewTarget::get_color_attachment()`, removed arguments.
- Changed `ViewTarget::get_unsampled_color_attachment()`, removed
arguments.
- Removed `Camera3d::clear_color`.
- Removed `Camera2d::clear_color`.
- Added `Camera::clear_color`.
- Added `ExtractedCamera::clear_color`.
- Added `ColorAttachment` and `DepthAttachment` wrappers.
- Moved `ClearColor` and `ClearColorConfig` from
`bevy::core_pipeline::clear_color` to `bevy::render::camera`.
- Core render passes now track when a texture is first bound as an
attachment in order to decide whether to clear or load it.

## Migration Guide
- Remove arguments to `ViewTarget::get_color_attachment()` and
`ViewTarget::get_unsampled_color_attachment()`.
- Configure clear color on `Camera` instead of on `Camera3d` and
`Camera2d`.
- Moved `ClearColor` and `ClearColorConfig` from
`bevy::core_pipeline::clear_color` to `bevy::render::camera`.
- `ViewDepthTexture` must now be created via the `new()` method

---------

Co-authored-by: vero <email@atlasdostal.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2023-12-31 00:37:37 +00:00
..
3d_gizmos.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
3d_scene.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
3d_shapes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
3d_viewport_to_world.rs Split Ray into Ray2d and Ray3d and simplify plane construction (#10856) 2023-12-06 14:09:04 +00:00
anti_aliasing.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
atmospheric_fog.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
blend_modes.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
bloom_3d.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
deferred_rendering.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
fog.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
generate_custom_mesh.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
lighting.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
lines.rs Add consuming builder methods for more ergonomic Mesh creation (#10056) 2023-10-09 19:47:41 +00:00
load_gltf.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
orthographic.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
parallax_mapping.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
parenting.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pbr.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
render_to_texture.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
shadow_biases.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
shadow_caster_receiver.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
skybox.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
spherical_area_lights.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
split_screen.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
spotlight.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
ssao.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
texture.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
tonemapping.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
transmission.rs Fix ci xvfb (#11143) 2023-12-30 09:07:31 +00:00
transparency_3d.rs Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
two_passes.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
update_gltf_scene.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
vertex_colors.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
wireframe.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00