6161import java .util .Iterator ;
6262import java .util .Map ;
6363import java .util .WeakHashMap ;
64+ import java .util .function .Predicate ;
6465
6566/**
6667 * A debug state that visualizes different types of lights in the scene with gizmos.
@@ -85,6 +86,7 @@ public class LightsDebugState extends BaseAppState {
8586 private Node debugNode ;
8687 private final Map <Light , Spatial > lightGizmoMap = new WeakHashMap <>();
8788 private final ArrayDeque <Light > lightDeque = new ArrayDeque <>();
89+ private Predicate <Light > lightFilter = x -> true ; // Identity Function
8890
8991 private AssetManager assetManager ;
9092 private Material debugMaterial ;
@@ -228,6 +230,10 @@ public void render(RenderManager rm) {
228230 private void updateLightGizmos (Spatial spatial ) {
229231 // Add or update gizmos for lights attached to the current spatial
230232 for (Light light : spatial .getLocalLightList ()) {
233+ if (!lightFilter .test (light )) {
234+ continue ;
235+ }
236+
231237 lightDeque .add (light );
232238 Spatial gizmo = lightGizmoMap .get (light );
233239
@@ -392,6 +398,16 @@ public void setLightProbeScale(float scale) {
392398 this .lightProbeScale = scale ;
393399 }
394400
401+ /**
402+ * Sets a filter to control which lights are displayed by the debug state.
403+ * By default, no filter is applied, meaning all lights are displayed.
404+ *
405+ * @param lightFilter A {@link Predicate} that tests a {@link Light} object.
406+ */
407+ public void setLightFilter (Predicate <Light > lightFilter ) {
408+ this .lightFilter = lightFilter ;
409+ }
410+
395411 /**
396412 * Cleans up resources when the app state is detached.
397413 *
0 commit comments