Skip to content

Commit

Permalink
use const Vec2 in lights cluster and bounding box when possible (bevy…
Browse files Browse the repository at this point in the history
…engine#4602)

- noticed a few Vec3 and Vec2 that could be const

- Declared them as const
- It seems to make a tiny improvement in example `many_light`, but given that the change is not complex at all it could still be worth it
  • Loading branch information
mockersf authored and robtfm committed May 10, 2022
1 parent f300809 commit c2db39b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,8 @@ fn compute_aabb_for_cluster(

Aabb::from_min_max(cluster_min, cluster_max)
}
const NDC_MIN: Vec2 = const_vec2!([-1.0, -1.0]);
const NDC_MAX: Vec2 = const_vec2!([1.0, 1.0]);

// Sort point lights with shadows enabled first, then by a stable key so that the index
// can be used to limit the number of point light shadows to render based on the device and
Expand Down

0 comments on commit c2db39b

Please sign in to comment.