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
      • pos

        public Vector3d pos
        Position of this entity in the local reference system. The units are Constants.U_TO_KM by default.
      • coordinates

        protected IBodyCoordinates coordinates
        Coordinates provider. Helps updating the position at each time step.
      • posSph

        public Vector2d posSph
        Position in the equatorial system; ra, dec.
      • size

        public float size
        Size factor in internal units.
      • distToCamera

        public double distToCamera
        The distance to the camera from the focus center.
      • viewAngle

        public double viewAngle
        The view angle, in radians.
      • viewAngleApparent

        public double viewAngleApparent
        The view angle corrected with the field of view angle, in radians.
      • cc

        public float[] cc
        Base color
      • copy

        public boolean copy
        Is this just a copy?
      • octantId

        public java.lang.Long octantId
        The id of the octant it belongs to, if any
    • 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

        public 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 -
      • addToRenderLists

        protected void addToRenderLists​(ICamera camera)
        Adds this entity to the necessary render lists after the distance to the camera and the view angle have been determined.
      • updateLocalValues

        public void updateLocalValues​(ITimeFrameProvider time,
                                      ICamera camera)
        This function updates all the local values before the localTransform is updated. Position, rotations and scale must be updated in here.
        time -
        camera -
      • initialize

        public void initialize()
      • doneLoading

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

        public boolean isCopy()
      • getPosition

        public Vector3d getPosition​(Vector3d aux)
        Returns the position of this entity in the internal reference system.
        aux - The vector where the result will be put
        The aux vector with the position
      • 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,
                                      SceneGraphRenderer.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,
                                           SceneGraphRenderer.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​(java.util.Map<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​(java.util.Map<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)
      • getNext

        public IFocus getNext​(ITimeFrameProvider time,
                              ICamera camera,
                              boolean force)
        Gets a copy of this entity which mimics its state in the next time step with position, orientation, etc.
        A copy of this entity in the next time step
      • getPredictedPosition

        public Vector3d getPredictedPosition​(Vector3d aux,
                                             ITimeFrameProvider time,
                                             ICamera camera,
                                             boolean force)
        Gets the position of this entity in the next time step in the internal reference system using the given time provider and the given camera.
        aux - The out vector where the result will be stored.
        time - The time frame provider.
        camera - The camera.
        force - Whether to force the computation if time is off.
        The aux vector for chaining.
      • mustUpdatePosition

        protected boolean mustUpdatePosition​(ITimeFrameProvider time)
        Whether position must be recomputed for this entity. By default, only when time is on
        time - The current time
        True if position should be recomputed for this entity
      • getAbsolutePosition

        public Vector3d getAbsolutePosition​(Vector3d out)
        Returns the absolute position of this entity in the native coordinates (equatorial system) and internal units
        out - Auxiliary vector to put the result in
        The vector with the position
      • getAbsolutePosition

        public Vector3d getAbsolutePosition​(java.lang.String name,
                                            Vector3d aux)
      • getAbsoluteOrientation

        public Matrix4d getAbsoluteOrientation​(Matrix4d aux)
      • getRadius

        public double getRadius()
        Returns the radius in internal units
        The radius of the object, in internal units
      • getHeight

        public double getHeight​(Vector3d camPos)
      • getHeight

        public double getHeight​(Vector3d camPos,
                                boolean useFuturePosition)
      • getHeightScale

        public double getHeightScale()
      • getSize

        public double getSize()
        Returns the size (diameter) of this entity in internal units.
        The size in internal units.
      • setSize

        public void setSize​(java.lang.Double size)
        Sets the absolute size (diameter) of this entity
        size - The diameter in internal units
      • setSize

        public void setSize​(java.lang.Long size)
        Sets the absolute size (diameter) of this entity
        size - The diameter in internal units
      • getPosSph

        public Vector2d getPosSph()
      • getAlpha

        public double getAlpha()
      • getDelta

        public double getDelta()
      • setColor

        public void setColor​(double[] color)
      • setColor

        public void setColor​(float[] color)
      • computeFuturePosition

        public Vector3d computeFuturePosition()
      • getDistToCamera

        public double getDistToCamera()
        Returns the current distance to the camera in internal units.
        The current distance to the camera, in internal units.
      • getViewAngle

        public double getViewAngle()
        Returns the current view angle of this entity, in radians.
        The view angle in radians.
      • getViewAngleApparent

        public double getViewAngleApparent()
        Returns the current apparent view angle (view angle corrected with the field of view) of this entity, in radians.
        The apparent view angle in radians.
      • getUnrotatedPos

        public Vector3d getUnrotatedPos()
      • setLabelcolor

        public void setLabelcolor​(float[] labelColor)
      • setLabelcolor

        public void setLabelcolor​(double[] labelColor)