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.
      • name

        public java.lang.String name
        The name 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 parent name.
      • 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 name,
                              SceneGraphNode parent)
      • SceneGraphNode

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

      • add

        public final void add​(SceneGraphNode... children)
        Adds the given SceneGraphNode list as children to this node.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        time -
      • initialize

        public void initialize()
      • doneLoading

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

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

        public java.lang.String getName()
      • 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.
        Parameters:
        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
        Returns:
        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
        Returns:
        The copied object
      • toString

        public java.lang.String toString()
        Overrides:
        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.
        Parameters:
        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 vgroup list
        Parameters:
        renderable - The renderable to add
        rg - The render vgroup that identifies the renderable list
        Returns:
        True if added, false otherwise
      • removeFromRender

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

        public SceneGraphNode getFirstStarAncestor()
        Gets the first ancestor of this node that is of type Star
        Returns:
        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.
        Parameters:
        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
        Parameters:
        map - The index
      • mustAddToIndex

        public boolean mustAddToIndex()
        Whether to add this node to the index
        Returns:
        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)
        Returns: