Class LightsDebugState

java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.environment.util.LightsDebugState
All Implemented Interfaces:
AppState

public class LightsDebugState extends BaseAppState
A debug state that visualizes different types of lights in the scene with gizmos. This state is useful for debugging light positions, ranges, and other properties.
  • Constructor Details

    • LightsDebugState

      public LightsDebugState()
  • Method Details

    • initialize

      protected void initialize(Application app)
      Description copied from class: BaseAppState
      Called during initialization once the app state is attached and before onEnable() is called.
      Specified by:
      initialize in class BaseAppState
      Parameters:
      app - the application
    • update

      public void update(float tpf)
      Updates the light gizmos based on the current state of lights in the scene. This method is called every frame when the state is enabled.
      Specified by:
      update in interface AppState
      Overrides:
      update in class BaseAppState
      Parameters:
      tpf - The time per frame.
    • render

      public void render(RenderManager rm)
      Renders the debug gizmos onto the screen.
      Specified by:
      render in interface AppState
      Overrides:
      render in class BaseAppState
      Parameters:
      rm - The render manager.
    • setScene

      public void setScene(Spatial scene)
      Sets the scene for which to render light gizmos. If no scene is set, it defaults to the first scene in the viewport.
      Parameters:
      scene - The root of the desired scene.
    • getLightProbeScale

      public float getLightProbeScale()
      Returns the current scale of the light probe's debug sphere.
      Returns:
      The scale factor.
    • setLightProbeScale

      public void setLightProbeScale(float scale)
      Sets the scale of the light probe's debug sphere.
      Parameters:
      scale - The scale factor (default is 1.0).
    • isShowOnTop

      public boolean isShowOnTop()
      Checks if the light debug gizmos are set to always render on top of other scene geometry.
      Returns:
      true if gizmos always render on top, false otherwise.
    • setShowOnTop

      public void setShowOnTop(boolean showOnTop)
      Sets whether light debug gizmos should always render on top of other scene geometry.
      Parameters:
      showOnTop - true to always show gizmos on top, false to respect depth.
    • setLightFilter

      public void setLightFilter(Predicate<Light> lightFilter)
      Sets a filter to control which lights are displayed by the debug state. By default, no filter is applied, meaning all lights are displayed.
      Parameters:
      lightFilter - A Predicate that tests a Light object.
    • cleanup

      protected void cleanup(Application app)
      Cleans up resources when the app state is detached.
      Specified by:
      cleanup in class BaseAppState
      Parameters:
      app - The application instance.
    • onEnable

      protected void onEnable()
      Description copied from class: BaseAppState
      Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.
      Specified by:
      onEnable in class BaseAppState
    • onDisable

      protected void onDisable()
      Description copied from class: BaseAppState
      Called when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.
      Specified by:
      onDisable in class BaseAppState