bevy/crates/bevy_pbr/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
..
deferred WebGL2: fix import path for unpack_unorm3x4_plus_unorm_20_ (#10251) 2023-10-25 00:18:45 +00:00
environment_map Fix sampling of diffuse env map texture with non-uniform control flow (#10276) 2023-10-27 01:35:19 +00:00
prepass allow DeferredPrepass to work without other prepass markers (#10223) 2023-11-03 01:09:14 +00:00
render double sided normals: fix apply_normal_mapping calls (#10330) 2023-11-01 16:40:25 +00:00
ssao StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
alpha.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
bundle.rs Fix a typo in DirectionalLightBundle (#9861) 2023-09-20 04:44:56 +00:00
extended_material.rs StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
fog.rs chore: use ExtractComponent derive macro for EnvironmentMapLight and FogSettings (#10191) 2023-10-19 20:18:33 +00:00
lib.rs Make DirectionalLight Cascades computation generic over CameraProjection (#9226) 2023-11-03 06:07:59 +00:00
light.rs Make DirectionalLight Cascades computation generic over CameraProjection (#9226) 2023-11-03 06:07:59 +00:00
material.rs StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
wireframe.rs Use wildcard imports in bevy_pbr (#9847) 2023-10-25 08:40:55 +00:00