Package com.simsilica.lemur.event
Class BasePickState
java.lang.Object
com.jme3.app.state.BaseAppState
com.simsilica.lemur.event.BasePickState
- Direct Known Subclasses:
MouseAppState
,TouchAppState
Consolidates the PickEventSession management for doing
scene picking. This is the base class for the MouseAppState
and the TouchAppState.
-
Field Summary
Fields inherited from interface com.simsilica.lemur.event.PickState
PICK_LAYER_GUI, PICK_LAYER_SCENE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCollisionRoot
(ViewPort viewPort) void
addCollisionRoot
(ViewPort viewPort, String layer) void
addCollisionRoot
(Spatial root, ViewPort viewPort) void
addCollisionRoot
(Spatial root, ViewPort viewPort, String layer) protected void
cleanup
(Application app) Called after the app state is detached or during application shutdown if the state is still attached.protected abstract void
Deprecated.boolean
String[]
protected final PickEventSession
boolean
hasRequestedEnabled
(Object owner) Returns true if the specified owner has an active request for picking to be enabled.protected void
initialize
(Application app) Called during initialization once the app state is attached and before onEnable() is called.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.boolean
releaseEnabled
(Object owner) Signifies that the specified owner no longer needs the pick state to be enabled.void
removeCollisionRoot
(ViewPort viewPort) void
removeCollisionRoot
(Spatial root) void
requestEnabled
(Object owner) Signifies that the specified owner needs the pick state to be enabled.boolean
Refreshes the enabled/disabled state based on the current request count.void
setIncludeDefaultCollisionRoots
(boolean b) void
setPickLayerOrder
(String... layers) Sets the order in which the pick layers will be checked for collisions.void
update
(float tpf) Called to update theAppState
.Methods inherited from class com.jme3.app.state.BaseAppState
cleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, render, setEnabled, setId, stateAttached, stateDetached
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jme3.app.state.AppState
cleanup, getId, initialize, isEnabled, isInitialized, postRender, render, setEnabled, stateAttached, stateDetached
-
Constructor Details
-
BasePickState
protected BasePickState()
-
-
Method Details
-
getSession
-
requestEnabled
Signifies that the specified owner needs the pick state to be enabled.- Specified by:
requestEnabled
in interfacePickState
-
releaseEnabled
Signifies that the specified owner no longer needs the pick state to be enabled. Will return true if the state is still enabled (because of other requests) or false if the state is now disabled.- Specified by:
releaseEnabled
in interfacePickState
-
hasRequestedEnabled
Description copied from interface:PickState
Returns true if the specified owner has an active request for picking to be enabled.- Specified by:
hasRequestedEnabled
in interfacePickState
-
resetEnabled
public boolean resetEnabled()Description copied from interface:PickState
Refreshes the enabled/disabled state based on the current request count. This is useful to reset the 'stack' if a forced enable/disable was previously done.- Specified by:
resetEnabled
in interfacePickState
-
setIncludeDefaultCollisionRoots
public void setIncludeDefaultCollisionRoots(boolean b) - Specified by:
setIncludeDefaultCollisionRoots
in interfacePickState
-
getIncludeDefaultCollisionRoots
public boolean getIncludeDefaultCollisionRoots()- Specified by:
getIncludeDefaultCollisionRoots
in interfacePickState
-
findViewPort
Deprecated. -
addCollisionRoot
- Specified by:
addCollisionRoot
in interfacePickState
-
addCollisionRoot
- Specified by:
addCollisionRoot
in interfacePickState
-
addCollisionRoot
- Specified by:
addCollisionRoot
in interfacePickState
-
addCollisionRoot
- Specified by:
addCollisionRoot
in interfacePickState
-
removeCollisionRoot
- Specified by:
removeCollisionRoot
in interfacePickState
-
removeCollisionRoot
- Specified by:
removeCollisionRoot
in interfacePickState
-
setPickLayerOrder
Sets the order in which the pick layers will be checked for collisions. The default ordering is PICK_LAYER_GUI then PICK_LAYER_SCENE.- Specified by:
setPickLayerOrder
in interfacePickState
-
getPickLayerOrder
- Specified by:
getPickLayerOrder
in interfacePickState
-
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
-
cleanup
Description copied from class:BaseAppState
Called after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.- Specified by:
cleanup
in classBaseAppState
- Parameters:
app
- the application
-
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
-
update
public void update(float tpf) Description copied from interface:AppState
Called to update theAppState
. This method will be called every render pass if theAppState
is both attached and enabled.- Specified by:
update
in interfaceAppState
- Overrides:
update
in classBaseAppState
- Parameters:
tpf
- Time since the last call to update(), in seconds.
-
dispatchMotion
protected abstract void dispatchMotion()
-