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 voidcleanup(Application app) Cleans up resources when the app state is detached.floatReturns the current scale of the light probe's debug sphere.protected voidinitialize(Application app) Called during initialization once the app state is attached and before onEnable() is called.booleanChecks if the light debug gizmos are set to always render on top of other scene geometry.protected voidCalled when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.protected voidonEnable()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.voidrender(RenderManager rm) Renders the debug gizmos onto the screen.voidsetLightFilter(Predicate<Light> lightFilter) Sets a filter to control which lights are displayed by the debug state.voidsetLightProbeScale(float scale) Sets the scale of the light probe's debug sphere.voidSets the scene for which to render light gizmos.voidsetShowOnTop(boolean showOnTop) Sets whether light debug gizmos should always render on top of other scene geometry.voidupdate(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:BaseAppStateCalled during initialization once the app state is attached and before onEnable() is called.- Specified by:
initializein 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:
updatein interfaceAppState- Overrides:
updatein classBaseAppState- Parameters:
tpf- The time per frame.
-
render
Renders the debug gizmos onto the screen.- Specified by:
renderin interfaceAppState- Overrides:
renderin 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:
cleanupin classBaseAppState- Parameters:
app- The application instance.
-
onEnable
protected void onEnable()Description copied from class:BaseAppStateCalled 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:
onEnablein classBaseAppState
-
onDisable
protected void onDisable()Description copied from class:BaseAppStateCalled 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:
onDisablein classBaseAppState
-