Skip to content

Commit

Permalink
Fix num_cascades in split_screen exmample for WebGL (#14601)
Browse files Browse the repository at this point in the history
# Objective

- Fixes #14595

## Solution

- Use `num_cascades: 1` in WebGL build.
`CascadeShadowConfigBuilder::default()` gives this number in WebGL:
https://github.com/bevyengine/bevy/blob/8235daaea0e3aa930e34c57887e1ffea08a8150a/crates/bevy_pbr/src/light/mod.rs#L241-L248

## Testing

- Tested the modified example in WebGL with Firefox/Chrome

---------

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
  • Loading branch information
akimakinai and JMS55 authored Aug 4, 2024
1 parent e164e5a commit c1c003d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/3d/split_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ fn setup(
..default()
},
cascade_shadow_config: CascadeShadowConfigBuilder {
num_cascades: 2,
num_cascades: if cfg!(all(
feature = "webgl2",
target_arch = "wasm32",
not(feature = "webgpu")
)) {
// Limited to 1 cascade in WebGL
1
} else {
2
},
first_cascade_far_bound: 200.0,
maximum_distance: 280.0,
..default()
Expand Down

0 comments on commit c1c003d

Please sign in to comment.