Class SceneGraphNode

    • Field Detail

      • sg

        public static ISceneGraph sg
        Reference to scene graph
      • id

        public long id
        The internal identifier
      • children

        public com.badlogic.gdx.utils.Array<SceneGraphNode> children
        List of children entities.
      • translation

        public Vector3d translation
        Translation object.
      • localTransform

        public com.badlogic.gdx.math.Matrix4 localTransform
        Local transform matrix. Contains the transform matrix and the transformations that will be applied to this object and not to its children.
      • orientation

        public Matrix4d orientation
        This transform stores only the orientation of the object. For example in planets, it stores their orientation with respect to their equatorial plane, but not other transformations applied to the object such as the size or the rotation angle at the time.
      • names

        public java.lang.String[] names
        The name(s) of the node, if any.
      • namekey

        protected java.lang.String namekey
        The key to the name in the i18n system.
      • parentName

        public java.lang.String parentName
        The first name of the parent object.
      • parentkey

        protected java.lang.String parentkey
        The key of the parent
      • numChildren

        public int numChildren
        The total number of descendants under this node.
      • computed

        public boolean computed
        Flag indicating whether the object has been computed in this step.
      • opacity

        public float opacity
        The ownOpacity value (alpha)
      • ct

        public ComponentTypes ct
        Component types, for managing visibility
    • Constructor Detail

      • SceneGraphNode

        public SceneGraphNode()
      • SceneGraphNode

        public SceneGraphNode​(int id)
      • SceneGraphNode

        public SceneGraphNode​(java.lang.String[] names,
                              SceneGraphNode parent)
      • SceneGraphNode

        public SceneGraphNode​(java.lang.String name,
                              SceneGraphNode parent)
      • SceneGraphNode

        public SceneGraphNode​(java.lang.String name)
    • Method Detail

      • insert

        public static boolean insert​(SceneGraphNode node,
                                     boolean addToIndex)
        Inserts the given node into the default scene graph, if it exists.
        node - The node to insert
        addToIndex - Whether to add to the index
        True if it was inserted, false otherwise
      • add

        public final void add​(SceneGraphNode... children)
        Adds the given SceneGraphNode list as children to this node.
        children -
      • addChild

        public final void addChild​(SceneGraphNode child,
                                   boolean updateAncestorCount)
        Adds a child to the given node and updates the number of children in this node and in all ancestors.
        child - The child node to add.
        updateAncestorCount - Whether to update the ancestors number of children.
      • removeChild

        public final void removeChild​(SceneGraphNode child,
                                      boolean updateAncestorCount)
        Removes the given child from this node, if it exists.
        child -
        updateAncestorCount -
      • addChild

        public final void addChild​(SceneGraphNode child,
                                   boolean updateAncestorCount,
                                   int numChildren)
        Adds a child to the given node and updates the number of children in this node and in all ancestors.
        child - The child node to add.
        updateAncestorCount - Whether to update the ancestors number of children.
        numChildren - The number of children this will hold.
      • add

        public void add​(java.util.List<? extends SceneGraphNode> children)
        Adds the given list of children as child nodes.
        children -
      • insert

        public final void insert​(java.util.List<? extends SceneGraphNode> nodes)
        Inserts the list of nodes under the parents that match each node's name.
        nodes -
      • getChildByNameAndType

        public SceneGraphNode getChildByNameAndType​(java.lang.String name,
                                                    java.lang.Class<? extends SceneGraphNode> clazz)
      • getChildByName

        public SceneGraphNode getChildByName​(java.lang.String name)
      • updateLocal

        protected void updateLocal​(ITimeFrameProvider time,
                                   ICamera camera)
        Updates the transform matrix with the transformations that will apply to the children and the local transform matrix with the transformations that will apply only to this object.
        time -
      • initialize

        public void initialize()
      • doneLoading

        public void doneLoading​(com.badlogic.gdx.assets.AssetManager manager)
      • setNames

        public void setNames​(java.lang.String... names)
      • setName

        public void setName​(java.lang.String name)
      • addName

        public void addName​(java.lang.String name)
        Adds a name to the list of names
        name - The name
      • getNames

        public java.lang.String[] getNames()
      • getName

        public java.lang.String getName()
      • namesConcat

        public java.lang.String namesConcat()
      • hasName

        public boolean hasName​(java.lang.String candidate)
      • hasName

        public boolean hasName​(java.lang.String candidate,
                               boolean matchCase)
      • setNamekey

        public void setNamekey​(java.lang.String namekey)
      • updateNames

        public void updateNames()
        Updates the name using the key. This must be called when the language changes.
      • updateNamesRec

        public void updateNamesRec()
        Recursively updates the name using the key. This must be called when the language changes.
      • setId

        public void setId​(java.lang.Long id)
      • getId

        public long getId()
      • setParent

        public void setParent​(java.lang.String parentName)
      • setParentkey

        public void setParentkey​(java.lang.String parentkey)
      • dispose

        public void dispose()
        Specified by:
        dispose in interface com.badlogic.gdx.utils.Disposable
      • addFocusableObjects

        public void addFocusableObjects​(com.badlogic.gdx.utils.Array<IFocus> list)
        Adds all the children that are focusable objects to the list.
        list -
      • addNodes

        public void addNodes​(com.badlogic.gdx.utils.Array<SceneGraphNode> nodes)
      • setUp

        public void setUp()
      • setCt

        public void setCt​(java.lang.String ct)
      • setCt

        public void setCt​(java.lang.String[] cts)
      • getAggregatedChildren

        public int getAggregatedChildren()
        Gets the number of nodes contained in this node, including itself
        The number of children of this node and its descendents
      • getSimpleCopy

        public <T extends SceneGraphNode> T getSimpleCopy()
        Gets a copy of this object but does not copy its parent or children
        The copied object
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • returnToPool

        public void returnToPool()
      • setComputedFlag

        public void setComputedFlag​(com.badlogic.gdx.utils.Array<SceneGraphNode> nodes,
                                    boolean computed)
        Sets the computed flag of the list of nodes and their children to the given value.
        nodes - List of nodes to set the flag to. May be null.
        computed - The computed value.
      • addToRender

        protected boolean addToRender​(IRenderable renderable,
                                      SceneGraphNode.RenderGroup rg)
        Adds the given renderable to the given render group list
        renderable - The renderable to add
        rg - The render group that identifies the renderable list
        True if added, false otherwise
      • removeFromRender

        protected boolean removeFromRender​(IRenderable renderable,
                                           SceneGraphNode.RenderGroup rg)
        Removes the given renderable from the given render group list.
        renderable - The renderable to remove
        rg - The render group to remove from
        True if removed, false otherwise
      • getFirstStarAncestor

        public SceneGraphNode getFirstStarAncestor()
        Gets the first ancestor of this node that is of type Star
        The first ancestor of type Star
      • getOrientation

        public Matrix4d getOrientation()
      • isVisibilityOn

        public boolean isVisibilityOn()
      • getOpacity

        public float getOpacity()
      • getSceneGraphDepth

        public int getSceneGraphDepth()
      • addToIndex

        protected void addToIndex​(com.badlogic.gdx.utils.ObjectMap<java.lang.String,​SceneGraphNode> map)
        Special actions to be taken for this object when adding to the index.
        map - The index
      • removeFromIndex

        protected void removeFromIndex​(com.badlogic.gdx.utils.ObjectMap<java.lang.String,​SceneGraphNode> map)
        Special actions to be taken for this object when removing from the index. Must implement if addToIndex is implemented
        map - The index
      • mustAddToIndex

        public boolean mustAddToIndex()
        Whether to add this node to the index
        True if the node needs to be added to the index.
      • isValidPosition

        public boolean isValidPosition()
        Returns whether the current position is valid (usually, when there is no coordinates overflow)