Package gaiasky.scene

Class Scene

java.lang.Object
gaiasky.scene.Scene

public class Scene extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    com.badlogic.ashley.core.Engine
    The engine, containing all entities, components and systems.
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addSystemsToEngine(com.badlogic.gdx.utils.Array<?> systems)
     
    void
    addToIndex(com.badlogic.ashley.core.Entity entity)
    Inserts the given entity into the index by running the index initializer system on it.
    Access to the archetypes.
    void
    Constructs the scene graph structure in the GraphNode components of the current entities.
    void
    disable(com.badlogic.ashley.core.EntitySystem... systems)
    Disable the given entity systems.
    void
    disable(com.badlogic.gdx.utils.Array<? extends com.badlogic.ashley.core.EntitySystem> array)
    Disable the given entity systems.
    void
    enable(com.badlogic.ashley.core.EntitySystem... systems)
    Enable the given entity systems.
    void
    enable(com.badlogic.gdx.utils.Array<? extends com.badlogic.ashley.core.EntitySystem> array)
    Enable the given entity systems.
    void
    extractEntity(com.badlogic.ashley.core.Entity entity)
    Runs the matching extract systems on the given entity.
    void
    findEntitiesByComponentType(ComponentTypes.ComponentType componentType, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> list)
     
    com.badlogic.ashley.utils.ImmutableArray<com.badlogic.ashley.core.Entity>
    findEntitiesByFamily(com.badlogic.ashley.core.Family family)
     
    com.badlogic.ashley.core.Entity
    Returns the focus entity with the given name, if it exists.
    com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity>
    Returns a list with all the entities which are focusable.
    com.badlogic.ashley.core.Entity
    Returns the entity with the given name, or null if it does not exist.
     
    com.badlogic.ashley.core.Entity
    getLineCopy(com.badlogic.ashley.core.Entity entity)
     
    int
    getNumberObjects(com.badlogic.ashley.core.Entity entity)
    Returns the number of actual objects held by this entity.
    int
    Computes the number of objects in the given octree node, recursively.
    double[]
    getObjectPosition(String name, double[] out)
    Gets the current position of the object identified by the given name.
    com.badlogic.ashley.core.Entity
    getSimpleCopy(com.badlogic.ashley.core.Entity entity)
     
    Access to the index.
    void
     
    void
    Sets up the initializing systems and runs them.
    void
    initializeEntity(com.badlogic.ashley.core.Entity entity)
    Runs the matching initialization systems on the given entity.
    void
    Initializes the name and id index using the current entities.
    void
    insert(com.badlogic.ashley.core.Entity entity, boolean addToIndex)
     
    void
    matchingFocusableNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort)
    Returns focus entities matching the given string by name, to a maximum of maxResults.
    void
    Prepares the engine to start running update cycles.
    void
    remove(com.badlogic.ashley.core.Entity entity, boolean removeFromIndex)
    Removes the given entity from the scene.
    void
     
    void
    returnCopyObject(com.badlogic.ashley.core.Entity copy)
     
    void
    runOnce(com.badlogic.ashley.core.EntitySystem... systems)
    Runs the given entity systems only once with a dummy delta time of 0.
    void
    runOnce(com.badlogic.gdx.utils.Array<? extends com.badlogic.ashley.core.EntitySystem> array)
    Runs the given entity systems only once with a dummy delta time of 0.
    void
    Runs the set up initialization stage for all entities.
    void
    setUpEntity(com.badlogic.ashley.core.Entity entity)
    Runs the matching setup systems on the given entity.
    void
    Updates the scene.
    void
    updateEntity(com.badlogic.ashley.core.Entity entity, float deltaTime)
    Runs the matching update systems on the given entity.
    void
    updateEntityGraph(com.badlogic.ashley.core.Entity entity, ITimeFrameProvider time, Vector3b parentTranslation, float opacity)
    Updates the entity graph for the given entity with the given parent translation vector.
    void
    Updates the localized names of all entities in the scene.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ROOT_NAME

      public static final String ROOT_NAME
      See Also:
    • engine

      public com.badlogic.ashley.core.Engine engine
      The engine, containing all entities, components and systems.
  • Constructor Details

    • Scene

      public Scene()
  • Method Details

    • index

      public Index index()
      Access to the index.
    • archetypes

      public Archetypes archetypes()
      Access to the archetypes.
    • initialize

      public void initialize()
    • runOnce

      public void runOnce(com.badlogic.ashley.core.EntitySystem... systems)
      Runs the given entity systems only once with a dummy delta time of 0. Useful for running one-time initialization and loading tasks.
      Parameters:
      systems - The systems to run.
    • runOnce

      public void runOnce(com.badlogic.gdx.utils.Array<? extends com.badlogic.ashley.core.EntitySystem> array)
      Runs the given entity systems only once with a dummy delta time of 0. Useful for running one-time initialization and loading tasks.
      Parameters:
      array - The systems array to run.
    • enable

      public void enable(com.badlogic.ashley.core.EntitySystem... systems)
      Enable the given entity systems.
      Parameters:
      systems - The systems.
    • enable

      public void enable(com.badlogic.gdx.utils.Array<? extends com.badlogic.ashley.core.EntitySystem> array)
      Enable the given entity systems.
      Parameters:
      array - The systems.
    • disable

      public void disable(com.badlogic.ashley.core.EntitySystem... systems)
      Disable the given entity systems.
      Parameters:
      systems - The systems.
    • disable

      public void disable(com.badlogic.gdx.utils.Array<? extends com.badlogic.ashley.core.EntitySystem> array)
      Disable the given entity systems.
      Parameters:
      array - The systems.
    • initializeEntities

      public void initializeEntities()
      Sets up the initializing systems and runs them. These systems perform the initial entity initialization.
    • setUpEntities

      public void setUpEntities()
      Runs the set up initialization stage for all entities. This happens when all asset loading has finished.
    • addSystemsToEngine

      public void addSystemsToEngine(com.badlogic.gdx.utils.Array<?> systems)
    • initializeIndex

      public void initializeIndex()
      Initializes the name and id index using the current entities.
    • addToIndex

      public void addToIndex(com.badlogic.ashley.core.Entity entity)
      Inserts the given entity into the index by running the index initializer system on it.
      Parameters:
      entity - The entity.
    • buildSceneGraph

      public void buildSceneGraph()
      Constructs the scene graph structure in the GraphNode components of the current entities.
    • prepareUpdateSystems

      public void prepareUpdateSystems(ISceneRenderer sceneRenderer)
      Prepares the engine to start running update cycles. This method initializes the engine with all the necessary update systems.
    • initializeEntity

      public void initializeEntity(com.badlogic.ashley.core.Entity entity)
      Runs the matching initialization systems on the given entity. The systems are matched using their families.
      Parameters:
      entity - The entity to initialize.
    • setUpEntity

      public void setUpEntity(com.badlogic.ashley.core.Entity entity)
      Runs the matching setup systems on the given entity. The systems are matched using their families.
      Parameters:
      entity - The entity to set up.
    • updateEntity

      public void updateEntity(com.badlogic.ashley.core.Entity entity, float deltaTime)
      Runs the matching update systems on the given entity. The systems are matched using their families.
      Parameters:
      entity - The entity to update.
      deltaTime - Delta time in seconds.
    • extractEntity

      public void extractEntity(com.badlogic.ashley.core.Entity entity)
      Runs the matching extract systems on the given entity. The systems are matched using their families.
      Parameters:
      entity - The entity to update.
    • updateEntityGraph

      public void updateEntityGraph(com.badlogic.ashley.core.Entity entity, ITimeFrameProvider time, Vector3b parentTranslation, float opacity)
      Updates the entity graph for the given entity with the given parent translation vector. Use with caution, this may have unforeseen consequences, as the process usually updates the whole scene graph starting at the root. This by-passes the usual procedure to update a single entity and its subtree.
      Parameters:
      entity - The entity to update.
      time - The time object.
      parentTranslation - The parent translation.
      opacity - The opacity value.
    • update

      public void update(ITimeFrameProvider time)
      Updates the scene. This causes an update to the engine.
      Parameters:
      time - The time frame provider object.
    • insert

      public void insert(com.badlogic.ashley.core.Entity entity, boolean addToIndex)
    • remove

      public void remove(com.badlogic.ashley.core.Entity entity, boolean removeFromIndex)
      Removes the given entity from the scene.
      Parameters:
      entity - The entity.
      removeFromIndex - Whether to remove it from the index too.
    • updateLocalizedNames

      public void updateLocalizedNames()
      Updates the localized names of all entities in the scene.
    • getEntity

      public com.badlogic.ashley.core.Entity getEntity(String name)
      Returns the entity with the given name, or null if it does not exist.
      Parameters:
      name - The name of the entity to retrieve.
      Returns:
      The entity.
    • findFocus

      public com.badlogic.ashley.core.Entity findFocus(String name)
      Returns the focus entity with the given name, if it exists.
      Parameters:
      name - The name.
      Returns:
      The entity.
    • matchingFocusableNodes

      public void matchingFocusableNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort)
      Returns focus entities matching the given string by name, to a maximum of maxResults.
      Parameters:
      name - The name.
      results - The set where the results are to be stored.
      maxResults - The maximum number of results.
      abort - To enable abortion mid-computation.
    • findFocusableEntities

      public com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> findFocusableEntities()
      Returns a list with all the entities which are focusable.
      Returns:
      A list with all focusable entities in this scene.
    • findEntitiesByFamily

      public com.badlogic.ashley.utils.ImmutableArray<com.badlogic.ashley.core.Entity> findEntitiesByFamily(com.badlogic.ashley.core.Family family)
    • findEntitiesByComponentType

      public void findEntitiesByComponentType(ComponentTypes.ComponentType componentType, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> list)
    • getObjectPosition

      public double[] getObjectPosition(String name, double[] out)
      Gets the current position of the object identified by the given name. The given position is in the internal reference system and corrects stars for proper motions and other objects for their specific motions as well.
      Parameters:
      name - The name of the object
      out - The out double array
      Returns:
      The out double array if the object exists, has a position and out has 3 or more slots. Null otherwise.
    • getFamilies

      public Families getFamilies()
    • getLineCopy

      public com.badlogic.ashley.core.Entity getLineCopy(com.badlogic.ashley.core.Entity entity)
    • getSimpleCopy

      public com.badlogic.ashley.core.Entity getSimpleCopy(com.badlogic.ashley.core.Entity entity)
    • returnCopyObject

      public void returnCopyObject(com.badlogic.ashley.core.Entity copy)
    • reportDebugObjects

      public void reportDebugObjects()
    • getNumberObjects

      public int getNumberObjects(com.badlogic.ashley.core.Entity entity)
      Returns the number of actual objects held by this entity. Most entities count as only one object, but some, such as particle and star sets, orbital element sets or octrees, actually hold and wrap many objects.
      Parameters:
      entity - The entity.
      Returns:
      The number of objects it holds.
    • getNumberObjects

      public int getNumberObjects(OctreeNode node)
      Computes the number of objects in the given octree node, recursively.
      Parameters:
      node - The node.
      Returns:
      The number of objects.