bevy/crates/bevy_render/src
Sélène Amanita c376954b87
Make DirectionalLight Cascades computation generic over CameraProjection (#9226)
# Objective

Fixes https://github.com/bevyengine/bevy/issues/9077 (see this issue for
motivations)

## Solution

Implement 1 and 2 of the "How to fix it" section of
https://github.com/bevyengine/bevy/issues/9077

`update_directional_light_cascades` is split into
`clear_directional_light_cascades` and a generic
`build_directional_light_cascades`, to clear once and potentially insert
many times.

---

## Changelog

`DirectionalLight`'s computation is now generic over `CameraProjection`
and can work with custom camera projections.

## Migration Guide

If you have a component `MyCustomProjection` that implements
`CameraProjection`:
- You need to implement a new required associated method,
`get_frustum_corners`, returning an array of the corners of a subset of
the frustum with given `z_near` and `z_far`, in local camera space.
- You can now add the
`build_directional_light_cascades::<MyCustomProjection>` system in
`SimulationLightSystems::UpdateDirectionalLightCascades` after
`clear_directional_light_cascades` for your projection to work with
directional lights.

---------

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2023-11-03 06:07:59 +00:00
..
batching StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
camera Make DirectionalLight Cascades computation generic over CameraProjection (#9226) 2023-11-03 06:07:59 +00:00
color Add helper function to determine if color is transparent (#10310) 2023-10-31 15:00:49 +00:00
mesh Truncate attribute buffer data rather than attribute buffers (#10270) 2023-10-28 19:03:37 +00:00
primitives Add a method to compute a bounding box enclosing a set of points (#9630) 2023-08-31 01:33:13 +00:00
render_graph Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
render_phase StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
render_resource Derive Error for more error types (#10240) 2023-10-28 22:20:37 +00:00
renderer Bind group entries (#9694) 2023-10-21 15:39:22 +00:00
texture Image Sampler Improvements (#10254) 2023-10-26 23:30:09 +00:00
view Combine visibility queries in check_visibility_system (#10196) 2023-11-02 22:06:38 +00:00
extract_component.rs Updates for rust 1.73 (#10035) 2023-10-06 00:31:10 +00:00
extract_instances.rs chore: Renamed RenderInstance trait to ExtractInstance (#10065) 2023-10-13 17:06:53 +00:00
extract_param.rs Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
extract_resource.rs Allow optional extraction of resources from the main world (#10109) 2023-10-14 16:07:49 +00:00
globals.rs Unify FixedTime and Time while fixing several problems (#8964) 2023-10-16 01:57:55 +00:00
globals.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
gpu_component_array_buffer.rs Reorder render sets, refactor bevy_sprite to take advantage (#9236) 2023-08-27 14:33:49 +00:00
instance_index.wgsl Work around naga/wgpu WGSL instance_index -> GLSL gl_InstanceID bug on WebGL2 (#9383) 2023-08-09 18:38:45 +00:00
lib.rs Replace all labels with interned labels (#7762) 2023-10-25 21:39:23 +00:00
maths.wgsl Use instancing for sprites (#9597) 2023-09-02 18:03:19 +00:00
pipelined_rendering.rs Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
render_asset.rs Derive Error for more error types (#10240) 2023-10-28 22:20:37 +00:00
settings.rs Updates for rust 1.73 (#10035) 2023-10-06 00:31:10 +00:00
spatial_bundle.rs Improve SpatialBundle docs (#9673) 2023-09-02 23:44:12 +00:00