Class RootNodeAppState

java.lang.Object
com.jme3.app.state.AbstractAppState
com.jme3.app.state.RootNodeAppState
All Implemented Interfaces:
AppState

public class RootNodeAppState extends AbstractAppState
AppState that manages and updates a RootNode attached to a ViewPort, the default Application ViewPort is used by default, a RootNode is created by default.
  • Field Details

    • viewPort

      protected ViewPort viewPort
    • rootNode

      protected Node rootNode
  • Constructor Details

    • RootNodeAppState

      public RootNodeAppState()
      Creates the AppState with a new, empty root Node, attaches it to the default Application ViewPort and updates it when attached to the AppStateManager.
    • RootNodeAppState

      public RootNodeAppState(ViewPort viewPort)
      Creates the AppState with the given ViewPort and creates a RootNode that is attached to the given ViewPort and updates it when attached to the AppStateManager.
      Parameters:
      viewPort - An existing ViewPort
    • RootNodeAppState

      public RootNodeAppState(Node rootNode)
      Creates the AppState with the given root Node, uses the default Application ViewPort and updates the root Node when attached to the AppStateManager.
      Parameters:
      rootNode - An existing root Node
    • RootNodeAppState

      public RootNodeAppState(ViewPort viewPort, Node rootNode)
      Creates the AppState with the given ViewPort and root Node, attaches the root Node to the ViewPort and updates it.
      Parameters:
      viewPort - An existing ViewPort
      rootNode - An existing root Node
    • RootNodeAppState

      public RootNodeAppState(String id, ViewPort viewPort, Node rootNode)
      Creates the AppState with the given unique ID, ViewPort, and root Node, attaches the root Node to the ViewPort and updates it.
      Parameters:
      id - the desired AppState ID
      viewPort - An existing ViewPort
      rootNode - An existing root Node
  • Method Details

    • initialize

      public void initialize(AppStateManager stateManager, Application app)
      Description copied from interface: AppState
      Called by AppStateManager when transitioning this AppState from initializing to running.
      This will happen on the next iteration through the update loop after AppStateManager.attach(com.jme3.app.state.AppState) was called.

      AppStateManager will call this only from the update loop inside the rendering thread. This means is it safe to modify the scene graph from this method.

      Specified by:
      initialize in interface AppState
      Overrides:
      initialize in class AbstractAppState
      Parameters:
      stateManager - The state manager
      app - The application
    • 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 AbstractAppState
      Parameters:
      tpf - Time since the last call to update(), in seconds.
    • cleanup

      public void cleanup()
      Description copied from interface: AppState
      Called by AppStateManager when transitioning this AppState from terminating to detached. This method is called the following render pass after the AppState has been detached and is always called once and only once for each time initialize() is called. Either when the AppState is detached or when the application terminates (if it terminates normally).
      Specified by:
      cleanup in interface AppState
      Overrides:
      cleanup in class AbstractAppState
    • getRootNode

      public Node getRootNode()
      Returns the managed rootNode.
      Returns:
      The managed rootNode
    • getViewPort

      public ViewPort getViewPort()
      Returns the used ViewPort
      Returns:
      The used ViewPort