Class BasePickState

java.lang.Object
com.jme3.app.state.BaseAppState
com.simsilica.lemur.event.BasePickState
All Implemented Interfaces:
AppState, PickState
Direct Known Subclasses:
MouseAppState, TouchAppState

public abstract class BasePickState extends BaseAppState implements PickState
Consolidates the PickEventSession management for doing scene picking. This is the base class for the MouseAppState and the TouchAppState.
  • Constructor Details

    • BasePickState

      protected BasePickState()
  • Method Details

    • getSession

      protected final PickEventSession getSession()
    • requestEnabled

      public void requestEnabled(Object owner)
      Signifies that the specified owner needs the pick state to be enabled.
      Specified by:
      requestEnabled in interface PickState
    • releaseEnabled

      public boolean releaseEnabled(Object owner)
      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 interface PickState
    • hasRequestedEnabled

      public boolean hasRequestedEnabled(Object owner)
      Description copied from interface: PickState
      Returns true if the specified owner has an active request for picking to be enabled.
      Specified by:
      hasRequestedEnabled in interface PickState
    • 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 interface PickState
    • setIncludeDefaultCollisionRoots

      public void setIncludeDefaultCollisionRoots(boolean b)
      Specified by:
      setIncludeDefaultCollisionRoots in interface PickState
    • getIncludeDefaultCollisionRoots

      public boolean getIncludeDefaultCollisionRoots()
      Specified by:
      getIncludeDefaultCollisionRoots in interface PickState
    • findViewPort

      @Deprecated public ViewPort findViewPort(Spatial s)
      Deprecated.
    • addCollisionRoot

      public void addCollisionRoot(ViewPort viewPort)
      Specified by:
      addCollisionRoot in interface PickState
    • addCollisionRoot

      public void addCollisionRoot(ViewPort viewPort, String layer)
      Specified by:
      addCollisionRoot in interface PickState
    • addCollisionRoot

      public void addCollisionRoot(Spatial root, ViewPort viewPort)
      Specified by:
      addCollisionRoot in interface PickState
    • addCollisionRoot

      public void addCollisionRoot(Spatial root, ViewPort viewPort, String layer)
      Specified by:
      addCollisionRoot in interface PickState
    • removeCollisionRoot

      public void removeCollisionRoot(ViewPort viewPort)
      Specified by:
      removeCollisionRoot in interface PickState
    • removeCollisionRoot

      public void removeCollisionRoot(Spatial root)
      Specified by:
      removeCollisionRoot in interface PickState
    • setPickLayerOrder

      public void setPickLayerOrder(String... layers)
      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 interface PickState
    • getPickLayerOrder

      public String[] getPickLayerOrder()
      Specified by:
      getPickLayerOrder in interface PickState
    • 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
    • cleanup

      protected void cleanup(Application app)
      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 class BaseAppState
      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 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
    • update

      public void update(float tpf)
      Description copied from interface: AppState
      Called to update the AppState. This method will be called every render pass if the AppState is both attached and enabled.
      Specified by:
      update in interface AppState
      Overrides:
      update in class BaseAppState
      Parameters:
      tpf - Time since the last call to update(), in seconds.
    • dispatchMotion

      protected abstract void dispatchMotion()