@@ -638,22 +638,23 @@ pub fn update_spot_light_frusta(
638
638
}
639
639
}
640
640
641
- pub fn check_light_mesh_visibility (
642
- visible_point_lights : Query < & VisibleClusterableObjects > ,
643
- mut point_lights : Query < (
644
- & PointLight ,
645
- & GlobalTransform ,
646
- & CubemapFrusta ,
647
- & mut CubemapVisibleEntities ,
648
- Option < & RenderLayers > ,
649
- ) > ,
650
- mut spot_lights : Query < (
651
- & SpotLight ,
652
- & GlobalTransform ,
653
- & Frustum ,
654
- & mut VisibleEntities ,
655
- Option < & RenderLayers > ,
656
- ) > ,
641
+ fn shrink_entities ( visible_entities : & mut Vec < Entity > ) {
642
+ // Check that visible entities capacity() is no more than two times greater than len()
643
+ let capacity = visible_entities. capacity ( ) ;
644
+ let reserved = capacity
645
+ . checked_div ( visible_entities. len ( ) )
646
+ . map_or ( 0 , |reserve| {
647
+ if reserve > 2 {
648
+ capacity / ( reserve / 2 )
649
+ } else {
650
+ capacity
651
+ }
652
+ } ) ;
653
+
654
+ visible_entities. shrink_to ( reserved) ;
655
+ }
656
+
657
+ pub fn check_dir_light_mesh_visibility (
657
658
mut directional_lights : Query <
658
659
(
659
660
& DirectionalLight ,
@@ -682,22 +683,6 @@ pub fn check_light_mesh_visibility(
682
683
> ,
683
684
visible_entity_ranges : Option < Res < VisibleEntityRanges > > ,
684
685
) {
685
- fn shrink_entities ( visible_entities : & mut Vec < Entity > ) {
686
- // Check that visible entities capacity() is no more than two times greater than len()
687
- let capacity = visible_entities. capacity ( ) ;
688
- let reserved = capacity
689
- . checked_div ( visible_entities. len ( ) )
690
- . map_or ( 0 , |reserve| {
691
- if reserve > 2 {
692
- capacity / ( reserve / 2 )
693
- } else {
694
- capacity
695
- }
696
- } ) ;
697
-
698
- visible_entities. shrink_to ( reserved) ;
699
- }
700
-
701
686
let visible_entity_ranges = visible_entity_ranges. as_deref ( ) ;
702
687
703
688
// Directional lights
@@ -804,6 +789,43 @@ pub fn check_light_mesh_visibility(
804
789
. for_each ( shrink_entities) ;
805
790
}
806
791
}
792
+ }
793
+
794
+ pub fn check_point_light_mesh_visibility (
795
+ visible_point_lights : Query < & VisibleClusterableObjects > ,
796
+ mut point_lights : Query < (
797
+ & PointLight ,
798
+ & GlobalTransform ,
799
+ & CubemapFrusta ,
800
+ & mut CubemapVisibleEntities ,
801
+ Option < & RenderLayers > ,
802
+ ) > ,
803
+ mut spot_lights : Query < (
804
+ & SpotLight ,
805
+ & GlobalTransform ,
806
+ & Frustum ,
807
+ & mut VisibleEntities ,
808
+ Option < & RenderLayers > ,
809
+ ) > ,
810
+ mut visible_entity_query : Query <
811
+ (
812
+ Entity ,
813
+ & InheritedVisibility ,
814
+ & mut ViewVisibility ,
815
+ Option < & RenderLayers > ,
816
+ Option < & Aabb > ,
817
+ Option < & GlobalTransform > ,
818
+ Has < VisibilityRange > ,
819
+ ) ,
820
+ (
821
+ Without < NotShadowCaster > ,
822
+ Without < DirectionalLight > ,
823
+ With < Handle < Mesh > > ,
824
+ ) ,
825
+ > ,
826
+ visible_entity_ranges : Option < Res < VisibleEntityRanges > > ,
827
+ ) {
828
+ let visible_entity_ranges = visible_entity_ranges. as_deref ( ) ;
807
829
808
830
for visible_lights in & visible_point_lights {
809
831
for light_entity in visible_lights. entities . iter ( ) . copied ( ) {
0 commit comments