Package com.jme3.environment.util
Class LightsDebugState
java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.environment.util.LightsDebugState
- All Implemented Interfaces:
AppState
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
cleanup
(Application app) Cleans up resources when the app state is detached.float
Returns the current scale of the light probe's debug sphere.protected void
initialize
(Application app) Called during initialization once the app state is attached and before onEnable() is called.boolean
Checks if the light debug gizmos are set to always render on top of other scene geometry.protected void
Called when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.protected void
onEnable()
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.void
render
(RenderManager rm) Renders the debug gizmos onto the screen.void
setLightFilter
(Predicate<Light> lightFilter) Sets a filter to control which lights are displayed by the debug state.void
setLightProbeScale
(float scale) Sets the scale of the light probe's debug sphere.void
Sets the scene for which to render light gizmos.void
setShowOnTop
(boolean showOnTop) Sets whether light debug gizmos should always render on top of other scene geometry.void
update
(float tpf) Updates the light gizmos based on the current state of lights in the scene.Methods inherited from class com.jme3.app.state.BaseAppState
cleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, setEnabled, setId, stateAttached, stateDetached
-
Constructor Details
-
LightsDebugState
public LightsDebugState()
-
-
Method Details
-
initialize
Description copied from class:BaseAppState
Called during initialization once the app state is attached and before onEnable() is called.- Specified by:
initialize
in classBaseAppState
- 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 interfaceAppState
- Overrides:
update
in classBaseAppState
- Parameters:
tpf
- The time per frame.
-
render
Renders the debug gizmos onto the screen.- Specified by:
render
in interfaceAppState
- Overrides:
render
in classBaseAppState
- Parameters:
rm
- The render manager.
-
setScene
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
Sets a filter to control which lights are displayed by the debug state. By default, no filter is applied, meaning all lights are displayed. -
cleanup
Cleans up resources when the app state is detached.- Specified by:
cleanup
in classBaseAppState
- 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 classBaseAppState
-
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 classBaseAppState
-